pawn Код:
CMD:afk( playerid, params[ ] ) {
if( GetPVarInt( playerid, "afk" ) == 1 )
return SendClientMessage( playerid, -1, "You're already AFK. " );
SetPVarInt( playerid, "afk", 1 );
SetPlayerVirtualWorld( playerid, playerid + 2 );
new
afkstr[ 40 ]
,lpname[ 24 ]
;
GetPlayerName( playerid, lpname, sizeof lpname );
format( afkstr, sizeof string, "%s is now AFK!", lpname );
return SendClientMessageToAll( -1, afkstr );
}
CMD:back( playerid, params[ ] ) {
if( GetPVarInt( playerid, "afk" ) == 0 )
return SendClientMessage( playerid, -1, "You're not AFK. " );
SetPVarInt( playerid, "afk", 0 );
SetPlayerVirtualWorld( playerid, 0 );
new
afkstr[ 40 ]
,lpname[ 24 ]
;
GetPlayerName( playerid, lpname, sizeof lpname );
format( afkstr, sizeof string, "%s is now back!", lpname );
return SendClientMessageToAll( -1, afkstr );
}
// Also uses SSCANF2.
CMD:get( playerid, params[ ] ) {
new id;
if( sscanf( params, "u", id ) )
return SendClientMessage( playerid, -1, "Usage: /get [ID]." );
if( !IsPlayerConnected( id ) )
return SendClientMessage( playerid, -1, "Player not connected. " );
if( id == playerid )
return SendClientMessage( playerid, -1, "You cannot get yourself. " );
new
Float:x
,Float:y
,Float:z
;
GetPlayerPos( playerid, x, y, z );
SetPlayerPos( id, x, y, z );
new
str[ 128 ]
,pname[ 24 ]
,aname[ 24 ]
;
GetPlayerName( playerid, aname, sizeof aname );
GetPlayerName( id, pname, sizeof pname );
format( str, sizeof str, "You have teleported %s to your position! ", pname );
SendClientMessage( playerid, -1, str );
format( str, sizeof str, "%s has teleported you to his position! ", aname );
return SendClientMessage( id, -1, str );
}