: error 010: invalid function or declaration
#1

Код:
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?
Reply
#2

Indent and you will see the obvious mistake.
Reply
#3

I just removed one bracket and now it works
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)