Saving system - 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: Saving system (
/showthread.php?tid=235246)
Saving system -
Markx - 05.03.2011
Hey all!
I got my own TDM server (not hosted yet) i am scripting it and when a player joins the server he will chose if he wants to be army, cop, terrorist or civilian, if thay got enough cash thay can do /level2 and upgrade (get better weapons etc..) I want to know, how can i save those levels when a players exits and load em when he connects again, please help! You will get /credits
Re: Saving system -
Steven82 - 05.03.2011
Look at some user account system tutorials in the tutorials section.
Re: Saving system -
Medal Of Honor team - 05.03.2011
SEE THIS
Re: Saving system -
wheelman_WM - 05.03.2011
if u dont know than y u bump the topics
Re: Saving system -
Steven82 - 05.03.2011
Quote:
Originally Posted by wheelman_WM
if u dont know than y u bump the topics
|
What the hell...are you talking about?
Re: Saving system -
Medal Of Honor team - 05.03.2011
Quote:
Originally Posted by wheelman_WM
if u dont know than y u bump the topics
|
are you telling to me?
Re: Saving system -
Markx - 05.03.2011
Quote:
Originally Posted by Medal Of Honor team
|
Thanks, maybe it will work :/
BTW: I got this for level 2:
pawn Код:
new IsPlayerArmyLevel2[MAX_PLAYERS];
new IsPlayerCopLevel2[MAX_PLAYERS];
new IsPlayerMafiaLevel2[MAX_PLAYERS];
new IsPlayerCivlianLevel2[MAX_PLAYERS];
new IsPlayerTerroristLevel2[MAX_PLAYERS];
And when a players does /level 2 it will do:
pawn Код:
IsPlayerArmyLevel2[playerid] = 1;
Re: Saving system -
Markx - 05.03.2011
Sry for duble post:
I got many problems and its not working, can someone make it for me?
Re: Saving system -
Mean - 05.03.2011
Y_Ini solution:
pawn Код:
new file[ 256 ];
new name[ 24 ];
GetPlayerName( playerid, name, 24 );
format( file, sizeof file, "SomeFolder/%s.ini", name );
new INI:PlayerAcc = INI_Open( file );
INI_WriteInt( PlayerAcc, "IsPlayerArmyLevel2", IsPlayerArmyLevel2[ playerid ] );
INI_WriteInt( PlayerAcc, "IsPlayerCopLevel2", IsPlayerCopLevel2[ playerid ] );
INI_WriteInt( PlayerAcc, "IsPlayerMafiaLevel2", IsPlayerMafiaLevel2[ playerid ] );
INI_WriteInt( PlayerAcc, "IsPlayerCivlianLevel2", IsPlayerCivlianLevel2[ playerid ] );
INI_WriteInt( PlayerAcc, "IsPlayerTerroristLevel2", IsPlayerTerroristLevel2[ playerid ] );
INI_Close( PlayerAcc );
The file of player if he is a level 2 cop will look like this:
Код:
IsPlayerArmyLevel2 = 0
IsPlayerCopLevel2 = 1
IsPlayerMafiaLevel2 = 0
IsPlayerCivlianLevel2 = 0
IsPlayerTerroristLevel2 = 0
Have fun. Hope you know how to load it.
So example of using my code:
pawn Код:
CMD:savemyleveltofile( playerid, params[ ] )
{
new file[ 256 ];
new name[ 24 ];
GetPlayerName( playerid, name, 24 );
format( file, sizeof file, "SomeFolder/%s.ini", name );
new INI:PlayerAcc = INI_Open( file );
INI_WriteInt( PlayerAcc, "IsPlayerArmyLevel2", IsPlayerArmyLevel2[ playerid ] );
INI_WriteInt( PlayerAcc, "IsPlayerCopLevel2", IsPlayerCopLevel2[ playerid ] );
INI_WriteInt( PlayerAcc, "IsPlayerMafiaLevel2", IsPlayerMafiaLevel2[ playerid ] );
INI_WriteInt( PlayerAcc, "IsPlayerCivlianLevel2", IsPlayerCivlianLevel2[ playerid ] );
INI_WriteInt( PlayerAcc, "IsPlayerTerroristLevel2", IsPlayerTerroristLevel2[ playerid ] );
INI_Close( PlayerAcc );
SendClientMessage( playerid, 0xAAAAAA, "Your status of your level 2 has been saved to userfile, directory: SA-MP server\scriptfiles\SomeFolder\yourname.ini" );
return 1;
}
Re: Saving system -
Markx - 05.03.2011
Thanks!
New question:
How can i make that when a player gets killed a pickup will be created and when a other player picks the pickup he will get the money from the person that dies + weapons