15.05.2013, 23:41
Ok, so long story short, i'm trying to make this cmd give unlimited ammo. Now i've tried greening out some things that have to do with ammo, but clearly that ain't helping it, what am i doing wrong here?
Код:
CMD:sellgun(playerid, params[]) { if(PlayerInfo[playerid][pJob] != 9) { SendClientMessage(playerid,COLOR_LIGHTRED," You are not an arms dealer!"); return 1; } if(PlayerMuteInfo[playerid][SellgunCool]) { SendClientMessage(playerid, COLOR_LIGHTRED, " Please wait 10 seconds between sales!"); return 1; } new giveplayerid,x_weapon[10]; if(!sscanf(params, "us[10]", giveplayerid, x_weapon)) { if(IsPlayerConnected(giveplayerid)) { new level = PlayerInfo[playerid][pArmsSkill]; new pricea; new priceb; new pricec; new priced; new amats = PlayerInfo[playerid][pAMats]; new bmats = PlayerInfo[playerid][pBMats]; new cmats = PlayerInfo[playerid][pCMats]; new dmats = PlayerInfo[playerid][pDMats]; new weapon; new noskill; if(strcmp(x_weapon,"9mm",true) == 0) { if(amats >= 150 && level >= 0) { weapon = 22; pricea = 150; noskill = 1;} else { SendClientMessage(playerid,COLOR_LIGHTRED," You don't have enough materials for that weapon!"); return 1; } } else if(strcmp(x_weapon,"sdpistol",true) == 0) { if(amats >= 200 && level >= 50) { weapon = 23; pricea = 150;} else { SendClientMessage(playerid,COLOR_LIGHTRED," You don't have enough materials for that weapon!"); return 1; } } else if(strcmp(x_weapon,"bat",true) == 0) { if(amats >= 100 && level >= 0) { weapon = 5; pricea = 100; noskill = 1;} else { SendClientMessage(playerid,COLOR_LIGHTRED," You don't have enough materials for that weapon!"); return 1; } } else if(strcmp(x_weapon,"shovel",true) == 0) { if(amats >= 100 && level >= 0) { weapon = 6; pricea = 100; noskill = 1;} else { SendClientMessage(playerid,COLOR_LIGHTRED," You don't have enough materials for that weapon!"); return 1; } } else if(strcmp(x_weapon,"flowers",true) == 0) { if(amats >= 100 && level >= 0) { weapon = 14; pricea = 25; noskill = 1;} else { SendClientMessage(playerid,COLOR_LIGHTRED," You don't have enough materials for that weapon!"); return 1; } } else if(strcmp(x_weapon,"eagle",true) == 0) { if(amats >= 800 && cmats >= 400 && level >= 150 ) { weapon = 24; pricea = 800; pricec = 400; } else { SendClientMessage(playerid,COLOR_LIGHTRED," You don't have enough materials for that weapon!"); return 1; } } else if(strcmp(x_weapon,"Uzi",true) == 0) { if(cmats >= 100 && bmats >= 100 && level >= 50) { weapon = 28; pricec = 100; priceb = 100; } else { SendClientMessage(playerid,COLOR_LIGHTRED," You don't have enough materials for that weapon!"); return 1; } } else if(strcmp(x_weapon,"mp5",true) == 0) { if(cmats >= 300 && level >= 100) { weapon = 29; pricec = 300; } else { SendClientMessage(playerid,COLOR_LIGHTRED," You don't have enough materials for that weapon!"); return 1; } } else if(strcmp(x_weapon,"shotgun",true) == 0) { if(bmats >= 500 && level >= 0) { weapon = 25; priceb = 500; noskill = 1;} else { SendClientMessage(playerid,COLOR_LIGHTRED," You don't have enough materials for that weapon!"); return 1; } } else if(strcmp(x_weapon,"spas12",true) == 0) { if(bmats >= 15000 && cmats >= 15000 && dmats >= 100 && level >= 1000) { weapon = 27; priceb = 1500; pricec = 1500; priced = 50;} else { SendClientMessage(playerid,COLOR_LIGHTRED," You don't have enough materials for that weapon!"); return 1; } } else if(strcmp(x_weapon,"ak47",true) == 0) { if(amats >= 1000 && cmats >= 1000 && level >= 150) { weapon = 30; pricea = 500; pricec = 500; } else { SendClientMessage(playerid,COLOR_LIGHTRED," You don't have enough materials for that weapon!"); return 1; } } else if(strcmp(x_weapon,"m4",true) == 0) { if(bmats >= 10000 && cmats >= 10000 && dmats >= 50 && level >= 1000) { weapon = 31; priceb = 1000; pricec = 1000; priced = 15; } else { SendClientMessage(playerid,COLOR_LIGHTRED," You don't have enough materials for that weapon!"); return 1; } } else if(strcmp(x_weapon,"rifle",true) == 0) { if(amats >= 600 && bmats >= 600 && level >= 300) { weapon = 33; pricea = 600; priceb = 600; } else { SendClientMessage(playerid,COLOR_LIGHTRED," You don't have enough materials for that weapon!"); return 1; } } else if(strcmp(x_weapon,"dildo",true) == 0) { if(amats >= 1000 && dmats >= 20 && level >= 1000) { weapon = 12; pricea = 1000; priced = 20; priced = 20;} else { SendClientMessage(playerid,COLOR_LIGHTRED," You don't have enough materials for that weapon!"); return 1; } } /*else if(strcmp(x_weapon,"grenade",true) == 0) { if(cmats >= 1000 && dmats >= 30 && level >= 1000) { weapon = 16; pricec = 1000; priced = 30;} else { SendClientMessage(playerid,COLOR_LIGHTRED," You don't have enough materials for that weapon!"); return 1; } } */ else { SendClientMessage(playerid,COLOR_LIGHTRED," Invalid weapon!"); return 1; } if(playerid == giveplayerid) { PlayerInfo[playerid][pAMats] -= pricea; PlayerInfo[playerid][pBMats] -= priceb; PlayerInfo[playerid][pCMats] -= pricec; PlayerInfo[playerid][pDMats] -= priced; if(weapon == 25 || weapon == 33 || weapon == 34) { GivePlayerWeaponEx(playerid, weapon, 75); } else if(GunSlot[weapon] == 8) { GivePlayerWeaponEx(playerid, weapon, 1); } else { GivePlayerWeaponEx(playerid, weapon, GunClip[weapon]*4); } PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0); if(noskill == 1) { if(PlayerInfo[playerid][pArmsSkill] <= 100) { PlayerInfo[playerid][pArmsSkill] += 1; } else { SendClientMessage(playerid, COLOR_LIGHTRED, " You didn't get any experience, because this gun is low-level."); } } else { PlayerInfo[playerid][pArmsSkill] += 1; } UpdatePlayer(playerid); PlayerMuteInfo[playerid][SellgunCool] = 10; new string[128]; format(string, sizeof(string), "* %s makes a %s and hands it to himself.", PlayerNameEx(playerid), GunName[weapon]); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); return 1; } if(ProxDetectorS(5.0, playerid, giveplayerid)) { new g,a; GetPlayerWeaponData(giveplayerid, GunSlot[weapon], g, a); if(g != weapon && a != 0)//So they can't loose their deagle etc { SendClientMessage(playerid, COLOR_LIGHTRED, " The player already has a different weapon!"); return 1; } if(a >= GunClipLimit[weapon])//Ammo limit. Usually 10 magazines { SendClientMessage(playerid, COLOR_LIGHTRED, " That player can't carry any more ammo for that weapon!"); return 1; } new giveplayer[MAX_PLAYER_NAME],sendername[MAX_PLAYER_NAME]; giveplayer = PlayerNameEx(giveplayerid); sendername = PlayerNameEx(playerid); new string[128]; format(string, sizeof(string), "* You have given %s a %s.", giveplayer, GunName[weapon]); SendClientMessage(playerid, COLOR_LIGHTGREEN, string); format(string, sizeof(string), "* You have received a %s from %s.", GunName[weapon], sendername); SendClientMessage(giveplayerid, COLOR_LIGHTGREEN, string); PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0); PlayerPlaySound(giveplayerid, 1052, 0.0, 0.0, 0.0); format(string, sizeof(string), "* %s makes a %s and hands it to %s.", sendername, GunName[weapon], giveplayer); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); if(GunSlot[weapon] == 6 || weapon == 25)//Rifles & normal shotgun { GivePlayerWeaponEx(giveplayerid, weapon, 50);//Different ammo cause they don't have clipz } else if(GunSlot[weapon] == 8) { GivePlayerWeaponEx(playerid, weapon, 1); } else { GivePlayerWeaponEx(giveplayerid, weapon, GunClip[weapon]*4); } PlayerInfo[playerid][pAMats] -= pricea; PlayerInfo[playerid][pBMats] -= priceb; PlayerInfo[playerid][pCMats] -= pricec; PlayerInfo[playerid][pDMats] -= priced; if(noskill == 1) { if(PlayerInfo[playerid][pArmsSkill] <= 100) { PlayerInfo[playerid][pArmsSkill] += 1; if(PlayerInfo[playerid][pArmsSkill] == 100) { SendClientMessage(playerid, COLOR_YELLOW, "* Your arms dealer skill is now level 2. You can create stronger weapons."); } else if(PlayerInfo[playerid][pArmsSkill] == 250) { SendClientMessage(playerid, COLOR_YELLOW, "* Your arms dealer skill is now level 3. You can create stronger weapons."); } else if(PlayerInfo[playerid][pArmsSkill] == 500) { SendClientMessage(playerid, COLOR_YELLOW, "* Your arms dealer skill is now level 4. You can create stronger weapons."); } else if(PlayerInfo[playerid][pArmsSkill] == 1000) { SendClientMessage(playerid, COLOR_YELLOW, "* Your arms dealer skill is now level 5. You can create stronger weapons."); } } else { SendClientMessage(playerid, COLOR_GREY, "You didn't get any experience, because this gun is a low level."); } } else { PlayerInfo[playerid][pArmsSkill] += 1; } PlayerMuteInfo[playerid][SellgunCool] = 10; UpdatePlayer(playerid); UpdatePlayer(giveplayerid); return 1; } else { SendClientMessage(playerid, COLOR_LIGHTRED, " You are too far away!"); return 1; } } else { SendClientMessage(playerid, COLOR_LIGHTRED, " Invalid player!"); return 1; } } else { SendClientMessage(playerid, COLOR_WHITE, "USAGE: /Sellgun [playerid/PartOfName] [Weapon name]"); SendClientMessage(playerid, COLOR_GREEN, "*** Weapons ***"); new level = PlayerInfo[playerid][pArmsSkill]; if(level >= 0) { SendClientMessage(playerid, COLOR_LIGHTBLUE, "Melee: Flowers(25 A Mats) Bat(100 A Mats) Shovel(100 A Mats)"); SendClientMessage(playerid, COLOR_LIGHTBLUE, "Light pistols: 9mm(150 A Mats)"); SendClientMessage(playerid, COLOR_LIGHTBLUE, "Shotguns: Shotgun(500 B Mats) "); } else { SendClientMessage(playerid, COLOR_WHITE, " "); } if(level >= 100) { SendClientMessage(playerid, COLOR_LIGHTBLUE, "Pistols: SD-Pistol(200 A Mats)"); SendClientMessage(playerid, COLOR_LIGHTBLUE, "Submachine guns: UZI(100 B Mats, 100 C Mats) "); } else { SendClientMessage(playerid, COLOR_WHITE, " "); } if(level >= 250) { SendClientMessage(playerid, COLOR_LIGHTBLUE, "Submachine guns: MP5(300 C Mats) "); SendClientMessage(playerid, COLOR_LIGHTBLUE, "Assault Rifles: AK47(500 A Mats, 500 C Mats)"); SendClientMessage(playerid, COLOR_LIGHTBLUE, "Heavy pistols: Desert Eagle(800 A Mats, 400 C Mats) "); } else { SendClientMessage(playerid, COLOR_WHITE, " "); } if(level >= 500) { SendClientMessage(playerid, COLOR_LIGHTBLUE, "Rifles: Rifle(600 A Mats, 600 B Mats) "); SendClientMessage(playerid, COLOR_LIGHTBLUE, "Special Assault Rifles: M4(1000 B Mats, 1000 C Mats, 15 D Mats) "); } else { SendClientMessage(playerid, COLOR_WHITE, " "); } if(level >= 1000) { SendClientMessage(playerid, COLOR_LIGHTBLUE, "Heavy Shotguns: Spas12 (1500 B Mats, 1500 C Mats, 30 D Mats) "); SendClientMessage(playerid, COLOR_LIGHTBLUE, "Special Melee: Dildo (1000 A Mats, 20 D Mats)"); SendClientMessage(playerid, COLOR_LIGHTBLUE, "Explosives: Grenade (1000 C Mats, 30 D Mats)"); } else { SendClientMessage(playerid, COLOR_WHITE, " "); } new string[128]; format(string, sizeof(string), "Materials: Type A[%d Packs] Type B[%d Packs] Type C[%d Packs] Type D[%d Packs]",PlayerInfo[playerid][pAMats],PlayerInfo[playerid][pBMats],PlayerInfo[playerid][pCMats],PlayerInfo[playerid][pDMats]); SendClientMessage(playerid, COLOR_LIGHTGREEN,string); SendClientMessage(playerid, COLOR_GREEN, "________________________________________________"); } return 1; }