SA-MP Forums Archive
/goto command. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: /goto command. (/showthread.php?tid=660200)



/goto command. - Calinut200 - 27.10.2018

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!");




Re: /goto command. - v1k1nG - 27.10.2018

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!");




Re: /goto command. - TadePoleMG - 27.10.2018

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.


Re: /goto command. - GTLS - 28.10.2018

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.


Re: /goto command. - TheToretto - 28.10.2018

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.


Re: /goto command. - Infin1ty - 28.10.2018

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


Re: /goto command. - GTLS - 30.10.2018

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.