SA-MP Forums Archive
: error 010: invalid function or declaration - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: : error 010: invalid function or declaration (/showthread.php?tid=84172)



: error 010: invalid function or declaration - SEC - 29.06.2009

Код:
new player[MAX_PLAYERS];

public OnPlayerCommandText(playerid, cmdtext[])
{
new cmd[128], idx;
cmd = strtok(cmdtext, idx);
if (strcmp("/goto", cmd, true, 10) == 0)
{
new tmp[64];
tmp = strtok(cmdtext, idx);
if(strlen(tmp) == 0) return SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /goto [playerid]");
new name[MAX_PLAYER_NAME+1];
new string[128];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "%s (ID:%i) wants to teleport to you. Type /yes to accept and /no to avoid it!", name,playerid);
SendClientMessage(strval(tmp),0xFFFFFFFF,string);
player[strval(tmp)] = playerid;
return 1;
}
if (strcmp(cmdtext,"/yes",true) == 0)
{
new Float:x,Float:y,Float:z;
GetPlayerPos(playerid,x,y,z);
if(IsPlayerInAnyVehicle(player[playerid])){
SetVehiclePos(GetPlayerVehicleID(player[playerid]),x+5,y,z+2);
}else{
SetPlayerPos(player[playerid],x+3,y,z+2);
}
return 1;
}
if (strcmp(cmdtext,"/no",true) == 0)
{
new name[MAX_PLAYER_NAME+1];
new string[128];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "%s (ID:%i) does not want you to teleport to him!", name,playerid);
SendClientMessage(player[playerid],0xFFFFFFFF,string);
}
return 1;
}
return 0; //here it says it is the error!
}
Can you help me?


Re: : error 010: invalid function or declaration - yom - 29.06.2009

Indent and you will see the obvious mistake.


Re: : error 010: invalid function or declaration - SEC - 29.06.2009

I just removed one bracket and now it works