Enumerator and an Array - 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: Enumerator and an Array (
/showthread.php?tid=468830)
Enumerator and an Array - Patrick - 10.10.2013
The code inside the PAWN tag explains everything.
pawn Код:
//Enumerator & Enumerator Variable
enum EnumeratorName
{
EnumeratorValue[1] // 0 = 1, 1 = 2, 2 = 3 and so on.
}
new eName[EnumeratorName];
//Usage:
// if the EnumeratorName [0] = 1;
if( eName[ EnumeratorName [0] ] == 1 )
return SendClientMessage( playerid, -3, "Enumerator is currently on ( 1 )");
// if the EnumeratorName [0] = 0;
if( eName[ EnumeratorName [0] ] == 0 ) //means false or 0
return SendClientMessage( playerid, -2, "Enumerator is currently off ( 0 )");
// error 028: invalid subscript (not an array or too many subscripts): "EnumeratorValue"
Re: Enumerator and an Array -
tyler12 - 10.10.2013
It would have to be something like:
pawn Код:
if(eName[EnumeratorValue][0] == 1) return SendClientMessage(playerid,-3,"Enumerator is currently on ( 1 )");
if(eName[EnumeratorValue][0] == 0) return SendClientMessage(playerid,-2,"Enumerator is currently off ( 0 )");
I changed the style of how it was as I find it easier to read.
Re: Enumerator and an Array - Patrick - 10.10.2013
Quote:
Originally Posted by tyler12
It would have to be something like:
pawn Код:
if(eName[EnumeratorValue][0] == 1) return SendClientMessage(playerid,-3,"Enumerator is currently on ( 1 )"); if(eName[EnumeratorValue][0] == 0) return SendClientMessage(playerid,-2,"Enumerator is currently off ( 0 )");
I changed the style of how it was as I find it easier to read.
|
I appreciate your help.