Vice City Multiplayer
VC:MP 0.3 => mIRC/pawn Scripting => Topic started by: ramandu on March 03, 2010, 03:43:28 pm
-
i'm trying to make a command group hierarchy.
if the players primary group is any of the four in the "case" statement, he has access to all of that groups commands.
but as soon as i increase any of the "case" values above two characters, it throws many compile errors.
stock
IsPlayerGroup_Mod(Player[], Primary_Group[])
{
switch (Primary_Group[0])
{
// case 'a', 'b', 'c', 'd' : // -> works
// case '1', '2', '3', '4': // -> This works too
case 'USER', 'ADMIN', 'HALF-ADMIN', 'MODERATOR': // -> but this dosnt work, why ?
{
return 1;
}
}
return 0;
}
calling syntax: IsPlayerGroup_Mod("Ramandu", "ADMIN");
how do i solve it ?
thankyou very much
-
Afair ' is used for characters only. Use " for strings.
-
thankyou boss, it suppressed allot of the errors and leaves just this one;
error 008: must be a constant expression; assumed zero
-
Which exactly line gives that error?
It is usually thrown if you try to use variables outside of callbacks (e.g. specify array size with a variable).
-
hi, it points directly to this line
case "USER", "ADMIN", "HALF-ADMIN", "MODERATOR":
i am calling it like this,
if ( IsPlayerGroup_Mod("ramandu", "MODERATOR") ) { printf("yes, ramandu's group MODERATOR is found and also has access to user, admin, half-admin commands"); }
-
Why do you use Primary_Group[0]? It will switch only the first letter.
-
hi, it seems the topic was locked for no apparent reason.
you asked me a question.
Why do you use Primary_Group
its simply just name i gave it to represent the value of the function.
It will switch only the first letter.
ok thankyou for this information, how do i make it switch the complete word ?
-
hi, it seems the topic was locked for no apparent reason.
Might've been some bug, sorry.
ok thankyou for this information, how do i make it switch the complete word ?
Don't use [ 0 ] in switch. Just switch(Primary_Group).