13
« on: January 07, 2012, 08:28:19 pm »
here is !gotoloc cmd
and !saveloc added
else if ( strcmp( cmd, "!gotoloc", true ) == 0 )
{
tmp = strtok( cmdtext, idx );
if ( !IsLoggedIn( playerid ) ) SendClientMessage( playerid, COLOR_RED, "Please log-in to your account." );
else if ( !IsAuthorized( playerid, cmd ) ) SendClientMessage( playerid, COLOR_RED, "You don't have access to use this command!" );
else if ( !strlen( tmp ) ) SendClientMessage( playerid, COLOR_GREEN, "USAGE: !gotoloc [Name]" );
else
{
new splitx[ 3 ][ 128 ], szMsg[ 128 ];
if ( !IsLocationExist( tmp ) )
{
format( szMsg, sizeof( szMsg ), "Location:[ %s ] does not exist.", tmp );
SendClientMessage( playerid, COLOR_GREEN, szMsg );
return 1;
}
split( dini_Get( "/SavedLocations/Locations.ini", tmp ), splitx, ' ' );
SetPlayerPos( playerid, floatstr( splitx[ 0 ] ), floatstr( splitx[ 1 ] ), floatstr( splitx[ 2 ] ), 0, 0 );
format( szMsg, sizeof( szMsg ), "Teleporting to location:[ %s ]", tmp );
SendClientMessage( playerid, COLOR_GREEN, szMsg );
}
return 1;
}
else if ( strcmp( cmd, "!saveloc", true ) == 0 )
{
tmp = strtok( cmdtext, idx );
if ( !IsLoggedIn( playerid ) ) SendClientMessage( playerid, COLOR_RED, "Please log-in to your account." );
else if ( !IsAuthorized( playerid, cmd ) ) SendClientMessage( playerid, COLOR_RED, "You don't have access to use this command!" );
else if ( !strlen( tmp ) ) SendClientMessage( playerid, COLOR_GREEN, "USAGE: !saveloc [Name]" );
else
{
new szMsg[ 128 ], axcont[ 128 ], Float:x, Float:y, Float:z;
GetPlayerPos( playerid, x, y, z );
format( axcont, 128, "%.5f %.5f %.5f", x, y, z );
dini_Set( "/SavedLocations/Locations.ini", tmp, axcont );
format( szMsg, sizeof( szMsg ), "Location saved as:[ %s ]", tmp );
SendClientMessage( playerid, COLOR_GREEN, szMsg );
}
return 1;
}