/goto command.
#1

How to send to the admin , You teleported to X with succes , when is use /goto X.
PHP код:
CMD:goto(playerid,params[])
{
    if(
PlayerInfo[playerid][pAdmin] >=|| IsPlayerAdmin(playerid))
    {
    new 
ID;
    new 
Float:X;
    new 
Float:Y;
    new 
Float:Z;
    new 
Float:A;
    if(
sscanf(params,"i"ID)) return SendClientMessage(playerid,-1,"{40FF00}INFO:{FFFFFF}Foloseste /goto [Name/id]");
    
GetPlayerPos(IDX,Y,Z);
    
GetPlayerFacingAngle(IDA);
    
SetPlayerPos(playeridX,Y,Z);
    
SetPlayerFacingAngle(playeridA);
    return 
1;
    }
    else return 
SendClientMessage(playerid,-1,"You do not have permission to use this command!");

Reply
#2

PHP код:
CMD:goto(playerid,params[])
{
    if(
PlayerInfo[playerid][pAdmin] >=|| IsPlayerAdmin(playerid))
    {
    new 
IDIDName[MAX_PLAYERS_NAME 1], string[128];
    new 
Float:X;
    new 
Float:Y;
    new 
Float:Z;
    new 
Float:A;
    if(
sscanf(params,"i"ID)) return SendClientMessage(playerid,-1,"{40FF00}INFO:{FFFFFF}Foloseste /goto [Name/id]");
    
GetPlayerName(IDIDNameMAX_PLAYER_NAME 1);
    
GetPlayerPos(IDX,Y,Z);
    
GetPlayerFacingAngle(IDA);
    
SetPlayerPos(playeridX,Y,Z);
    
SetPlayerFacingAngle(playeridA);
    
format(stringsizeof string"You teleported to %s(%d)"IDNameID);
    
SendClientMessage(playerid, -1string);
    return 
1;
    }
    else return 
SendClientMessage(playerid,-1,"You do not have permission to use this command!");

Reply
#3

hi but i don't know why this question! You don't know how to send messages if not go and learn first.You can easily learn it.
Reply
#4

Rookie mistake. Always check if the player id is valid or not. use IsPlayerConnected or if you have your server sided variable to check player is valid or not.
Reply
#5

PHP код:
if(sscanf(params,"u"ID)) return SendClientMessage(playerid,-1,"{40FF00}INFO:{FFFFFF}Foloseste /goto [Name/id]"); 
"u" combine both the target's id and his name or a part of it.
Reply
#6

Quote:
Originally Posted by GTLS
Посмотреть сообщение
Rookie mistake. Always check if the player id is valid or not. use IsPlayerConnected or if you have your server sided variable to check player is valid or not.
you could also check if ID is equal to INVALID_PLAYER_ID
Reply
#7

Quote:
Originally Posted by Infin1ty
Посмотреть сообщение
you could also check if ID is equal to INVALID_PLAYER_ID
Still a server sided variable storing Logged in status is recommended.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)