SA-MP Forums Archive
3 errors in 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: 3 errors in command (/showthread.php?tid=569887)



3 errors in command - ultrAslan - 03.04.2015

Hello i need help with this errors can you help please :

All errors are in the same line

Quote:

(5075) : error 017: undefined symbol "player_zone"
(5075) : warning 215: expression has no effect
(5075) : error 001: expected token: ";", but found "]"
(5075) : error 029: invalid expression, assumed zero
(5075) : fatal error 107: too many error messages on one line

Quote:

COMMAND:loc(playerid, params[])
{
SendAdminText(playerid, "/loc", params);

new id;
new target, current_zone;
current_zone = player_zone[target]; // error Line
if(sscanf(params, "u", id))
{
SendClientMessage(playerid, 0xFF0000FF, "Usage: /loc [playerid]");
}
else
{
if(current_zone != -1 && IsPlayerConnected(target))
{
new playername[MAX_PLAYER_NAME],message2[170];
GetPlayerName(id,playername,MAX_PLAYER_NAME);
format(message2,sizeof(message2),"%s(%d)'s current location: %s",playername,target,zones[current_zone][zone_name]);
SendClientMessage(playerid,0x00C7FFAA,message2);
}
else
{
SendClientMessage(playerid,red,"Invalid Player ID");
}
}
}




Re: 3 errors in command - CalvinC - 03.04.2015

Quote:

error 017: undefined symbol "player_zone"

You haven't defined it.


AW: Re: 3 errors in command - ultrAslan - 03.04.2015

Quote:
Originally Posted by CalvinC
Посмотреть сообщение
You haven't defined it.
Quote:

current_zone = player_zone

is this not ?


Re: 3 errors in command - Golf - 03.04.2015

you have ?
PHP код:
new player_zone[MAX_PLAYERS]; 



Re: 3 errors in command - CalvinC - 03.04.2015

No, use new to declare it.
You see you declare current_zone:
Код:
new target, current_zone;
current_zone = player_zone[target];
But not player_zone.

I don't understand what you're trying to do with "target" either, you're just declaring a variable which will be 0.
Shouldn't you use id or playerid?