30.08.2011, 12:02
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.
I will give you all the codes you may need:
That is in enum pInfo
The storing house gun system got 5 slots, thats why hGun1-5
Command to store guns
Command to take guns
Example of the weapon system
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.
I would be so grateful if someone could help me with this.
I will give you all the codes you may need:
That is in enum pInfo
Code:
enum pInfo { pGun0, pGun1, pGun2, pGun3, pGun4, pGun5, pGun6, pGun7, pGun8, pGun9, pGun10, pGun11, pGun12, hGun1, hGun2, hGun3, hGun4, hGun5, }
Code:
stock HaveWeapon(playerid, weaponid) { if(IsPlayerConnected(playerid)) { switch (weaponid) { case 1: return PlayerInfo[playerid][pGun0]; case 2..9: return PlayerInfo[playerid][pGun1]; case 10..15: return PlayerInfo[playerid][pGun10]; case 16..18: return PlayerInfo[playerid][pGun8]; case 22..24: return PlayerInfo[playerid][pGun2]; case 25..27: return PlayerInfo[playerid][pGun3]; case 28..29: return PlayerInfo[playerid][pGun4]; case 30..31: return PlayerInfo[playerid][pGun5]; case 32: return PlayerInfo[playerid][pGun4]; case 33..34: return PlayerInfo[playerid][pGun6]; case 35..38: return PlayerInfo[playerid][pGun7]; case 39: return PlayerInfo[playerid][pGun8]; case 41..43: return PlayerInfo[playerid][pGun9]; case 44..46: return PlayerInfo[playerid][pGun11]; case 40: return PlayerInfo[playerid][pGun12]; } } return 1; }
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; }
Code:
if (strcmp("/createspas12", cmdtext, true, 10) == 0) { if(IsPlayerInRangeOfPoint(playerid,10,848.5450,-1360.4960,13.5469))//Spas12 { new weapons[2]; GetPlayerWeaponData(playerid, 3, weapons[0], weapons[1]); if(weapons[0] == 0) { if(GetPlayerMoney(playerid) < 22500) return SendClientMessage(playerid, 0xAFAFAFAA, "You don't have enough cash to create that weapon."); PlayerInfo[playerid][pGun3] = 27; GivePlayerWeapon(playerid, 27, 60); GivePlayerWeapon(playerid, 27, 60); PlayerInfo[playerid][pCash] = PlayerInfo[playerid][pCash]-22500; GivePlayerMoney(playerid, -22500); SendClientMessage(playerid,0xFF9900AA,"You have created a brand new {FF6347}Combat Shotgun {FF9900}for 22500$"); ApplyAnimation(playerid, "BOMBER","BOM_Plant_In",4.0,0,0,0,0,0); return 1; } else return SendClientMessage(playerid, 0xAFAFAFAA, "You are already carrying a shotgun, reload it at the ammunition depot"); } else return SendClientMessage(playerid, 0xAFAFAFAA, "You are not near the High Armory Depot !"); }
Maybe some info or codes are missing to understand, let me know.
I would be so grateful if someone could help me with this.