Need Explanation - 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: Need Explanation (
/showthread.php?tid=568335)
Need Explanation -
NoDi522 - 21.03.2015
Hello.
So I am still new at scripting and I need an explanation.
For Example:
I have my sex dialog:
PHP Code:
case 0:
{
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File, "data");
INI_WriteInt(File,"Spol",0);
INI_Close(File);
SendClientMessage(playerid,-1,"{00C0FF}WG:{FFFFFF} Odabrali ste spol: muљko");
}
case 1:
{
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File, "data");
INI_WriteInt(File,"Spol",1);
INI_Close(File);
SendClientMessage(playerid,-1,"{00C0FF}WG:{FFFFFF} Odabrali ste spol: ћensko");
}
Right here you can see my code.
I want to make instead of this:
PHP Code:
INI_WriteInt(File,"Spol",0);
To save it something like this:
PHP Code:
INI_WriteInt(File,"Spol",Male);
And here i need help and explanation how to save it in words instead of numbers. Thanks
Re: Need Explanation -
De4dpOol - 21.03.2015
Use
INI_WriteString (It saves String) instead of
INI_WriteInt (It saves Integer value)
pawn Code:
INI_WriteString(ini, "Spol", "Male");
See
https://sampforum.blast.hk/showthread.php?tid=175565 for info about loading a string.
Use
strcmp to compare the string with "Male".
EDIT: Load it like:
pawn Code:
new Sex[10];
INI_String("Spol", Sex, sizeof(Sex));
Compare it like:
pawn Code:
if(!strcmp(Sex, "Male", true, 4))
{
//It is male
}
Re: Need Explanation -
NoDi522 - 21.03.2015
Thank you guys