SA-MP Forums Archive
Little help please. Radio. - 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: Little help please. Radio. (/showthread.php?tid=218093)



Little help please. Radio. - bartje01 - 29.01.2011

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)



Re: Little help please. Radio. - JaTochNietDan - 29.01.2011

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


Re: Little help please. Radio. - bartje01 - 29.01.2011

At my playerinfo enum

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



Re: Little help please. Radio. - JaTochNietDan - 29.01.2011

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

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



Re: Little help please. Radio. - randomkid88 - 29.01.2011

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


Re: Little help please. Radio. - bartje01 - 29.01.2011

aaah lol. I failed xD

Thankyou guys