Saving system
#1

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
Reply
#2

Look at some user account system tutorials in the tutorials section.
Reply
#3

SEE THIS
Reply
#4

if u dont know than y u bump the topics
Reply
#5

Quote:
Originally Posted by wheelman_WM
Посмотреть сообщение
if u dont know than y u bump the topics
What the hell...are you talking about?
Reply
#6

Quote:
Originally Posted by wheelman_WM
Посмотреть сообщение
if u dont know than y u bump the topics
are you telling to me?
Reply
#7

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;
Reply
#8

Sry for duble post:

I got many problems and its not working, can someone make it for me?
Reply
#9

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;
}
Reply
#10

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)