Save/reload help
#1

So I recently ask help so much for my event system and I still have 1 more problem to solve so what I need is when player join and event it save his skin color money and weapons and when he leave event with the cmd it load them back for him so he don't lose or any thing get changed can you tell me how to do this like lets say there is cmd:
CMD:event(playerid, params[])
{
here the code to save them
}
CMD:leaveevent(playerid, params[])
{
here the code to load them back fro hom
}
Ik I am asking a lot today but this the last problem I have in the event system so please help me.
Reply
#2

This section is for help on problems, not for giving you code, also what you are trying to achieve is not that hard and possible by using variables, getter methods and setter methods.

here is an example:

PHP код:
new skin[MAX_PLAYERS];
CMD:event(playeridparams[])
{
    
skin[playerid] = GetPlayerSkin(playerid);
}
CMD:leaveevent(playeridparams[])
{
    
SetPlayerSkin(playeridskin[playerid]);

If you need information on how to do that with weapons (little harder), ****** it / search the forum
Reply
#3

Oh my God, I typed everything on my phone but per accidentally deleted it, Ill help you later, be patient.
Reply
#4

ok I plz help as fast as you can
Reply
#5

Quote:
Originally Posted by silverms
Посмотреть сообщение
ok I plz help as fast as you can
the information i gave u is enough
Reply
#6

Quote:
Originally Posted by [Bios]Marcel
Посмотреть сообщение
the information i gave u is enough
I tested urs and didn't work the player didn't get back his skin.
Reply
#7

if u are using Dini Data base u can just write a new line and store the player skin id in it (Example: "pskin=0") and when he left the event just get it back, set the skin and remove the line.
Reply
#8

Quote:
Originally Posted by mongi
Посмотреть сообщение
if u are using Dini Data base u can just write a new line and store the player skin id in it (Example: "pskin=0") and when he left the event just get it back, set the skin and remove the line.
thanks for the idea ur brilliant !
Reply
#9

Quote:
Originally Posted by silverms
Посмотреть сообщение
thanks for the idea ur brilliant !
Terrible idea, but ok ...
Reply
#10

The code marcel provided, should be enough, as it is exactly the same with skins.
Anyway, here you go:

Somewhere outside a function
PHP код:
new eMoney[MAX_PLAYERS], eSkin[MAX_PLAYERS], eColor[MAX_PLAYERS]; 
In the /event cmd:
PHP код:
eMoney[playerid] = GetPlayerMoney(playerid);
eSkin[playerid] = GetPlayerSkin(playerid);
eColor[playerid] = GetPlayerColor(playerid); 
in your leaveevent:
PHP код:
GivePlayerMoney(playerideMoney[playerid]);
SetPlayerSkin(playerideSkin[playerid]);
SetPlayerColor(playerideColor[playerid]); 
For the weapons, it requires a little more code, but this should work.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)