05.06.2012, 14:37
I made it so you can store and take weapons from your boot but im having a problem when i put guns in my boot and restart the server or something my guns disappear from my boot and it says shit slot is not occupied please help me i have made it save look
This is in my enum
And this is my SavePlayerData
Why do they reset when i restart the server or something
Please Help Me
Help Is Appreciated
This is in my enum
pawn Код:
CarWeapon1,
CarWeapon2,
CarWeapon3,
pawn Код:
command(carstoreweapon, playerid, params[])
{
new slot, WeaponName[128];
if(sscanf(params, "dz", slot, WeaponName))
{
SendClientMessage(playerid, WHITE, "SYNTAX: /carstoreweapon [slot (1-3)] [weapon]");
SendClientMessage(playerid, WHITE, "Weapons: Katana, Cane, PoolCue, BaseballBat, Shovel, Colt45, SilencedPistol, ShotGun");
SendClientMessage(playerid, WHITE, "Weapons: DesertEagle, MP5, Uzi, AK47, M4, SniperRifle, CombatShotgun");
}
else
{
if(IsPlayerNearBoot(playerid, Player[playerid][CarLinkID]))
{
if(slot >= 1 && slot < 4)
{
if(strcmp(WeaponName, "Katana", true) == 0)
{
if(Player[playerid][WepSlot1] == 8)
{
switch(slot)
{
case 1:
{
Player[playerid][CarWeapon1] = 8;
Player[playerid][WepSlot1] = 0;
ResetPlayerWeapons(playerid);
GivePlayerSavedWeapons(playerid);
SendClientMessage(playerid, WHITE, "You have stored a Katana in your car boot (in slot 1).");
SavePlayerData(playerid);
}
}
}
}
}
}
}
pawn Код:
command(cartakeweapon, playerid, params[])
{
new string[128], slot, name[128];
if(sscanf(params, "d", slot))
{
SendClientMessage(playerid, WHITE, "SYNTAX: /cartakeweapon [slot (1-3)]");
}
else
{
if(IsPlayerNearBoot(playerid, Player[playerid][CarLinkID]))
{
switch(slot)
{
case 1:
{
if(Player[playerid][CarWeapon1] >= 1)
{
GivePlayerWeaponEx(playerid, Player[playerid][CarWeapon1]);
GetWeaponName(Player[playerid][CarWeapon1], name, sizeof(name));
format(string, sizeof(string), "You have withdrawn your %s from Slot 1.", name);
SendClientMessage(playerid, WHITE, string);
Player[playerid][CarWeapon1] = 0;
SavePlayerData(playerid);
}
else
{
SendClientMessage(playerid, WHITE, "This slot is unoccupied.");
}
}
}
}
}
}
pawn Код:
public SavePlayerData(playerid)
{
dini_IntSet(string, "CarWeapon1", Player[playerid][CarWeapon1]);
dini_IntSet(string, "CarWeapon2", Player[playerid][CarWeapon2]);
dini_IntSet(string, "CarWeapon3", Player[playerid][CarWeapon3]);
}
Please Help Me
Help Is Appreciated