[help]Doesnt write the weapons? -
Niixie - 27.05.2010
Hey samp forum.
Its the GetPlayerWeaponData thats doesnt work as i think it does.
Heres the FS
http://paste.pastebin.com/tDvSQH7V
And now, why doesnt it write the weapon id or name (whatever). and why doesnt it write the ammo?
Is there an easier way?
//Niixie
Re: [help]Doesnt write the weapons? -
Visualbr - 27.05.2010
I have the same problem, could anyone help?
Re: [help]Doesnt write the weapons? -
Hiddos - 27.05.2010
I've never quite understand how it works either, but it still ain't a bad idea to check the WIKI:
https://sampwiki.blast.hk/wiki/GetPlayerWeaponData
Another thing I noticed: Weapon slots start at 0, so don't use i+1.
I'd suggest using the printf function to check weapons and things.
Re: [help]Doesnt write the weapons? -
Niixie - 27.05.2010
Well, i looked in other scripts for getting this. And the last script it looked in was Seifs admin script. and it was written like this. just in a command, so now i want it into a dini file.
Re: [help]Doesnt write the weapons? -
Hiddos - 27.05.2010
Use printf(), and if it prints correctly check if it's saved in the file.
Re: [help]Doesnt write the weapons? -
Niixie - 27.05.2010
its not saved in the dini file.
I did that with /pweapons and it showed correctly
Re: [help]Doesnt write the weapons? -
Visualbr - 27.05.2010
Anyone else could help?
Re: [help]Doesnt write the weapons? -
Jefff - 27.05.2010
U must give
Код:
new playername[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername, MAX_PLAYER_NAME);
format(file, sizeof(file), file_path, playername);
in PlayerCrashed(playerid) and Left
Re: [help]Doesnt write the weapons? -
Niixie - 28.05.2010
No need, its global. so doing it once should be enough, but ill add that.
Re: [help]Doesnt write the weapons? -
(SF)Noobanatior - 28.05.2010
i think you are just writing over your weapons with slots you have nothing in most of the names are off at the end
try
Код:
#
PlayerCrashed(playerid) // This function saves the players weapons into a variable. Saves the players stats into the file.
{
new Float:x, Float:y, Float:z, Float:a, Float:HP, Float:AP;
new weapons[12], bullets[12];
GetPlayerPos(playerid,x,y,z);
GetPlayerHealth(playerid, HP);
GetPlayerArmour(playerid, AP);
// format(HP, sizeof(HP), "%0.1", HP);
// format(AP, sizeof(AP), "%0.1", AP);
for(new i = 0; i < 12; i++)
{
GetPlayerWeaponData(playerid, i+1, weapons[i], bullets[i]);
}
if(!dini_Exists(file))
{
dini_Create(file);
dini_FloatSet(file, "PosX", x);
dini_FloatSet(file, "PosY", y);
dini_FloatSet(file, "PosZ", z);
dini_FloatSet(file, "PosA", a);
dini_FloatSet(file, "HP", HP);
dini_FloatSet(file, "AP", AP);
dini_IntSet(file, "Interior", GetPlayerInterior(playerid));
dini_IntSet(file, "World", GetPlayerVirtualWorld(playerid));
dini_IntSet(file, "Score", GetPlayerScore(playerid));
// dini_IntSet(file, "Color", GetPlayerColor(playerid));
dini_IntSet(file, "Skin", GetPlayerSkin(playerid));
dini_IntSet(file, "Weapon1", weapons[0]);
dini_IntSet(file, "Weapon1ammo", bullets[0]);
dini_IntSet(file, "Weapon2", weapons[1]);
dini_IntSet(file, "Weapon2ammo", bullets[1]);
dini_IntSet(file, "Weapon3", weapons[2]);
dini_IntSet(file, "Weapon3ammo", bullets[2]);
dini_IntSet(file, "Weapon4", weapons[3]);
dini_IntSet(file, "Weapon4ammo", bullets[3]);
dini_IntSet(file, "Weapon5", weapons[4]);
dini_IntSet(file, "Weapon5ammo", bullets[4]);
dini_IntSet(file, "Weapon6", weapons[5]);
dini_IntSet(file, "Weapon6ammo", bullets[5]);
dini_IntSet(file, "Weapon7", weapons[6]);
dini_IntSet(file, "Weapon7ammo", bullets[6]);
dini_IntSet(file, "Weapon8", weapons[7]);
dini_IntSet(file, "Weapon8ammo", bullets[7]);
dini_IntSet(file, "Weapon9", weapons[8]);
dini_IntSet(file, "Weapon9ammo", bullets[8]);
dini_IntSet(file, "Weapon10", weapons[9]);
dini_IntSet(file, "Weapon10ammo", bullets[9]);
dini_IntSet(file, "Weapon11", weapons[10]);
dini_IntSet(file, "Weapon11ammo", bullets[10]);
dini_IntSet(file, "Weapon12", weapons[11]);
dini_IntSet(file, "Weapon12ammo", bullets[11]);
}
return 1;
}
that make any diffrence?