08.04.2011, 20:37
How do i make like if player doesnt have a screwdriver or a tool, he can't create a gun.
Код:
if(strcmp(cmd,"/sellgun",true)==0) { if(IsPlayerConnected(playerid)) { if(PlayerInfo[playerid][pJob] != 9) { SendClientMessage(playerid,COLOR_GREY," You are not a Arms Dealer !"); return 1; } tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { new level = PlayerInfo[playerid][pArmsSkill]; if(level >= 0 && level <= 49) { SendClientMessage(playerid, COLOR_GREEN, "________________________________________________"); SendClientMessage(playerid, COLOR_YELLOW, "« Available Weapons »"); SendClientMessage(playerid, COLOR_WHITE, "Weapons: Items:"); SendClientMessage(playerid, COLOR_GRAD3, "sdpistol (100) flowers (25)"); SendClientMessage(playerid, COLOR_GRAD3, "shotgun (200) knuckles (25)"); SendClientMessage(playerid, COLOR_GREEN, "________________________________________________"); SendClientMessage(playerid, COLOR_WHITE, "USAGE: /sellgun [playerid/PartOfName] [weaponname]"); } else if(level >= 50 && level <= 99) { SendClientMessage(playerid, COLOR_GREEN, "________________________________________________"); SendClientMessage(playerid, COLOR_YELLOW, "« Available Weapons »"); SendClientMessage(playerid, COLOR_WHITE, "Weapons: Items:"); SendClientMessage(playerid, COLOR_GRAD3, "sdpistol (100) flowers (25)"); SendClientMessage(playerid, COLOR_GRAD3, "shotgun (200) knuckles (25)"); SendClientMessage(playerid, COLOR_GRAD3, "mp5 (400) baseballbat (25)"); SendClientMessage(playerid, COLOR_GRAD3, "rifle (1000) cane (25)"); SendClientMessage(playerid, COLOR_GREEN, "________________________________________________"); SendClientMessage(playerid, COLOR_WHITE, "USAGE: /sellgun [playerid/PartOfName] [weaponname]"); } else if(level >= 100 && level <= 199) { SendClientMessage(playerid, COLOR_GREEN, "________________________________________________"); SendClientMessage(playerid, COLOR_YELLOW, "« Available Weapons »"); SendClientMessage(playerid, COLOR_WHITE, "Weapons: Items:"); SendClientMessage(playerid, COLOR_GRAD3, "sdpistol (100) flowers (25)"); SendClientMessage(playerid, COLOR_GRAD3, "shotgun (200) knuckles (25)"); SendClientMessage(playerid, COLOR_GRAD3, "mp5 (400) baseballbat (25)"); SendClientMessage(playerid, COLOR_GRAD3, "rifle (1000) cane (25)"); SendClientMessage(playerid, COLOR_GRAD3, "deagle (2000) shovel (25)"); SendClientMessage(playerid, COLOR_GREEN, "________________________________________________"); SendClientMessage(playerid, COLOR_WHITE, "USAGE: /sellgun [playerid/PartOfName] [weaponname]"); } else if(level >= 200 && level <= 399) { SendClientMessage(playerid, COLOR_GREEN, "________________________________________________"); SendClientMessage(playerid, COLOR_YELLOW, "« Available Weapons »"); SendClientMessage(playerid, COLOR_WHITE, "Weapons: Items:"); SendClientMessage(playerid, COLOR_GRAD3, "sdpistol (100) flowers (25)"); SendClientMessage(playerid, COLOR_GRAD3, "shotgun (200) knuckles (25)"); SendClientMessage(playerid, COLOR_GRAD3, "mp5 (400) baseballbat (25)"); SendClientMessage(playerid, COLOR_GRAD3, "rifle (1000) cane (25)"); SendClientMessage(playerid, COLOR_GRAD3, "deagle (2000) shovel (25)"); SendClientMessage(playerid, COLOR_GRAD3, "ak47 (3500) poolcue (25)"); SendClientMessage(playerid, COLOR_GRAD3, "m4 (4000) golfclub (25)"); SendClientMessage(playerid, COLOR_GREEN, "________________________________________________"); SendClientMessage(playerid, COLOR_WHITE, "USAGE: /sellgun [playerid/PartOfName] [weaponname]"); } else if(level >= 400) { SendClientMessage(playerid, COLOR_GREEN, "________________________________________________"); SendClientMessage(playerid, COLOR_YELLOW, "« Available Weapons »"); SendClientMessage(playerid, COLOR_WHITE, "Weapons: Items:"); SendClientMessage(playerid, COLOR_GRAD3, "sdpistol (100) flowers (25)"); SendClientMessage(playerid, COLOR_GRAD3, "shotgun (200) knuckles (25)"); SendClientMessage(playerid, COLOR_GRAD3, "mp5 (400) baseballbat (25)"); SendClientMessage(playerid, COLOR_GRAD3, "rifle (1000) cane (25)"); SendClientMessage(playerid, COLOR_GRAD3, "deagle (2000) shovel (25)"); SendClientMessage(playerid, COLOR_GRAD3, "ak47 (3500) poolcue (25)"); SendClientMessage(playerid, COLOR_GRAD3, "m4 (4000) golfclub (25)"); SendClientMessage(playerid, COLOR_GRAD3, "sniper (6500) katana (25)"); SendClientMessage(playerid, COLOR_GRAD3, "spas12 (6500) dildo (25)"); SendClientMessage(playerid, COLOR_GREEN, "________________________________________________"); SendClientMessage(playerid, COLOR_WHITE, "USAGE: /sellgun [playerid/PartOfName] [weaponname]"); } return 1; } giveplayerid = ReturnUser(tmp); if(IsPlayerConnected(giveplayerid)) { if(giveplayerid != INVALID_PLAYER_ID) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { new level = PlayerInfo[playerid][pArmsSkill]; if(level >= 0 && level <= 49) { SendClientMessage(playerid, COLOR_GREEN, "________________________________________________"); SendClientMessage(playerid, COLOR_YELLOW, "« Available Weapons »"); SendClientMessage(playerid, COLOR_WHITE, "Weapons: Items:"); SendClientMessage(playerid, COLOR_GRAD3, "sdpistol (100) flowers (25)"); SendClientMessage(playerid, COLOR_GRAD3, "shotgun (200) knuckles (25)"); SendClientMessage(playerid, COLOR_GREEN, "________________________________________________"); SendClientMessage(playerid, COLOR_WHITE, "USAGE: /sellgun [playerid/PartOfName] [weaponname]"); } else if(level >= 50 && level <= 99) { SendClientMessage(playerid, COLOR_GREEN, "________________________________________________"); SendClientMessage(playerid, COLOR_YELLOW, "« Available Weapons »"); SendClientMessage(playerid, COLOR_WHITE, "Weapons: Items:"); SendClientMessage(playerid, COLOR_GRAD3, "sdpistol (100) flowers (25)"); SendClientMessage(playerid, COLOR_GRAD3, "shotgun (200) knuckles (25)"); SendClientMessage(playerid, COLOR_GRAD3, "mp5 (400) baseballbat (25)"); SendClientMessage(playerid, COLOR_GRAD3, "rifle (1000) cane (25)"); SendClientMessage(playerid, COLOR_GREEN, "________________________________________________"); SendClientMessage(playerid, COLOR_WHITE, "USAGE: /sellgun [playerid/PartOfName] [weaponname]"); } else if(level >= 100 && level <= 199) { SendClientMessage(playerid, COLOR_GREEN, "________________________________________________"); SendClientMessage(playerid, COLOR_YELLOW, "« Available Weapons »"); SendClientMessage(playerid, COLOR_GRAD3, "Weapons: Items:"); SendClientMessage(playerid, COLOR_GRAD3, "sdpistol (100) flowers (25)"); SendClientMessage(playerid, COLOR_GRAD3, "shotgun (200) knuckles (25)"); SendClientMessage(playerid, COLOR_GRAD3, "mp5 (400) baseballbat (25)"); SendClientMessage(playerid, COLOR_GRAD3, "rifle (1000) cane (25)"); SendClientMessage(playerid, COLOR_GRAD3, "deagle (2000) shovel (25)"); SendClientMessage(playerid, COLOR_GREEN, "________________________________________________"); SendClientMessage(playerid, COLOR_WHITE, "USAGE: /sellgun [playerid/PartOfName] [weaponname]"); } else if(level >= 200 && level <= 399) { SendClientMessage(playerid, COLOR_GREEN, "________________________________________________"); SendClientMessage(playerid, COLOR_YELLOW, "« Available Weapons »"); SendClientMessage(playerid, COLOR_WHITE, "Weapons: Items:"); SendClientMessage(playerid, COLOR_GRAD3, "sdpistol (100) flowers (25)"); SendClientMessage(playerid, COLOR_GRAD3, "shotgun (200) knuckles (25)"); SendClientMessage(playerid, COLOR_GRAD3, "mp5 (400) baseballbat (25)"); SendClientMessage(playerid, COLOR_GRAD3, "rifle (1000) cane (25)"); SendClientMessage(playerid, COLOR_GRAD3, "deagle (2000) shovel (25)"); SendClientMessage(playerid, COLOR_GRAD3, "ak47 (3500) poolcue (25)"); SendClientMessage(playerid, COLOR_GRAD3, "m4 (4000) golfclub (25)"); SendClientMessage(playerid, COLOR_GREEN, "________________________________________________"); SendClientMessage(playerid, COLOR_WHITE, "USAGE: /sellgun [playerid/PartOfName] [weaponname]"); } else if(level >= 400) { SendClientMessage(playerid, COLOR_GREEN, "________________________________________________"); SendClientMessage(playerid, COLOR_YELLOW, "« Available Weapons »"); SendClientMessage(playerid, COLOR_WHITE, "Weapons: Items:"); SendClientMessage(playerid, COLOR_GRAD3, "sdpistol (100) flowers (25)"); SendClientMessage(playerid, COLOR_GRAD3, "shotgun (200) knuckles (25)"); SendClientMessage(playerid, COLOR_GRAD3, "mp5 (400) baseballbat (25)"); SendClientMessage(playerid, COLOR_GRAD3, "rifle (1000) cane (25)"); SendClientMessage(playerid, COLOR_GRAD3, "deagle (2000) shovel (25)"); SendClientMessage(playerid, COLOR_GRAD3, "ak47 (3500) poolcue (25)"); SendClientMessage(playerid, COLOR_GRAD3, "m4 (4000) golfclub (25)"); SendClientMessage(playerid, COLOR_GRAD3, "sniper (6500) katana (25)"); SendClientMessage(playerid, COLOR_GRAD3, "spas12 (6500) dildo (25)"); SendClientMessage(playerid, COLOR_GREEN, "________________________________________________"); SendClientMessage(playerid, COLOR_WHITE, "USAGE: /sellgun [playerid/PartOfName] [weaponname]"); } return 1; } } if(SellGunTimer[playerid]) return SendClientMessage(playerid,COLOR_GREY," You must wait 10 seconds before selling another weapon !"); if(ProxDetectorS(5.0, playerid, giveplayerid)) { new weapon,price,loggun; if(strcmp(tmp,"sdpistol",true) == 0) { if(PlayerInfo[playerid][pMats] > 99) { if(PlayerInfo[giveplayerid][pGun2] == 24) { SendClientMessage(playerid,COLOR_GREY," That player is carrying a Deagle !"); return 1; } weapon = 23; price = 100; } else { SendClientMessage(playerid,COLOR_GREY," Not enough Materials for that Weapon !"); return 1; } } else if(strcmp(tmp,"flowers",true) == 0) { if(PlayerInfo[playerid][pMats] > 24) { weapon = 14; price = 25; } else { SendClientMessage(playerid,COLOR_GREY," Not enough Materials for that Weapon !"); return 1; } } else if(strcmp(tmp,"shotgun",true) == 0) { if(PlayerInfo[playerid][pMats] > 199) { if(PlayerInfo[giveplayerid][pGun3] == 27) { SendClientMessage(playerid,COLOR_GREY," That player is carrying a SPAS12 !"); return 1; } weapon = 25; price = 200; } else { SendClientMessage(playerid,COLOR_GREY," Not enough Materials for that Weapon !"); return 1; } } else if(strcmp(tmp,"knuckles",true) == 0) { if(PlayerInfo[playerid][pMats] > 24) { weapon = 1; price = 25; } else { SendClientMessage(playerid,COLOR_GREY," Not enough Materials for that Weapon !"); return 1; } } else if(strcmp(tmp,"mp5",true) == 0) { new level = PlayerInfo[playerid][pArmsSkill]; if(level >= 50) { if(PlayerInfo[playerid][pMats] > 399) { weapon = 29; price = 400; } else { SendClientMessage(playerid,COLOR_GREY," Not enough Materials for that Weapon !"); return 1; } } else { SendClientMessage(playerid,COLOR_GREY," You are not the required level to create that !"); return 1; } } else if(strcmp(tmp,"baseballbat",true) == 0) { new level = PlayerInfo[playerid][pArmsSkill]; if(level >= 50) { if(PlayerInfo[playerid][pMats] > 24) { weapon = 5; price = 25; } else { SendClientMessage(playerid,COLOR_GREY," Not enough Materials for that Weapon !"); return 1; } } else { SendClientMessage(playerid,COLOR_GREY," You are not the required level to create that !"); return 1; } } else if(strcmp(tmp,"rifle",true) == 0) { new level = PlayerInfo[playerid][pArmsSkill]; if(level >= 50) { if(PlayerInfo[playerid][pMats] > 999) { weapon = 33; price = 1000; } else { SendClientMessage(playerid,COLOR_GREY," Not enough Materials for that Weapon !"); return 1; } } else { SendClientMessage(playerid,COLOR_GREY," You are not the required level to create that !"); return 1; } } else if(strcmp(tmp,"cane",true) == 0) { new level = PlayerInfo[playerid][pArmsSkill]; if(level >= 50) { if(PlayerInfo[playerid][pMats] > 24) { weapon = 15; price = 25; } else { SendClientMessage(playerid,COLOR_GREY," Not enough Materials for that Weapon !"); return 1; } } else { SendClientMessage(playerid,COLOR_GREY," You are not the required level to create that !"); return 1; } } else if(strcmp(tmp,"deagle",true) == 0) { new level = PlayerInfo[playerid][pArmsSkill]; if(level >= 100) { if(PlayerInfo[playerid][pMats] > 1999) { weapon = 24; price = 2000; } else { SendClientMessage(playerid,COLOR_GREY," Not enough Materials for that Weapon !"); return 1; } } else { SendClientMessage(playerid,COLOR_GREY," You are not the required level to create that !"); return 1; } } else if(strcmp(tmp,"shovel",true) == 0) { new level = PlayerInfo[playerid][pArmsSkill]; if(level >= 100) { if(PlayerInfo[playerid][pMats] > 24) { weapon = 6; price = 25; } else { SendClientMessage(playerid,COLOR_GREY," Not enough Materials for that Weapon !"); return 1; } } else { SendClientMessage(playerid,COLOR_GREY," You are not the required level to create that !"); return 1; } } else if(strcmp(tmp,"ak47",true) == 0) { new level = PlayerInfo[playerid][pArmsSkill]; if(level >= 200) { if(PlayerInfo[playerid][pMats] > 3499) { weapon = 30; price = 3500; } else { SendClientMessage(playerid,COLOR_GREY," Not enough Materials for that Weapon !"); return 1; } } else { SendClientMessage(playerid,COLOR_GREY," You are not the required level to create that !"); return 1; } } else if(strcmp(tmp,"poolcue",true) == 0) { new level = PlayerInfo[playerid][pArmsSkill]; if(level >= 200) { if(PlayerInfo[playerid][pMats] > 24) { weapon = 7; price = 25; } else { SendClientMessage(playerid,COLOR_GREY," Not enough Materials for that Weapon !"); return 1; } } else { SendClientMessage(playerid,COLOR_GREY," You are not the required level to create that !"); return 1; } } else if(strcmp(tmp,"m4",true) == 0) { new level = PlayerInfo[playerid][pArmsSkill]; if(level >= 200) { if(PlayerInfo[playerid][pMats] > 3999) { weapon = 31; price = 4000; } else { SendClientMessage(playerid,COLOR_GREY," Not enough Materials for that Weapon !"); return 1; } } else { SendClientMessage(playerid,COLOR_GREY," You are not the required level to create that !"); return 1; } } else if(strcmp(tmp,"golfclub",true) == 0) { new level = PlayerInfo[playerid][pArmsSkill]; if(level >= 200) { if(PlayerInfo[playerid][pMats] > 24) { weapon = 2; price = 25; } else {SendClientMessage(playerid,COLOR_GREY," Not enough Materials for that Weapon !"); return 1; } } else { SendClientMessage(playerid,COLOR_GREY," You are not the required level to create that !"); return 1; } } else if(strcmp(tmp,"sniper",true) == 0) { new level = PlayerInfo[playerid][pArmsSkill]; if(level >= 400) { if(PlayerInfo[playerid][pMats] > 6499) { weapon = 34; price = 6500; } else { SendClientMessage(playerid,COLOR_GREY," Not enough Materials for that Weapon !"); return 1; } } else { SendClientMessage(playerid,COLOR_GREY," You are not the required level to create that !"); return 1; } } else if(strcmp(tmp,"katana",true) == 0) { new level = PlayerInfo[playerid][pArmsSkill]; if(level >= 400) { if(PlayerInfo[playerid][pMats] > 24) { weapon = 8; price = 25; } else { SendClientMessage(playerid,COLOR_GREY," Not enough Materials for that Weapon !"); return 1; } } else { SendClientMessage(playerid,COLOR_GREY," You are not the required level to create that !");return 1; } } else if(strcmp(tmp,"spas12",true) == 0) { new level = PlayerInfo[playerid][pArmsSkill]; if(level >= 400) { if(PlayerInfo[playerid][pMats] > 6499) { weapon = 27; price = 6500; } else { SendClientMessage(playerid,COLOR_GREY," Not enough Materials for that Weapon !"); return 1; } } else { SendClientMessage(playerid,COLOR_GREY," You are not the required level to create that !"); return 1; } } else if(strcmp(tmp,"dildo",true) == 0) { new level = PlayerInfo[playerid][pArmsSkill]; if(level >= 400) { if(PlayerInfo[playerid][pMats] > 24) { weapon = 10; price = 25; } else { SendClientMessage(playerid,COLOR_GREY," Not enough Materials for that Weapon !"); return 1; } } else { SendClientMessage(playerid,COLOR_GREY," You are not the required level to create that !"); return 1; } } else { SendClientMessage(playerid,COLOR_GREY," Invalid weapon name !"); return 1; } if(weapon==27||weapon==34||weapon==31||weapon==30||weapon==24||weapon==33||weapon==29||weapon==25||weapon==23) { if(weapon != 23 || weapon != 25) { loggun = 1; } PlayerInfo[playerid][pArmsSkill] ++; } if(giveplayerid == playerid) { SendClientMessage(playerid, COLOR_GREY, " You cannot sell yourself a gun."); return 1; } GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer)); GetPlayerName(playerid, sendername, sizeof(sendername)); PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0); PlayerPlaySound(giveplayerid, 1052, 0.0, 0.0, 0.0); format(string, sizeof(string), " You have recieved a %s from %s.", tmp, sendername); SendClientMessage(giveplayerid, COLOR_GRAD1, string); format(string, sizeof(string), "* %s created a Gun from Materials, and hands it to %s.", sendername ,giveplayer); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); if(weapon != 0) { GivePlayerGun(giveplayerid, weapon); } if(loggun == 1) { format(string, sizeof(string), "%s has sold a %s to %s", sendername,tmp,giveplayer); PayLog(string); } PlayerInfo[playerid][pMats] -= price; SellGunTimer[playerid] = 1; SetTimerEx("SellGun",10*1000,0,"i",playerid); if(PlayerInfo[playerid][pArmsSkill] == 50) { SendClientMessage(playerid, COLOR_YELLOW, "* Your Arms Dealer Skill is now Level 2, you have unlocked the MP5 & Rifle."); } else if(PlayerInfo[playerid][pArmsSkill] == 100) { SendClientMessage(playerid, COLOR_YELLOW, "* Your Arms Dealer Skill is now Level 3, you have unlocked the Desert Eagle."); } else if(PlayerInfo[playerid][pArmsSkill] == 200) { SendClientMessage(playerid, COLOR_YELLOW, "* Your Arms Dealer Skill is now Level 4, you have unlocked the AK47 & M4 Assault Rifles."); } else if(PlayerInfo[playerid][pArmsSkill] == 400) { SendClientMessage(playerid, COLOR_YELLOW, "* Your Arms Dealer Skill is now Level 5, you have unlocked the SPAS12 & Sniper Rifle."); } } else { SendClientMessage(playerid, COLOR_GREY, " You are too far away !"); return 1; } } else { format(string, sizeof(string), " %d is not an active player !", giveplayerid); SendClientMessage(playerid, COLOR_GRAD1, string); } } return 1; }