SA-MP Forums Archive
[Help] Writing and Reading from INI - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [Help] Writing and Reading from INI (/showthread.php?tid=71727)



[Help] Writing and Reading from INI - Lastman - 03.04.2009

[font=Courier New] I am new to pawno scripting. I want to write players skin ID in file and then read from it.
For example:

1] Suppose im wearing grove skin. When i type /copduty. My skin changes to Cop skin and my previous skin (grove skin) gets saved in the file.

2] When i type /offduty. My Cop skin disappears and changes to previous skin (grove skin).

If someone can just give me code of writing and reading the skin from the file. That will be enough for me to understand.

-Lastman


Re: [Help] Writing and Reading from INI - Norn - 03.04.2009

Search for dini.


Re: [Help] Writing and Reading from INI - MenaceX^ - 03.04.2009

But he wants ini.. ><

Use player enum, make it save by checking the player enum when you login/register/update.
On /duty you set the skin to what you want, on /offduty you set it to the skin from the player enum.
Like
pawn Код:
SetPlayerSkin(playerid,skin[playerid]); // If you don't do it in an enum
//if you do use it like
SetPlayerSkin(playerid,enumname[playerid][skin]);



Re: [Help] Writing and Reading from INI - Lastman - 03.04.2009

[font=courier new] Alright. I found a topic on this forum about DINI.

But i did not understood it well. Norn could you help me with this ? I made the code but i think its pretty wrong :

dini_Set("skinsave/file.ini", "GetPlayerNameEx(playerid)", "GetPlayerSkin(playerid)");

string = dini_Get("skinsave/file.ini", "samp");
if(strcmp(string, "GetPlayerNameEx(playerid)", false) == 0)
{
SetPlayerSkin(string)
}


Re: [Help] Writing and Reading from INI - Lastman - 03.04.2009

[font=courier new]bump please help, writing and reading from INI. I need very simple code of writing in INI (playername = skinid) and reading the skin id. please help


Re: [Help] Writing and Reading from INI - MenaceX^ - 03.04.2009

I don't know dini well..
But I already helped you with ini though.
What's GetPlayerNameEx?


Re: [Help] Writing and Reading from INI - ICECOLDKILLAK8 - 03.04.2009

Quote:
Originally Posted by MenaceX^
What's GetPlayerNameEx?
If its the one im thinking of then it removes/replaces the _ in the players name


Re: [Help] Writing and Reading from INI - Norn - 03.04.2009

Quote:
Originally Posted by MenaceX^
But he wants ini.. ><

Use player enum, make it save by checking the player enum when you login/register/update.
On /duty you set the skin to what you want, on /offduty you set it to the skin from the player enum.
Like
pawn Код:
SetPlayerSkin(playerid,skin[playerid]); // If you don't do it in an enum
//if you do use it like
SetPlayerSkin(playerid,enumname[playerid][skin]);
And thats what dini is.. It's a script for ini files.


Re: [Help] Writing and Reading from INI - MenaceX^ - 03.04.2009

Quote:
Originally Posted by JeNkStAX
Quote:
Originally Posted by MenaceX^
What's GetPlayerNameEx?
If its the one im thinking of then it removes/replaces the _ in the players name
Yeah but I'd like to know if it's mine of it's from Carlitos rp


Re: [Help] Writing and Reading from INI - Lastman - 03.04.2009

But guys can you just give me an example code of very simple writing (playerid=skinid) and then reading skin id. I just need that code to understand