/goto errors i need help
#1

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.
Reply
#2

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;

Reply
#3

ty u so much
Reply
#4

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

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;

Reply
#6

Pawn is case sensitive
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)