[HELP] Spawn armours, hp and guns.
#1

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.
Reply
#2

anyhelp
Reply
#3

i solved the health but it won't save your armours or neither guns
Reply
#4

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 ) );
Reply
#5

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 );
}
Reply
#6

It's because you don't have Y_Ini downloaded. Download it.
Also, it should be
pawn Код:
public user(playerid, string[])
Reply
#7

okay thanks!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)