Save/reload help -
silverms - 08.01.2017
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.
Re: Save/reload help -
BiosMarcel - 08.01.2017
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(playerid, params[])
{
skin[playerid] = GetPlayerSkin(playerid);
}
CMD:leaveevent(playerid, params[])
{
SetPlayerSkin(playerid, skin[playerid]);
}
If you need information on how to do that with weapons (little harder), ****** it / search the forum
Re: Save/reload help -
saffierr - 08.01.2017
Oh my God, I typed everything on my phone but per accidentally deleted it, Ill help you later, be patient.
Re: Save/reload help -
silverms - 08.01.2017
ok I plz help as fast as you can
Re: Save/reload help -
BiosMarcel - 08.01.2017
Quote:
Originally Posted by silverms
ok I plz help as fast as you can
|
the information i gave u is enough
Re: Save/reload help -
silverms - 08.01.2017
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.
Re: Save/reload help -
mongi - 08.01.2017
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.
Re: Save/reload help -
silverms - 08.01.2017
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

!
Re: Save/reload help -
BiosMarcel - 08.01.2017
Quote:
Originally Posted by silverms
thanks for the idea ur brilliant  !
|
Terrible idea, but ok ...
Re: Save/reload help -
saffierr - 08.01.2017
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(playerid, eMoney[playerid]);
SetPlayerSkin(playerid, eSkin[playerid]);
SetPlayerColor(playerid, eColor[playerid]);
For the weapons, it requires a little more code, but this should work.