SA-MP Forums Archive
Abaut saving - 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: Abaut saving (/showthread.php?tid=298569)



Abaut saving - elefante - 21.11.2011

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


Re: Abaut saving - MP2 - 22.11.2011

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
}



Re: Abaut saving - Camacorn - 22.11.2011

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.


Re: Abaut saving - MP2 - 22.11.2011

Note the comment I put after the strcmp line.