Okay the GM I am using have an Arms Dealer job and infinite bullets, I deleted that system and added my weapon system with bullets, it is working fine, now the problem is with the gun lockers of the house (RP GM), it wouldnt let me store guns that were created from the new system, I managed to fix that issue and the weapon stores, but the problem is that when I withdraw the weapon from the gunlocker, I get it with inifinite bullets.
Code:
public DisplayGuns(playerid)
{
if(IsPlayerConnected(playerid))
{
new string[128];
new WeaponName[65];
if(PlayerInfo[playerid][pGun0] != 0) { GetWeaponName(PlayerInfo[playerid][pGun0], WeaponName, 64); format(string, sizeof(string), "%s", WeaponName); SendClientMessage(playerid, COLOR_BITEM, string); }
if(PlayerInfo[playerid][pGun1] != 0) { GetWeaponName(PlayerInfo[playerid][pGun1], WeaponName, 64); format(string, sizeof(string), "%s", WeaponName); SendClientMessage(playerid, COLOR_BITEM, string); }
if(PlayerInfo[playerid][pGun2] != 0) { GetWeaponName(PlayerInfo[playerid][pGun2], WeaponName, 64); format(string, sizeof(string), "%s", WeaponName); SendClientMessage(playerid, COLOR_BITEM, string); }
if(PlayerInfo[playerid][pGun3] != 0) { GetWeaponName(PlayerInfo[playerid][pGun3], WeaponName, 64); format(string, sizeof(string), "%s", WeaponName); SendClientMessage(playerid, COLOR_BITEM, string); }
if(PlayerInfo[playerid][pGun4] != 0) { GetWeaponName(PlayerInfo[playerid][pGun4], WeaponName, 64); format(string, sizeof(string), "%s", WeaponName); SendClientMessage(playerid, COLOR_BITEM, string); }
if(PlayerInfo[playerid][pGun5] != 0) { GetWeaponName(PlayerInfo[playerid][pGun5], WeaponName, 64); format(string, sizeof(string), "%s", WeaponName); SendClientMessage(playerid, COLOR_BITEM, string); }
if(PlayerInfo[playerid][pGun6] != 0) { GetWeaponName(PlayerInfo[playerid][pGun6], WeaponName, 64); format(string, sizeof(string), "%s", WeaponName); SendClientMessage(playerid, COLOR_BITEM, string); }
if(PlayerInfo[playerid][pGun7] != 0) { GetWeaponName(PlayerInfo[playerid][pGun7], WeaponName, 64); format(string, sizeof(string), "%s", WeaponName); SendClientMessage(playerid, COLOR_BITEM, string); }
if(PlayerInfo[playerid][pGun8] != 0) { GetWeaponName(PlayerInfo[playerid][pGun8], WeaponName, 64); format(string, sizeof(string), "%s", WeaponName); SendClientMessage(playerid, COLOR_BITEM, string); }
if(PlayerInfo[playerid][pGun9] != 0) { GetWeaponName(PlayerInfo[playerid][pGun9], WeaponName, 64); format(string, sizeof(string), "%s", WeaponName); SendClientMessage(playerid, COLOR_BITEM, string); }
if(PlayerInfo[playerid][pGun10] != 0) { GetWeaponName(PlayerInfo[playerid][pGun10], WeaponName, 64); format(string, sizeof(string), "%s", WeaponName); SendClientMessage(playerid, COLOR_BITEM, string); }
if(PlayerInfo[playerid][pGun11] != 0) { GetWeaponName(PlayerInfo[playerid][pGun11], WeaponName, 64); format(string, sizeof(string), "%s", WeaponName); SendClientMessage(playerid, COLOR_BITEM, string); }
if(PlayerInfo[playerid][pGun12] != 0) { GetWeaponName(PlayerInfo[playerid][pGun12], WeaponName, 64); format(string, sizeof(string), "%s", WeaponName); SendClientMessage(playerid, COLOR_BITEM, string); }
}
return 0;
}
public DisplaySafeGuns(playerid)
{
if(IsPlayerConnected(playerid))
{
new string[128];
new WeaponName[65];
if(PlayerInfo[playerid][hGun1] != 0) { GetWeaponName(PlayerInfo[playerid][hGun1], WeaponName, 64); format(string, sizeof(string), "Slot 1: %s", WeaponName); SendClientMessage(playerid, COLOR_BITEM, string); }
if(PlayerInfo[playerid][hGun2] != 0) { GetWeaponName(PlayerInfo[playerid][hGun2], WeaponName, 64); format(string, sizeof(string), "Slot 2: %s", WeaponName); SendClientMessage(playerid, COLOR_BITEM, string); }
if(PlayerInfo[playerid][hGun3] != 0) { GetWeaponName(PlayerInfo[playerid][hGun3], WeaponName, 64); format(string, sizeof(string), "Slot 3: %s", WeaponName); SendClientMessage(playerid, COLOR_BITEM, string); }
if(PlayerInfo[playerid][hGun4] != 0) { GetWeaponName(PlayerInfo[playerid][hGun4], WeaponName, 64); format(string, sizeof(string), "Slot 4:%s", WeaponName); SendClientMessage(playerid, COLOR_BITEM, string); }
if(PlayerInfo[playerid][hGun5] != 0) { GetWeaponName(PlayerInfo[playerid][hGun5], WeaponName, 64); format(string, sizeof(string), "Slot 5: %s", WeaponName); SendClientMessage(playerid, COLOR_BITEM, string); }
}
return 0;
}
Code:
if(strcmp(cmd, "/storegun", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pHouseAccepted] != 0)
{
if(PlayerInfo[playerid][pLocal] != playerid)
{
SendClientMessage(playerid, COLOR_GREY, " You are to far from your house !");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
GetPlayerName(playerid, sendername, sizeof(sendername));
SendClientMessage(playerid, COLOR_GREEN, "________________________________________________");
format(string, sizeof(string), "*** %s's Weapons ***", sendername);
SendClientMessage(playerid, COLOR_WHITE, string);
DisplayGuns(playerid);
SendClientMessage(playerid, COLOR_GREEN, "________________________________________________");
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /storegun [weapon] [slot]");
return 1;
}
if(strcmp(tmp,"sdpistol",true) == 0 || strcmp(tmp,"silencedpistol",true) == 0)
{
if(PlayerInfo[playerid][pGun2] != 23) { SendClientMessage(playerid, COLOR_GREY, " You don't have that weapon !"); return 1; }
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_WHITE, "USAGE: /storegun [weapon] [slot]"); return 1; }
new slot = strvalEx(tmp);
if(slot < 1 || slot > 5) { SendClientMessage(playerid, COLOR_GREY, " Slot can't be below 1 or above 5 !"); return 1; }
if(slot > PlayerInfo[playerid][hGL]) { SendClientMessage(playerid, COLOR_GREY, " You haven't unlocked that Slot !"); return 1; }
if(slot == 1) { if(PlayerInfo[playerid][hGun1] == 0) { PlayerInfo[playerid][hGun1] = 23; } else { SendClientMessage(playerid, COLOR_GREY, " That Slot is already taken !"); return 1; } }
if(slot == 2) { if(PlayerInfo[playerid][hGun2] == 0) { PlayerInfo[playerid][hGun2] = 23; } else { SendClientMessage(playerid, COLOR_GREY, " That Slot is already taken !"); return 1; } }
if(slot == 3) { if(PlayerInfo[playerid][hGun3] == 0) { PlayerInfo[playerid][hGun3] = 23; } else { SendClientMessage(playerid, COLOR_GREY, " That Slot is already taken !"); return 1; } }
if(slot == 4) { if(PlayerInfo[playerid][hGun4] == 0) { PlayerInfo[playerid][hGun4] = 23; } else { SendClientMessage(playerid, COLOR_GREY, " That Slot is already taken !"); return 1; } }
if(slot == 5) { if(PlayerInfo[playerid][hGun5] == 0) { PlayerInfo[playerid][hGun5] = 23; } else { SendClientMessage(playerid, COLOR_GREY, " That Slot is already taken !"); return 1; } }
new WeaponName[65];
GetWeaponName(23, WeaponName, 64);
GetPlayerName(playerid, sendername, sizeof(sendername));
PlayerInfo[playerid][pGun2] = 0;
format(string, sizeof(string), "* You have placed your %s into your safe.", WeaponName);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "* %s has placed their %s into their safe.", sendername, WeaponName);
ProxDetector(20.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
SetPlayerWeapons(playerid);
return 1;
}
if(strcmp(tmp,"shotgun",true) == 0)
{
if(PlayerInfo[playerid][pGun3] != 25) { SendClientMessage(playerid, COLOR_GREY, " You don't have that weapon !"); return 1; }
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_WHITE, "USAGE: /storegun [weapon] [slot]"); return 1; }
new slot = strvalEx(tmp);
if(slot < 1 || slot > 5) { SendClientMessage(playerid, COLOR_GREY, " Slot can't be below 1 or above 5 !"); return 1; }
if(slot > PlayerInfo[playerid][hGL]) { SendClientMessage(playerid, COLOR_GREY, " You haven't unlocked that Slot !"); return 1; }
if(slot == 1) { if(PlayerInfo[playerid][hGun1] == 0) { PlayerInfo[playerid][hGun1] = 25; } else { SendClientMessage(playerid, COLOR_GREY, " That Slot is already taken !"); return 1; } }
if(slot == 2) { if(PlayerInfo[playerid][hGun2] == 0) { PlayerInfo[playerid][hGun2] = 25; } else { SendClientMessage(playerid, COLOR_GREY, " That Slot is already taken !"); return 1; } }
if(slot == 3) { if(PlayerInfo[playerid][hGun3] == 0) { PlayerInfo[playerid][hGun3] = 25; } else { SendClientMessage(playerid, COLOR_GREY, " That Slot is already taken !"); return 1; } }
if(slot == 4) { if(PlayerInfo[playerid][hGun4] == 0) { PlayerInfo[playerid][hGun4] = 25; } else { SendClientMessage(playerid, COLOR_GREY, " That Slot is already taken !"); return 1; } }
if(slot == 5) { if(PlayerInfo[playerid][hGun5] == 0) { PlayerInfo[playerid][hGun5] = 25; } else { SendClientMessage(playerid, COLOR_GREY, " That Slot is already taken !"); return 1; } }
new WeaponName[65];
GetWeaponName(25, WeaponName, 64);
GetPlayerName(playerid, sendername, sizeof(sendername));
PlayerInfo[playerid][pGun3] = 0;
format(string, sizeof(string), "* You have placed your %s into your safe.", WeaponName);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "* %s has placed their %s into their safe.", sendername, WeaponName);
ProxDetector(20.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
SetPlayerWeapons(playerid);
return 1;
}
if(strcmp(tmp,"mp5",true) == 0)
{
if(PlayerInfo[playerid][pGun4] != 29) { SendClientMessage(playerid, COLOR_GREY, " You don't have that weapon !"); return 1; }
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_WHITE, "USAGE: /storegun [weapon] [slot]"); return 1; }
new slot = strvalEx(tmp);
if(slot < 1 || slot > 5) { SendClientMessage(playerid, COLOR_GREY, " Slot can't be below 1 or above 5 !"); return 1; }
if(slot > PlayerInfo[playerid][hGL]) { SendClientMessage(playerid, COLOR_GREY, " You haven't unlocked that Slot !"); return 1; }
if(slot == 1) { if(PlayerInfo[playerid][hGun1] == 0) { PlayerInfo[playerid][hGun1] = 29; } else { SendClientMessage(playerid, COLOR_GREY, " That Slot is already taken !"); return 1; } }
if(slot == 2) { if(PlayerInfo[playerid][hGun2] == 0) { PlayerInfo[playerid][hGun2] = 29; } else { SendClientMessage(playerid, COLOR_GREY, " That Slot is already taken !"); return 1; } }
if(slot == 3) { if(PlayerInfo[playerid][hGun3] == 0) { PlayerInfo[playerid][hGun3] = 29; } else { SendClientMessage(playerid, COLOR_GREY, " That Slot is already taken !"); return 1; } }
if(slot == 4) { if(PlayerInfo[playerid][hGun4] == 0) { PlayerInfo[playerid][hGun4] = 29; } else { SendClientMessage(playerid, COLOR_GREY, " That Slot is already taken !"); return 1; } }
if(slot == 5) { if(PlayerInfo[playerid][hGun5] == 0) { PlayerInfo[playerid][hGun5] = 29; } else { SendClientMessage(playerid, COLOR_GREY, " That Slot is already taken !"); return 1; } }
new WeaponName[65];
GetWeaponName(29, WeaponName, 64);
GetPlayerName(playerid, sendername, sizeof(sendername));
PlayerInfo[playerid][pGun4] = 0;
format(string, sizeof(string), "* You have placed your %s into your safe.", WeaponName);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "* %s has placed their %s into their safe.", sendername, WeaponName);
ProxDetector(20.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
SetPlayerWeapons(playerid);
return 1;
}
if(strcmp(tmp,"rifle",true) == 0)
{
if(PlayerInfo[playerid][pGun6] != 33) { SendClientMessage(playerid, COLOR_GREY, " You don't have that weapon !"); return 1; }
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_WHITE, "USAGE: /storegun [weapon] [slot]"); return 1; }
new slot = strvalEx(tmp);
if(slot < 1 || slot > 5) { SendClientMessage(playerid, COLOR_GREY, " Slot can't be below 1 or above 5 !"); return 1; }
if(slot > PlayerInfo[playerid][hGL]) { SendClientMessage(playerid, COLOR_GREY, " You haven't unlocked that Slot !"); return 1; }
if(slot == 1) { if(PlayerInfo[playerid][hGun1] == 0) { PlayerInfo[playerid][hGun1] = 33; } else { SendClientMessage(playerid, COLOR_GREY, " That Slot is already taken !"); return 1; } }
if(slot == 2) { if(PlayerInfo[playerid][hGun2] == 0) { PlayerInfo[playerid][hGun2] = 33; } else { SendClientMessage(playerid, COLOR_GREY, " That Slot is already taken !"); return 1; } }
if(slot == 3) { if(PlayerInfo[playerid][hGun3] == 0) { PlayerInfo[playerid][hGun3] = 33; } else { SendClientMessage(playerid, COLOR_GREY, " That Slot is already taken !"); return 1; } }
if(slot == 4) { if(PlayerInfo[playerid][hGun4] == 0) { PlayerInfo[playerid][hGun4] = 33; } else { SendClientMessage(playerid, COLOR_GREY, " That Slot is already taken !"); return 1; } }
if(slot == 5) { if(PlayerInfo[playerid][hGun5] == 0) { PlayerInfo[playerid][hGun5] = 33; } else { SendClientMessage(playerid, COLOR_GREY, " That Slot is already taken !"); return 1; } }
new WeaponName[65];
GetWeaponName(33, WeaponName, 64);
GetPlayerName(playerid, sendername, sizeof(sendername));
PlayerInfo[playerid][pGun6] = 0;
format(string, sizeof(string), "* You have placed your %s into your safe.", WeaponName);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "* %s has placed their %s into their safe.", sendername, WeaponName);
ProxDetector(20.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
SetPlayerWeapons(playerid);
return 1;
}
if(strcmp(tmp,"deagle",true) == 0)
{
if(PlayerInfo[playerid][pGun2] != 24) { SendClientMessage(playerid, COLOR_GREY, " You don't have that weapon !"); return 1; }
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_WHITE, "USAGE: /storegun [weapon] [slot]"); return 1; }
new slot = strvalEx(tmp);
if(slot < 1 || slot > 5) { SendClientMessage(playerid, COLOR_GREY, " Slot can't be below 1 or above 5 !"); return 1; }
if(slot > PlayerInfo[playerid][hGL]) { SendClientMessage(playerid, COLOR_GREY, " You haven't unlocked that Slot !"); return 1; }
if(slot == 1) { if(PlayerInfo[playerid][hGun1] == 0) { PlayerInfo[playerid][hGun1] = 24; } else { SendClientMessage(playerid, COLOR_GREY, " That Slot is already taken !"); return 1; } }
if(slot == 2) { if(PlayerInfo[playerid][hGun2] == 0) { PlayerInfo[playerid][hGun2] = 24; } else { SendClientMessage(playerid, COLOR_GREY, " That Slot is already taken !"); return 1; } }
if(slot == 3) { if(PlayerInfo[playerid][hGun3] == 0) { PlayerInfo[playerid][hGun3] = 24; } else { SendClientMessage(playerid, COLOR_GREY, " That Slot is already taken !"); return 1; } }
if(slot == 4) { if(PlayerInfo[playerid][hGun4] == 0) { PlayerInfo[playerid][hGun4] = 24; } else { SendClientMessage(playerid, COLOR_GREY, " That Slot is already taken !"); return 1; } }
if(slot == 5) { if(PlayerInfo[playerid][hGun5] == 0) { PlayerInfo[playerid][hGun5] = 24; } else { SendClientMessage(playerid, COLOR_GREY, " That Slot is already taken !"); return 1; } }
new WeaponName[65];
GetWeaponName(24, WeaponName, 64);
GetPlayerName(playerid, sendername, sizeof(sendername));
PlayerInfo[playerid][pGun2] = 0;
format(string, sizeof(string), "* You have placed your %s into your safe.", WeaponName);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "* %s has placed their %s into their safe.", sendername, WeaponName);
ProxDetector(20.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
SetPlayerWeapons(playerid);
return 1;
}
if(strcmp(tmp,"ak47",true) == 0)
{
if(PlayerInfo[playerid][pGun5] != 30) { SendClientMessage(playerid, COLOR_GREY, " You don't have that weapon !"); return 1; }
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_WHITE, "USAGE: /storegun [weapon] [slot]"); return 1; }
new slot = strvalEx(tmp);
if(slot < 1 || slot > 5) { SendClientMessage(playerid, COLOR_GREY, " Slot can't be below 1 or above 5 !"); return 1; }
if(slot > PlayerInfo[playerid][hGL]) { SendClientMessage(playerid, COLOR_GREY, " You haven't unlocked that Slot !"); return 1; }
if(slot == 1) { if(PlayerInfo[playerid][hGun1] == 0) { PlayerInfo[playerid][hGun1] = 30; } else { SendClientMessage(playerid, COLOR_GREY, " That Slot is already taken !"); return 1; } }
if(slot == 2) { if(PlayerInfo[playerid][hGun2] == 0) { PlayerInfo[playerid][hGun2] = 30; } else { SendClientMessage(playerid, COLOR_GREY, " That Slot is already taken !"); return 1; } }
if(slot == 3) { if(PlayerInfo[playerid][hGun3] == 0) { PlayerInfo[playerid][hGun3] = 30; } else { SendClientMessage(playerid, COLOR_GREY, " That Slot is already taken !"); return 1; } }
if(slot == 4) { if(PlayerInfo[playerid][hGun4] == 0) { PlayerInfo[playerid][hGun4] = 30; } else { SendClientMessage(playerid, COLOR_GREY, " That Slot is already taken !"); return 1; } }
if(slot == 5) { if(PlayerInfo[playerid][hGun5] == 0) { PlayerInfo[playerid][hGun5] = 30; } else { SendClientMessage(playerid, COLOR_GREY, " That Slot is already taken !"); return 1; } }
new WeaponName[65];
GetWeaponName(30, WeaponName, 64);
GetPlayerName(playerid, sendername, sizeof(sendername));
PlayerInfo[playerid][pGun5] = 0;
format(string, sizeof(string), "* You have placed your %s into your safe.", WeaponName);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "* %s has placed their %s into their safe.", sendername, WeaponName);
ProxDetector(20.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
SetPlayerWeapons(playerid);
return 1;
}
if(strcmp(tmp,"m4",true) == 0)
{
if(PlayerInfo[playerid][pGun5] != 31) { SendClientMessage(playerid, COLOR_GREY, " You don't have that weapon !"); return 1; }
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_WHITE, "USAGE: /storegun [weapon] [slot]"); return 1; }
new slot = strvalEx(tmp);
if(slot < 1 || slot > 5) { SendClientMessage(playerid, COLOR_GREY, " Slot can't be below 1 or above 5 !"); return 1; }
if(slot > PlayerInfo[playerid][hGL]) { SendClientMessage(playerid, COLOR_GREY, " You haven't unlocked that Slot !"); return 1; }
if(slot == 1) { if(PlayerInfo[playerid][hGun1] == 0) { PlayerInfo[playerid][hGun1] = 31; } else { SendClientMessage(playerid, COLOR_GREY, " That Slot is already taken !"); return 1; } }
if(slot == 2) { if(PlayerInfo[playerid][hGun2] == 0) { PlayerInfo[playerid][hGun2] = 31; } else { SendClientMessage(playerid, COLOR_GREY, " That Slot is already taken !"); return 1; } }
if(slot == 3) { if(PlayerInfo[playerid][hGun3] == 0) { PlayerInfo[playerid][hGun3] = 31; } else { SendClientMessage(playerid, COLOR_GREY, " That Slot is already taken !"); return 1; } }
if(slot == 4) { if(PlayerInfo[playerid][hGun4] == 0) { PlayerInfo[playerid][hGun4] = 31; } else { SendClientMessage(playerid, COLOR_GREY, " That Slot is already taken !"); return 1; } }
if(slot == 5) { if(PlayerInfo[playerid][hGun5] == 0) { PlayerInfo[playerid][hGun5] = 31; } else { SendClientMessage(playerid, COLOR_GREY, " That Slot is already taken !"); return 1; } }
new WeaponName[65];
GetWeaponName(31, WeaponName, 64);
GetPlayerName(playerid, sendername, sizeof(sendername));
PlayerInfo[playerid][pGun5] = 0;
format(string, sizeof(string), "* You have placed your %s into your safe.", WeaponName);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "* %s has placed their %s into their safe.", sendername, WeaponName);
ProxDetector(20.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
SetPlayerWeapons(playerid);
return 1;
}
if(strcmp(tmp,"sniper",true) == 0 || strcmp(tmp,"sniperrifle",true) == 0)
{
if(PlayerInfo[playerid][pGun6] != 34) { SendClientMessage(playerid, COLOR_GREY, " You don't have that weapon !"); return 1; }
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_WHITE, "USAGE: /storegun [weapon] [slot]"); return 1; }
new slot = strvalEx(tmp);
if(slot < 1 || slot > 5) { SendClientMessage(playerid, COLOR_GREY, " Slot can't be below 1 or above 5 !"); return 1; }
if(slot > PlayerInfo[playerid][hGL]) { SendClientMessage(playerid, COLOR_GREY, " You haven't unlocked that Slot !"); return 1; }
if(slot == 1) { if(PlayerInfo[playerid][hGun1] == 0) { PlayerInfo[playerid][hGun1] = 34; } else { SendClientMessage(playerid, COLOR_GREY, " That Slot is already taken !"); return 1; } }
if(slot == 2) { if(PlayerInfo[playerid][hGun2] == 0) { PlayerInfo[playerid][hGun2] = 34; } else { SendClientMessage(playerid, COLOR_GREY, " That Slot is already taken !"); return 1; } }
if(slot == 3) { if(PlayerInfo[playerid][hGun3] == 0) { PlayerInfo[playerid][hGun3] = 34; } else { SendClientMessage(playerid, COLOR_GREY, " That Slot is already taken !"); return 1; } }
if(slot == 4) { if(PlayerInfo[playerid][hGun4] == 0) { PlayerInfo[playerid][hGun4] = 34; } else { SendClientMessage(playerid, COLOR_GREY, " That Slot is already taken !"); return 1; } }
if(slot == 5) { if(PlayerInfo[playerid][hGun5] == 0) { PlayerInfo[playerid][hGun5] = 34; } else { SendClientMessage(playerid, COLOR_GREY, " That Slot is already taken !"); return 1; } }
new WeaponName[65];
GetWeaponName(34, WeaponName, 64);
GetPlayerName(playerid, sendername, sizeof(sendername));
PlayerInfo[playerid][pGun6] = 0;
format(string, sizeof(string), "* You have placed your %s into your safe.", WeaponName);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "* %s has placed their %s into their safe.", sendername, WeaponName);
ProxDetector(20.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
SetPlayerWeapons(playerid);
return 1;
}
if(strcmp(tmp,"spas12",true) == 0 || strcmp(tmp,"combatshotgun",true) == 0)
{
if(PlayerInfo[playerid][pGun3] != 27) { SendClientMessage(playerid, COLOR_GREY, " You don't have that weapon !"); return 1; }
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_WHITE, "USAGE: /storegun [weapon] [slot]"); return 1; }
new slot = strvalEx(tmp);
if(slot < 1 || slot > 5) { SendClientMessage(playerid, COLOR_GREY, " Slot can't be below 1 or above 5 !"); return 1; }
if(slot > PlayerInfo[playerid][hGL]) { SendClientMessage(playerid, COLOR_GREY, " You haven't unlocked that Slot !"); return 1; }
if(slot == 1) { if(PlayerInfo[playerid][hGun1] == 0) { PlayerInfo[playerid][hGun1] = 27; } else { SendClientMessage(playerid, COLOR_GREY, " That Slot is already taken !"); return 1; } }
if(slot == 2) { if(PlayerInfo[playerid][hGun2] == 0) { PlayerInfo[playerid][hGun2] = 27; } else { SendClientMessage(playerid, COLOR_GREY, " That Slot is already taken !"); return 1; } }
if(slot == 3) { if(PlayerInfo[playerid][hGun3] == 0) { PlayerInfo[playerid][hGun3] = 27; } else { SendClientMessage(playerid, COLOR_GREY, " That Slot is already taken !"); return 1; } }
if(slot == 4) { if(PlayerInfo[playerid][hGun4] == 0) { PlayerInfo[playerid][hGun4] = 27; } else { SendClientMessage(playerid, COLOR_GREY, " That Slot is already taken !"); return 1; } }
if(slot == 5) { if(PlayerInfo[playerid][hGun5] == 0) { PlayerInfo[playerid][hGun5] = 27; } else { SendClientMessage(playerid, COLOR_GREY, " That Slot is already taken !"); return 1; } }
new WeaponName[65];
GetWeaponName(27, WeaponName, 64);
GetPlayerName(playerid, sendername, sizeof(sendername));
PlayerInfo[playerid][pGun3] = 0;
format(string, sizeof(string), "* You have placed your %s into your safe.", WeaponName);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "* %s has placed their %s into their safe.", sendername, WeaponName);
ProxDetector(20.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
SetPlayerWeapons(playerid);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_GREY," Invalid weapon name !");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD2, " You don't own a house !");
return 1;
}
}
return 1;
}
Code:
if(strcmp(cmd, "/getgun", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pHouseAccepted] != 0)
{
if(PlayerInfo[playerid][pLocal] != playerid)
{
SendClientMessage(playerid, COLOR_GREY, " You are too far from your house !");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
GetPlayerName(playerid, sendername, sizeof(sendername));
SendClientMessage(playerid, COLOR_GREEN, "________________________________________________");
format(string, sizeof(string), "*** %s's Safe ***", sendername);
SendClientMessage(playerid, COLOR_WHITE, string);
DisplaySafeGuns(playerid);
SendClientMessage(playerid, COLOR_GREEN, "________________________________________________");
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /getgun [slot]");
return 1;
}
new slot = strvalEx(tmp);
if(slot < 1 || slot > 5) { SendClientMessage(playerid, COLOR_GREY, " Slot can't be below 1 or above 5 !"); return 1; }
if(slot == 1)
{
if(PlayerInfo[playerid][hGun1] == 0) { SendClientMessage(playerid, COLOR_GREY, " You don't have a weapon in that Slot !"); return 1; }
new WeaponName[65];
GetWeaponName(PlayerInfo[playerid][hGun1], WeaponName, 64);
GetPlayerName(playerid, sendername, sizeof(sendername));
if(PlayerInfo[playerid][hGun1] == 23 || PlayerInfo[playerid][hGun1] == 24) { PlayerInfo[playerid][pGun2] = PlayerInfo[playerid][hGun1]; }
if(PlayerInfo[playerid][hGun1] == 25 || PlayerInfo[playerid][hGun1] == 27) { PlayerInfo[playerid][pGun3] = PlayerInfo[playerid][hGun1]; }
if(PlayerInfo[playerid][hGun1] == 29) { PlayerInfo[playerid][pGun4] = PlayerInfo[playerid][hGun1]; }
if(PlayerInfo[playerid][hGun1] == 30 || PlayerInfo[playerid][hGun1] == 31) { PlayerInfo[playerid][pGun5] = PlayerInfo[playerid][hGun1]; }
if(PlayerInfo[playerid][hGun1] == 33 || PlayerInfo[playerid][hGun1] == 34) { PlayerInfo[playerid][pGun6] = PlayerInfo[playerid][hGun1]; }
PlayerInfo[playerid][hGun1] = 0;
format(string, sizeof(string), "* You have withdrawn your %s from your safe.", WeaponName);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "* %s has withdrawn their %s from their safe.", sendername, WeaponName);
ProxDetector(20.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
SetPlayerWeapons(playerid);
return 1;
}
if(slot == 2)
{
if(PlayerInfo[playerid][hGun2] == 0) { SendClientMessage(playerid, COLOR_GREY, " You don't have a weapon in that Slot !"); return 1; }
new WeaponName[65];
GetWeaponName(PlayerInfo[playerid][hGun2], WeaponName, 64);
GetPlayerName(playerid, sendername, sizeof(sendername));
if(PlayerInfo[playerid][hGun2] == 23 || PlayerInfo[playerid][hGun2] == 24) { PlayerInfo[playerid][pGun2] = PlayerInfo[playerid][hGun2]; }
if(PlayerInfo[playerid][hGun2] == 25 || PlayerInfo[playerid][hGun2] == 27) { PlayerInfo[playerid][pGun3] = PlayerInfo[playerid][hGun2]; }
if(PlayerInfo[playerid][hGun2] == 29) { PlayerInfo[playerid][pGun4] = PlayerInfo[playerid][hGun2]; }
if(PlayerInfo[playerid][hGun2] == 30 || PlayerInfo[playerid][hGun2] == 31) { PlayerInfo[playerid][pGun5] = PlayerInfo[playerid][hGun2]; }
if(PlayerInfo[playerid][hGun2] == 33 || PlayerInfo[playerid][hGun2] == 34) { PlayerInfo[playerid][pGun6] = PlayerInfo[playerid][hGun2]; }
PlayerInfo[playerid][hGun2] = 0;
format(string, sizeof(string), "* You have withdrawn your %s from your safe.", WeaponName);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "* %s has withdrawn their %s from their safe.", sendername, WeaponName);
ProxDetector(20.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
SetPlayerWeapons(playerid);
return 1;
}
if(slot == 3)
{
if(PlayerInfo[playerid][hGun3] == 0) { SendClientMessage(playerid, COLOR_GREY, " You don't have a weapon in that Slot !"); return 1; }
new WeaponName[65];
GetWeaponName(PlayerInfo[playerid][hGun3], WeaponName, 64);
GetPlayerName(playerid, sendername, sizeof(sendername));
if(PlayerInfo[playerid][hGun3] == 23 || PlayerInfo[playerid][hGun3] == 24) { PlayerInfo[playerid][pGun2] = PlayerInfo[playerid][hGun3]; }
if(PlayerInfo[playerid][hGun3] == 25 || PlayerInfo[playerid][hGun3] == 27) { PlayerInfo[playerid][pGun3] = PlayerInfo[playerid][hGun3]; }
if(PlayerInfo[playerid][hGun3] == 29) { PlayerInfo[playerid][pGun4] = PlayerInfo[playerid][hGun3]; }
if(PlayerInfo[playerid][hGun3] == 30 || PlayerInfo[playerid][hGun3] == 31) { PlayerInfo[playerid][pGun5] = PlayerInfo[playerid][hGun3]; }
if(PlayerInfo[playerid][hGun3] == 33 || PlayerInfo[playerid][hGun3] == 34) { PlayerInfo[playerid][pGun6] = PlayerInfo[playerid][hGun3]; }
PlayerInfo[playerid][hGun3] = 0;
format(string, sizeof(string), "* You have withdrawn your %s from your safe.", WeaponName);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "* %s has withdrawn their %s from their safe.", sendername, WeaponName);
ProxDetector(20.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
SetPlayerWeapons(playerid);
return 1;
}
if(slot == 4)
{
if(PlayerInfo[playerid][hGun4] == 0) { SendClientMessage(playerid, COLOR_GREY, " You don't have a weapon in that Slot !"); return 1; }
new WeaponName[65];
GetWeaponName(PlayerInfo[playerid][hGun4], WeaponName, 64);
GetPlayerName(playerid, sendername, sizeof(sendername));
if(PlayerInfo[playerid][hGun4] == 23 || PlayerInfo[playerid][hGun4] == 24) { PlayerInfo[playerid][pGun2] = PlayerInfo[playerid][hGun4]; }
if(PlayerInfo[playerid][hGun4] == 25 || PlayerInfo[playerid][hGun4] == 27) { PlayerInfo[playerid][pGun3] = PlayerInfo[playerid][hGun4]; }
if(PlayerInfo[playerid][hGun4] == 29) { PlayerInfo[playerid][pGun4] = PlayerInfo[playerid][hGun4]; }
if(PlayerInfo[playerid][hGun4] == 30 || PlayerInfo[playerid][hGun4] == 31) { PlayerInfo[playerid][pGun5] = PlayerInfo[playerid][hGun4]; }
if(PlayerInfo[playerid][hGun4] == 33 || PlayerInfo[playerid][hGun4] == 34) { PlayerInfo[playerid][pGun6] = PlayerInfo[playerid][hGun4]; }
PlayerInfo[playerid][hGun4] = 0;
format(string, sizeof(string), "* You have withdrawn your %s from your safe.", WeaponName);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "* %s has withdrawn their %s from their safe.", sendername, WeaponName);
ProxDetector(20.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
SetPlayerWeapons(playerid);
return 1;
}
if(slot == 5)
{
if(PlayerInfo[playerid][hGun5] == 0) { SendClientMessage(playerid, COLOR_GREY, " You don't have a weapon in that Slot !"); return 1; }
new WeaponName[65];
GetWeaponName(PlayerInfo[playerid][hGun5], WeaponName, 64);
GetPlayerName(playerid, sendername, sizeof(sendername));
if(PlayerInfo[playerid][hGun5] == 23 || PlayerInfo[playerid][hGun5] == 24) { PlayerInfo[playerid][pGun2] = PlayerInfo[playerid][hGun5]; }
if(PlayerInfo[playerid][hGun5] == 25 || PlayerInfo[playerid][hGun5] == 27) { PlayerInfo[playerid][pGun3] = PlayerInfo[playerid][hGun5]; }
if(PlayerInfo[playerid][hGun5] == 29) { PlayerInfo[playerid][pGun4] = PlayerInfo[playerid][hGun5]; }
if(PlayerInfo[playerid][hGun5] == 30 || PlayerInfo[playerid][hGun5] == 31) { PlayerInfo[playerid][pGun5] = PlayerInfo[playerid][hGun5]; }
if(PlayerInfo[playerid][hGun5] == 33 || PlayerInfo[playerid][hGun5] == 34) { PlayerInfo[playerid][pGun6] = PlayerInfo[playerid][hGun5]; }
PlayerInfo[playerid][hGun5] = 0;
format(string, sizeof(string), "* You have withdrawn your %s from your safe.", WeaponName);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "* %s has withdrawn their %s from their safe.", sendername, WeaponName);
ProxDetector(20.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
SetPlayerWeapons(playerid);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_GREY, " You don't have that Weapon in your Safe !");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD2, " You don't own a house !");
return 1;
}
}
return 1;
}
This line PlayerInfo[playerid][pGun3] = 27; GivePlayerWeapon(playerid, 27, 60); is what made storing the spas work.
Maybe some info or codes are missing to understand, let me know.