Issue, with if and for, help me please!
#1

Код:
markers = 0;
 CMD:togmarks(playerid, params[]){
for(new i = 0; i<=MAX_PLAYERS;i++)
{
new PlayerColor = GetPlayerColor(playerid);
/*(line 1363)*/ if(PlayerColor == 0xFFFFFF00 && markers = 1)
{
SetPlayerColor(i, ServerColors[random(20)]);

}
else if(PlayerColor != 0xFFFFFF00){
SetPlayerColor(i,PlayerColor);

}
markers = 1;
}
//FOR END HERE//
SendClientMessage(playerid, 0x33AA33AA,"Poof! you can see em' all!!");
return 1;

}
ERRORS:
Код:
C:\Servers\racing_samp\gamemodes\race.pwn(1358) : error 010: invalid function or declaration
C:\Servers\racing_samp\gamemodes\race.pwn(1363) : warning 211: possibly unintended assignment
C:\Servers\racing_samp\gamemodes\race.pwn(1363) : error 022: must be lvalue (non-constant)
C:\Servers\racing_samp\gamemodes\race.pwn(1363) : warning 215: expression has no effect
C:\Servers\racing_samp\gamemodes\race.pwn(1363) : error 001: expected token: ";", but found ")"
C:\Servers\racing_samp\gamemodes\race.pwn(1363) : error 029: invalid expression, assumed zero
C:\Servers\racing_samp\gamemodes\race.pwn(1363) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


5 Errors.
Help please!
Reply
#2

Try this

PHP код:
 CMD:togmarks(playeridparams[]){
markers 0;
for(new 
0i<=MAX_PLAYERS;i++)
{
new 
PlayerColor GetPlayerColor(playerid);
if(
PlayerColor[i] == 0xFFFFFF00 && markers 1)
{
SetPlayerColor(iServerColors[random(20)]);

}
else if(
PlayerColor[i] != 0xFFFFFF00){
SetPlayerColor(i,PlayerColor);

}
markers 1;
}
//FOR END HERE//
SendClientMessage(playerid0x33AA33AA,"Poof! you can see em' all!!");
return 
1;


Reply
#3

Quote:
Originally Posted by jasperschellekens
Посмотреть сообщение
Try this

PHP код:
 CMD:togmarks(playeridparams[]){
markers 0;
for(new 
0i<=MAX_PLAYERS;i++)
{
new 
PlayerColor GetPlayerColor(playerid);
if(
PlayerColor[i] == 0xFFFFFF00 && markers 1)
{
SetPlayerColor(iServerColors[random(20)]);
}
else if(
PlayerColor[i] != 0xFFFFFF00){
SetPlayerColor(i,PlayerColor);
}
markers 1;
}
//FOR END HERE//
SendClientMessage(playerid0x33AA33AA,"Poof! you can see em' all!!");
return 
1;

Now it says:
Код:
C:\Servers\racing_samp\gamemodes\race.pwn(1363) : error 028: invalid subscript (not an array or too many subscripts): "PlayerColor"
C:\Servers\racing_samp\gamemodes\race.pwn(1363) : warning 215: expression has no effect
C:\Servers\racing_samp\gamemodes\race.pwn(1363) : error 001: expected token: ";", but found "]"
C:\Servers\racing_samp\gamemodes\race.pwn(1363) : error 029: invalid expression, assumed zero
C:\Servers\racing_samp\gamemodes\race.pwn(1363) : fatal error 107: too many error messages on one line
Reply
#4

By your code you're setting markers to 1, MAX_PLAYERS times...
Reply
#5

Quote:
Originally Posted by Sew_Sumi
Посмотреть сообщение
By your code you're setting markers to 1, MAX_PLAYERS times...
Alright, I'll try to fix it, will update you guys.
Reply
#6

PHP код:
 CMD:togmarks(playeridparams[]){
markers 0;
for(new 
0i<=MAX_PLAYERS;i++)
{
new 
PlayerColor GetPlayerColor(i);
if(
PlayerColor == 0xFFFFFF00 && markers 1)
{
SetPlayerColor(iServerColors[random(20)]);
}
else if(
PlayerColor[i] != 0xFFFFFF00){
SetPlayerColor(i,PlayerColor);
}
markers 1;
}
//FOR END HERE//
SendClientMessage(playerid0x33AA33AA,"Poof! you can see em' all!!");
return 
1;

PlayerColor is a variable and not an array. You can't you use it like that. Try this. Also, Could you explain what this command does so that We can fix this?
Reply
#7

PHP код:
CMD:togmarks(playeridparams[]){
markers 0;
for(new 
0i<=MAX_PLAYERS;i++)
{
if(!
IsPlayerConnected(i)) continue;
new 
PlayerColor GetPlayerColor(i);
if(
PlayerColor == 0xFFFFFF00 && markers 1)
{
SetPlayerColor(iServerColors[random(20)]);
}
else if(
PlayerColor[i] != 0xFFFFFF00){
SetPlayerColor(i,PlayerColor);
}
markers 1;
}
//FOR END HERE//
SendClientMessage(playerid0x33AA33AA,"Poof! you can see em' all!!");
return 
1;

You should also check if the player is connected. Try this, It would do that as well.
Reply
#8

Further to this marker variable... You set it to 0 when you use the command, then set it MAX_PLAYER times to 1.

Also "Poof! you can see them all" will turn up whether you are disabling, or enabling the marks.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)