Little help please. Radio.
#1

Hey guys. I'm trying to make a cop radio here.
The variable for the cops are : cop

My cmd:
pawn Код:
COMMAND:r(playerid,params[])
{
for(new cops;cops < MAX_PLAYERS; cops++)
{
if(cop[cops] >= 1)
{
format(string,sizeof(string),"Mechanic %s Says: %s",playername,cmdtext[3]);
SendClientMessage(cops,COLOR_BLUE,string);
}
}
return 1;
}
Errors:
Код:
C:\Users\Michael\Desktop\Samp scvripting\gamemodes\roleplay.pwn(729) : error 028: invalid subscript (not an array or too many subscripts): "cop"
C:\Users\Michael\Desktop\Samp scvripting\gamemodes\roleplay.pwn(729) : warning 215: expression has no effect
C:\Users\Michael\Desktop\Samp scvripting\gamemodes\roleplay.pwn(729) : error 001: expected token: ";", but found "]"
C:\Users\Michael\Desktop\Samp scvripting\gamemodes\roleplay.pwn(729) : error 029: invalid expression, assumed zero
C:\Users\Michael\Desktop\Samp scvripting\gamemodes\roleplay.pwn(729) : fatal error 107: too many error messages on one line

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


4 Errors.
Error line:
pawn Код:
if(cop[cops] >= 1)
Reply
#2

Is the "cop" variable an array? Post the code where you initialize it.
Reply
#3

At my playerinfo enum

pawn Код:
enum pInfo
{
    adminlevel,
    money,
    score,
    fishes,
    InFaction,
    bloods,
    cop,
    wantedlevel,
    phone,
    rope,
    sandwich,
}
new PlayerInfo[MAX_PLAYERS][pInfo];
Reply
#4

Okay well there's your problem right there. You're using it incorrectly. It should be:

pawn Код:
if(PlayerInfo[cops][cop] >= 1)
Reply
#5

The error line should be
pawn Код:
if(PlayerInfo[cops][cop] >=1)
EDIT: Dang it, too slow.
Reply
#6

aaah lol. I failed xD

Thankyou guys
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)