30.01.2015, 10:04
(
Последний раз редактировалось sharkawsski; 30.01.2015 в 14:52.
)
hello guys
the problem is when someone register all save but when the player spawn will die it's like it's load 0 in health
please help
here is my code
OnUserCreate
OnPlayerSpawn
LoadPlayer
sorry for my bad english
the problem is when someone register all save but when the player spawn will die it's like it's load 0 in health
please help
here is my code
OnUserCreate
pawn Код:
public OnUserCreate(playerid)
{
pInfo[playerid][ID] = cache_insert_id(); //loads the ID of the player in the variable once they registered.
GivePlayerMoney(playerid, 20000);
pInfo[playerid][Bank] = 20000;
SetPlayerPos(playerid, 1685.7247, -2241.0313, 13.5469);
SetPlayerHealth(playerid, 100);
SavePlayer(playerid);
SendClientMessage(playerid, COLOR_YELLOW, "You Have Successfully Registred In The Server Welcome!");
return 1;
}
pawn Код:
public OnPlayerSpawn(playerid)
{
LoadPlayer(playerid);
}
pawn Код:
LoadPlayer(playerid)
{
SetPlayerPos(playerid, pInfo[playerid][posX], pInfo[playerid][posY], pInfo[playerid][posZ]);
SetPlayerSkin(playerid, pInfo[playerid][SkinID]);//Let's set their money
GivePlayerWeapon(playerid, pInfo[playerid][WeaponSlot1], pInfo[playerid][WepSlotAmmo1]);
GivePlayerWeapon(playerid, pInfo[playerid][WeaponSlot2], pInfo[playerid][WepSlotAmmo2]);
GivePlayerWeapon(playerid, pInfo[playerid][WeaponSlot3], pInfo[playerid][WepSlotAmmo3]);
GivePlayerWeapon(playerid, pInfo[playerid][WeaponSlot4], pInfo[playerid][WepSlotAmmo4]);
GivePlayerWeapon(playerid, pInfo[playerid][WeaponSlot5], pInfo[playerid][WepSlotAmmo5]);
SetPlayerHealth(playerid, pInfo[playerid][Health]);
SetPlayerArmour(playerid, pInfo[playerid][Armour]);
}
pawn Код:
SavePlayer(playerid)
{
new query[3000], Float:pos[3], gslot[5], aslot[5], Float: health, Float: armour;
GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
GetPlayerWeaponData(playerid, 2, gslot[0], aslot[0]);
GetPlayerWeaponData(playerid, 3, gslot[1], aslot[1]);
GetPlayerWeaponData(playerid, 4, gslot[2], aslot[2]);
GetPlayerWeaponData(playerid, 5, gslot[3], aslot[3]);
GetPlayerWeaponData(playerid, 6, gslot[4], aslot[4]);
GetPlayerHealth(playerid, health);
GetPlayerArmour(playerid, armour);
mysql_format(mysql, query, sizeof(query),
"UPDATE `players` SET \
`Admin`=%d, \
`VIP`=%d, \
`Money`=%d, \
`Materials`=%d, \
`Helper`=%d, \
`PlayHours`=%d, \
`PlayMinutes`=%d, \
`Paycheck`=%d, \
`Bank`=%d, \
`Job`=%d, \
`Packages`=%d, \
`SkinID`=%d, \
`PhoneNumber`=%d, \
`Health`=%f, \
`Armour`=%f, \
`WeaponSlot1`=%d, \
`WepSlotAmmo1`=%d, \
`WeaponSlot2`=%d, \
`WepSlotAmmo2`=%d, \
`WeaponSlot3`=%d, \
`WepSlotAmmo3`=%d, \
`WeaponSlot4`=%d, \
`WepSlotAmmo4`=%d, \
`WeaponSlot5`=%d, \
`WepSlotAmmo5`=%d, \
`posX`=%f, \
`posY`=%f, \
`posZ`=%f \
WHERE `ID`=%d",
pInfo[playerid][Admin],
pInfo[playerid][VIP],
GetPlayerMoney(playerid),
pInfo[playerid][Materials],
pInfo[playerid][Helper],
pInfo[playerid][PlayHours],
pInfo[playerid][PlayMinutes],
pInfo[playerid][Paycheck],
pInfo[playerid][Bank],
pInfo[playerid][Job],
pInfo[playerid][Packages],
GetPlayerSkin(playerid),
pInfo[playerid][PhoneNumber],
health,
armour,
gslot[0],
aslot[0],
gslot[1],
aslot[1],
gslot[2],
aslot[2],
gslot[3],
aslot[3],
gslot[4],
aslot[4],
pos[0],
pos[1],
pos[2],
pInfo[playerid][ID]);
mysql_tquery(mysql, query, "", "");
}