SA-MP Forums Archive
Setting offline cash - 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: Setting offline cash (/showthread.php?tid=636105)



Setting offline cash - 1fret - 20.06.2017

How can i add offline scores, example i have 10 score and then i use my command in game and try's to add 5 more score to the account, how can i do that while the player is offline?..

PHP Code:
    new INI:ACCOUNT INI_Open(file);
        
INI_SetTag(ACCOUNT,"data");
        
INI_WriteInt(ACCOUNT"Score""What would i add here? to add the score");
        
INI_Close(ACCOUNT); 



Re: Setting offline cash - ItzColaBoi - 20.06.2017

If you have the user files in scriptfiles folder you can edit his stats out.Hope this helps.


Re: Setting offline cash - Logic_ - 20.06.2017

It's pretty simple, I wonder what you're thinking in your mind on how to do it... Mind telling us?


Re: Setting offline cash - 1fret - 20.06.2017

Quote:
Originally Posted by Logic_
View Post
It's pretty simple, I wonder what you're thinking in your mind on how to do it... Mind telling us?
The only idea i can think of is getplayerscore, but how can i get a player score if he/she is offline so that surely wont work


Re: Setting offline cash - coool - 20.06.2017

Quote:
Originally Posted by 1fret
View Post
The only idea i can think of is getplayerscore, but how can i get a player score if he/she is offline so that surely wont work
GetPlayerScore using INI_Int,,


Re: Setting offline cash - Abagail - 20.06.2017

I'm against using outdated INI methods when there are things like MySQL or SQLite. If you're bound to using this, you should simply get their stored score and add on to it. Example where newscore is the amount of score you want to add on (or subtract by having it a negative value).
pawn Code:
INI_WriteInt(ACCOUNT, INI_Int(ACCOUNT, "Score") + newscore);



Re: Setting offline cash - HoangNam - 20.06.2017

I think you should do that in MySQL


Re: Setting offline cash - 1fret - 20.06.2017

Quote:
Originally Posted by Abagail
View Post
I'm against using outdated INI methods when there are things like MySQL or SQLite. If you're bound to using this, you should simply get their stored score and add on to it. Example where newscore is the amount of score you want to add on (or subtract by having it a negative value).
pawn Code:
INI_WriteInt(ACCOUNT, INI_Int(ACCOUNT, "Score") + newscore);
I dont know where i went wrong but that coding crashes my pawno, also im just starting to learn about MySQL and SQLite...

PHP Code:
 INI_WriteInt(ACCOUNTINI_Int(ACCOUNT"Score") + amount); 
I think this is why the pawno crashes

PHP Code:
 INI_WriteInt(ACCOUNTINI_Int(ACCOUNT