SA-MP Forums Archive
/goto errors i need help - 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 errors i need help (/showthread.php?tid=602568)



/goto errors i need help - kevi11 - 09.03.2016

this is script goto:
ocmd:goto(playerid,params[])
{
new ID;
if(sscanf(params, "u", ID)) SendClientMessage(playerid, 0xFF0000FF, "Usa: /goto [playerid]");
else if(!IsPlayerConnected(id) || id == playerid) return SendClientMessage(playerid, 0xFF0000FF, "Questo giocatore non и in game");
else
{
new Float, Float:y, Float:z;
GetPlayerPos(ID, x, y, z);
SetPlayerPos(playerid, x+1, y+1, z);
}
return 1;
}



this is error: C:\Users\Kevin11\Desktop\Nuova cartella\gamemodes\script.pwn(909) : error 017: undefined symbol "id"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Error.


Re: /goto errors i need help - Golden96 - 09.03.2016

Try:
PHP код:
ocmd:goto(playerid,params[])
{
new 
ID;
if(
sscanf(params"u"ID)) SendClientMessage(playerid0xFF0000FF"Usa: /goto [playerid]");
else if(!
IsPlayerConnected(ID) || ID == playerid) return SendClientMessage(playerid0xFF0000FF"Questo giocatore non и in game");
else
{
new 
Float:xFloat:yFloat:z;
GetPlayerPos(IDxyz);
SetPlayerPos(playeridx+1y+1z);
}
return 
1;




Re: /goto errors i need help - kevi11 - 09.03.2016

ty u so much


Re: /goto errors i need help - saffierr - 09.03.2016

Capitals are important, I suggest you to keep an eye on them !


Re: /goto errors i need help - TheHonnor - 09.03.2016

I suggest you to optimise your scripts like this:

PHP код:
ocmd:goto(playeridparams[])
{
    new 
Float:Pos[3];
    if(
sscanf(params"u"strval(params))) return SendClientMessage(playerid, -1"{FF8000}Syntax: /Goto [ID]");
    if(
strval(params) == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1"{FF8000}ERROR: Player not connected!");
    if(
strval(params) == playerid) return SendClientMessage(playerid, -1"{FF8000}ERROR: You can't teleport to Yourself!");
    
GetPlayerPos(strval(params), Pos[0], Pos[1], Pos[2]); SetPlayerPos(playeridPos[0], Pos[1], Pos[2]); return 1;




Re: /goto errors i need help - xTURBOx - 09.03.2016

Pawn is case sensitive