Abaut saving
#1

Hello all! I need that i For ex: Type command yea /test

And than this value get 1 or 2

Код:
dini_IntSet(file, "Sex",PlayerInfo[playerid][Sex] = 0);
///
And How Check this walue For ex comamnd /test2

And if this value 1 he cant do that
Reply
#2

I'll assume 0=male and 1=female but it could be the opposite.

pawn Код:
if(!strcmp(cmdtext, "/command", true)) // Or whatever command system you use
{
    if(PlayerInfo[playerid][Sex] == 1) return SendClientMessage(playerid, red, "Only males can use this command.");
    // code to do if they are male
}
Reply
#3

Quote:
Originally Posted by MP2
Посмотреть сообщение
I'll assume 0=male and 1=female but it could be the opposite.

pawn Код:
if(!strcmp(cmdtext, "/command", true)) // Or whatever command system you use
{
    if(PlayerInfo[playerid][Sex] == 1) return SendClientMessage(playerid, red, "Only males can use this command.");
    // code to do if they are male
}
ZCMD would be more reasonable.

pawn Код:
CMD:getsex(playerid, params[])
{
       if(PlayerInfo[playerid][Sex] != 0) return SendClientMessage(playerid, -1, "Only males can use this command!");
       return 1;
}
To change sex:
pawn Код:
CMD:sexchange(playerid, params[])
{
       if(PlayerInfo[playerid][Sex] != 1) return PlayerInfo[playerid][Sex] = 1;
       else if(PlayerInfo[playerid][Sex] != 0) return PlayerInfo[playerid][Sex] = 0;
       SendClientMessage(playerid, -1, "Sex changed!");
       return 1;
}
Enjoy.
Reply
#4

Note the comment I put after the strcmp line.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)