Saving Player Health/Spawning With Health -
Despare - 21.11.2009
Well, I'm still new to this but I've tried many things for Saving a Player's Health and Armour.as in each time people log off and log back in or saved within the script during the game. I don't really know what code I should post for you guys to help me with it. But, If you could help me, I would really appreciate it.
Re: Saving Player Health/Spawning With Health -
[LCG]TANKER - 21.11.2009
plz define what you mean by "saving" as in each time peaple log off and log back in or saved within the script during the game?
Re: Saving Player Health/Spawning With Health -
Despare - 21.11.2009
Quote:
|
Originally Posted by [LCG
TANKER ]
plz define what you mean by "saving" as in each time peaple log off and log back in or saved within the script during the game?
|
Yes.
Re: Saving Player Health/Spawning With Health -
Despare - 21.11.2009
Bump, Need help please.
Re: Saving Player Health/Spawning With Health -
pierhs - 21.11.2009
what gamemode u use?
Re: Saving Player Health/Spawning With Health -
thiaZ_ - 21.11.2009
pawn Код:
//For saving:
new Float:health,Float:x,Float:y,Float:z,Float:a
GetPlayerPos(playerid,x,y,z);
GetPlayerFacingAngle(playerid,a);
GetPlayerHealth(playerid,health);
//For loading:
SetPlayerPos(playerid,x,y,z);
SetPlayerFacingAngle(playerid,a);
SetPlayerHealth(playerid,health);
i didn't compile it so you have to test if it works
i dont know your variables or if you want to save it permanently, then you have to use dini or dudb
Re: Saving Player Health/Spawning With Health -
Despare - 21.11.2009
Quote:
|
Originally Posted by thiaZ_
pawn Код:
//For saving: new Float:health,Float:x,Float:y,Float:z,Float:a GetPlayerPos(playerid,x,y,z); GetPlayerFacingAngle(playerid,a); GetPlayerHealth(playerid,health); //For loading: SetPlayerPos(playerid,x,y,z); SetPlayerFacingAngle(playerid,a); SetPlayerHealth(playerid,health);
i dont know your variables or if you want to save it permanently, then you have to use dini or dudb
|
What do you mean permanently?
Quote:
|
Originally Posted by pierhs
what gamemode u use?
|
Los Angeles Roleplay
Re: Saving Player Health/Spawning With Health -
Sergei - 21.11.2009
You need to save values in database in order to save them permanently.
Re: Saving Player Health/Spawning With Health -
Despare - 21.11.2009
Quote:
|
Originally Posted by $ЂЯĢ
You need to save values in database in order to save them permanently.
|
Well, How do you do that? Sorry, I'm still kinda new to this stuff
Re: Saving Player Health/Spawning With Health -
Luka P. - 21.11.2009
You can use dini include.
Combine it with /register, /login
And then you will be able to
pawn Код:
dini_IntSet(userfile,"Health",floatround(GetPlayerHealth(playerid));
pawn Код:
SetPlayerHealth(playerid,dini_Int(userfile,"Health"));
Re: Saving Player Health/Spawning With Health -
Despare - 21.11.2009
Quote:
|
Originally Posted by Luka™
You can use dini include.
Combine it with /register, /login
And then you will be able to
pawn Код:
dini_IntSet(userfile,"Health",floatround(GetPlayerHealth(playerid));
pawn Код:
SetPlayerHealth(playerid,dini_Int(userfile,"Health"));
|
Thanks, but the weird thing is my /login and /register, aren't dini
Re: Saving Player Health/Spawning With Health -
Luka P. - 21.11.2009
Ok, in what extension your user account saves?
Re: Saving Player Health/Spawning With Health -
Despare - 21.11.2009
Oops, double post
Re: Saving Player Health/Spawning With Health -
Despare - 21.11.2009
Quote:
|
Originally Posted by Luka™
Ok, in what extension your user account saves?
|
Well
Quote:
format(string, sizeof(string), "users/%s.ini", sendername);
|
Re: Saving Player Health/Spawning With Health -
Luka P. - 21.11.2009
Okay, ini file.. So in /register command just put
pawn Код:
new pName[MAX_PLAYER_NAME],string[128];
GetPlayerName(playerid,pName,sizeof(pName));
format(string,sizeof(string),"users/%s.ini",pName);
dini_IntSet(string,"Health",0);
And then use my previous posted code.
Re: Saving Player Health/Spawning With Health -
Abernethy - 21.11.2009
Quote:
|
Originally Posted by Luka™
Okay, ini file.. So in /register command just put
pawn Код:
new pName[MAX_PLAYER_NAME],string[128]; GetPlayerName(playerid,pName,sizeof(pName)); format(string,sizeof(string),"users/%s.ini",pName);
dini_IntSet(string,"Health",0);
And then use my previous posted code.
|
replace string with userfile.
Re: Saving Player Health/Spawning With Health -
Despare - 21.11.2009
Quote:
|
Originally Posted by Luka™
Okay, ini file.. So in /register command just put
pawn Код:
new pName[MAX_PLAYER_NAME],string[128]; GetPlayerName(playerid,pName,sizeof(pName)); format(string,sizeof(string),"users/%s.ini",pName);
dini_IntSet(string,"Health",0);
And then use my previous posted code.
|
Alright, thanks :P, Sorry to for a nubby question but where do I put your previous code under? and where do i put dini_Intset(string,"Health,0); under?
Re: Saving Player Health/Spawning With Health -
Luka P. - 21.11.2009
hmm... i suggest you deleting whole register/login system if you know what you're doing then i'll give you complete
register/login system + saving health
Re: Saving Player Health/Spawning With Health -
Despare - 21.11.2009
Quote:
|
Originally Posted by Luka™
hmm... i suggest you deleting whole register/login system if you know what you're doing then i'll give you complete
register/login system + saving health
|
Alright, I deleted it, Yes I know how to :P Also, does it save Armour also?
Re: Saving Player Health/Spawning With Health -
Despare - 23.11.2009
Quote:
|
Originally Posted by Luka™
hmm... i suggest you deleting whole register/login system if you know what you're doing then i'll give you complete
register/login system + saving health
|
So are you going to give it to me?