[HELP] Spawn armours, hp and guns. - 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: [HELP] Spawn armours, hp and guns. (
/showthread.php?tid=231978)
[HELP] Spawn armours, hp and guns. -
Banana123 - 26.02.2011
So I am using LA-RP script and I was wondering that how can I setup the spawn health, armour and guns back to as it was before logging out. If you are carrying M4, Pistol, Baseball Pat and difference guns, and when you log out it won't save the weapons. Also the spawn HP is 50% and if you had armours it won't save them neither. Thanks.
Re: [HELP] Spawn armours, hp and guns. -
Banana123 - 28.02.2011
anyhelp
Re: [HELP] Spawn armours, hp and guns. -
Banana123 - 04.03.2011
i solved the health but it won't save your armours or neither guns
Re: [HELP] Spawn armours, hp and guns. -
Mean - 04.03.2011
pawn Код:
// Example with Y_Ini
new file[ 256 ];
new playername[ 24 ];
GetPlayerName( playerid, playername, 24 );
format( file, sizeof file, "SomeFolder/%s.txt", playername );
new INI:PlayerAcc = INI_Open( file );
new Float:health, Float:armour;
GetPlayerArmour( playerid, armour );
GetPlayerHealth( playerid, health );
INI_WriteFloat( PlayerAcc, "Armour", armour );
INI_WriteFloat( PlayerAcc, "Health", health );
INI_WriteInt( PlayerAcc, "LastHoldingWeapon", GetPlayerWeapon( playerid ) );
INI_Close( PlayerAcc );
Just example, I supose you know howto do it with DINI if you use it.
EDIT: Dini if you really use it:
pawn Код:
new file[ 256 ];
new playername[ 24 ];
GetPlayerName( playerid, playername, 24 );
format( file, sizeof file, "SomeFolder/%s.txt", playername );
new Float:health, Float:armour;
GetPlayerArmour( playerid, armour );
GetPlayerHealth( playerid, health );
dini_FloatSet( file, "Armour", armour );
dini_FloatSet( file, "Health", health );
dini_IntSet( file, "LastHoldingWeapon", GetPlayerWeapon( playerid ) );
Re: [HELP] Spawn armours, hp and guns. -
Banana123 - 05.03.2011
okay thanks!
pawn Код:
C:\Users\Robert\Desktop\Project Los Santos\gamemodes\larp.pwn(4101) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\Project Los Santos\gamemodes\larp.pwn(4137) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\Project Los Santos\gamemodes\larp.pwn(4842) : warning 235: public function lacks forward declaration (symbol "user")
C:\Users\Robert\Desktop\Project Los Santos\gamemodes\larp.pwn(4847) : error 017: undefined symbol "playerid"
C:\Users\Robert\Desktop\Project Los Santos\gamemodes\larp.pwn(4849) : error 017: undefined symbol "INI_Open"
C:\Users\Robert\Desktop\Project Los Santos\gamemodes\larp.pwn(4849) : warning 213: tag mismatch
C:\Users\Robert\Desktop\Project Los Santos\gamemodes\larp.pwn(4851) : error 017: undefined symbol "playerid"
C:\Users\Robert\Desktop\Project Los Santos\gamemodes\larp.pwn(4852) : error 017: undefined symbol "playerid"
C:\Users\Robert\Desktop\Project Los Santos\gamemodes\larp.pwn(4853) : error 017: undefined symbol "INI_WriteFloat"
C:\Users\Robert\Desktop\Project Los Santos\gamemodes\larp.pwn(4854) : error 017: undefined symbol "INI_WriteFloat"
C:\Users\Robert\Desktop\Project Los Santos\gamemodes\larp.pwn(4855) : error 017: undefined symbol "INI_WriteInt"
C:\Users\Robert\Desktop\Project Los Santos\gamemodes\larp.pwn(4856) : error 017: undefined symbol "INI_Close"
C:\Users\Robert\Desktop\Project Los Santos\gamemodes\larp.pwn(4849) : warning 204: symbol is assigned a value that is never used: "PlayerAcc"
C:\Users\Robert\Desktop\Project Los Santos\gamemodes\larp.pwn(10823) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\Project Los Santos\gamemodes\larp.pwn(10824) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\Project Los Santos\gamemodes\larp.pwn(10825) : warning 202: number of arguments does not match definition
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
pawn Код:
public user(string[])
{
// Example with Y_Ini
new file[ 256 ];
new playername[ 24 ];
GetPlayerName( playerid, playername, 24 );
format( file, sizeof file, "SomeFolder/%s.txt", playername );
new INI:PlayerAcc = INI_Open( file );
new Float:health, Float:armour;
GetPlayerArmour( playerid, armour );
GetPlayerHealth( playerid, health );
INI_WriteFloat( PlayerAcc, "Armour", armour );
INI_WriteFloat( PlayerAcc, "Health", health );
INI_WriteInt( PlayerAcc, "LastHoldingWeapon", GetPlayerWeapon( playerid ) );
INI_Close( PlayerAcc );
}
Re: [HELP] Spawn armours, hp and guns. -
Mean - 05.03.2011
It's because you don't have Y_Ini downloaded. Download it.
Also, it should be
pawn Код:
public user(playerid, string[])
Re: [HELP] Spawn armours, hp and guns. -
Banana123 - 05.03.2011
okay thanks!