SA-MP Forums Archive
Save Player Health - 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: Save Player Health (/showthread.php?tid=192371)



Save Player Health - ExeC - 22.11.2010

Hello, i have a AFK system in my server, and it's a dm server. So, what i would like to do is, save the player's health when he types /afk, because when player type /back, he will get full health.

So the problem is, if a player has low health, he can just do /afk, and /back, he will get full health.

So, when player types /back, he should have the health he had before he typed /afk.

You got the point? Well, if this is possible, please tell me how to do it. Thank you.


Re: Save Player Health - Mystique - 22.11.2010

If the player won't disconnect it's only to save the health into a variable. Nothing harder than that.

This one for example. https://sampwiki.blast.hk/wiki/SetPVarInt


Re: Save Player Health - Kastranova - 22.11.2010

Is this what you mean

Код:
new Float:SaveHealth[MAX_PLAYERS]; // This must be on the top, this is you global variable

// in the /afk cmd this have to be added
GetPlayerHealth(playerid, SaveHealth[playerid]); // This will store the health of the player

// in the /back cmd
SetPlayerHealth(playerid, SaveHealth[playerid]); // this will restore the health
I hope this helped you with your question

Greetings,
kastranova


Re: Save Player Health - Mystique - 22.11.2010

Exactly what he said. ^


Re: Save Player Health - ColdXX - 22.11.2010

Why dont u put the player into a different VIrtualWorld? and when he types /back he returns to the "real world"?
And remove the SetPlayerHealth from ur code


Re: Save Player Health - Kastranova - 22.11.2010

That is also Possible ofcourse


Re: Save Player Health - ExeC - 22.11.2010

Quote:
Originally Posted by ColdXX
Посмотреть сообщение
Why dont u put the player into a different VIrtualWorld? and when he types /back he returns to the "real world"?
And remove the SetPlayerHealth from ur code
Yea, i could do that, but when player types /afk, it will create a 3D text label, and i want to stick with that. And it also gives the player god mode, and that's good.

@Kastranova, thank you, it worked.

And thank you all.