Server stops
#1

The server stops when i use this command.:

Код:
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;
			}
			new x_weapon[256],weapon[MAX_PLAYERS],ammo[MAX_PLAYERS],price[MAX_PLAYERS];
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_SACBLUE, "________________________________________________");
				SendClientMessage(playerid, COLOR_WHITE, "*** Sell Guns ***");
				SendClientMessage(playerid, COLOR_GREY, "USAGE: /sellgun [playerid/PartOfName] [weaponname]");
				SendClientMessage(playerid, COLOR_GREY, "Level 1 Weapons: Flowers(400) Sdpistol(2,000) 9mm(2,500)");
				if(PlayerInfo[playerid][pArmsSkill] >= 50)
				{
  					SendClientMessage(playerid, COLOR_GREY, "Level 2 Weapons: Shotgun(5,000) Mp5(6,000) Rifle(6,000)");
				}
				if(PlayerInfo[playerid][pArmsSkill] >= 100)
				{
  					SendClientMessage(playerid, COLOR_GREY, "Level 3 Weapons: Eagle(6,500) Ak47(7,000) M4(7,500)");
				}
				if(PlayerInfo[playerid][pArmsSkill] >= 200)
				{
  					SendClientMessage(playerid, COLOR_GREY, "Level 4 Weapons: Sawnoff(8,000) MircoSMG(8,500) Tec9(9,000)");
				}
				if(PlayerInfo[playerid][pArmsSkill] >= 400)
				{
  					SendClientMessage(playerid, COLOR_GREY, "Level 5 Weapons: Spaz(12,000) SRifle(12,000)");
				}
				SendClientMessage(playerid, COLOR_SACBLUE, "________________________________________________");
				return 1;
			}
			giveplayerid = ReturnUser(tmp);
			if (IsPlayerConnected(giveplayerid))
			{
			    if(giveplayerid != INVALID_PLAYER_ID)
			    {
					x_weapon = strtok(cmdtext, idx);
					if(!strlen(x_weapon))
					{
						SendClientMessage(playerid, COLOR_SACBLUE, "________________________________________________");
						SendClientMessage(playerid, COLOR_WHITE, "*** Sell Guns ***");
						SendClientMessage(playerid, COLOR_GREY, "USAGE: /sellgun [playerid/PartOfName] [weaponname]");
						SendClientMessage(playerid, COLOR_GREY, "Level 1 Weapons: Flowers(400) Sdpistol(2,000) 9mm(2,500)");
						if(PlayerInfo[playerid][pArmsSkill] >= 50)
						{
  							SendClientMessage(playerid, COLOR_GREY, "Level 2 Weapons: Shotgun(5,000) Mp5(6,000) Rifle(6,000)");
						}
						if(PlayerInfo[playerid][pArmsSkill] >= 100)
						{
  							SendClientMessage(playerid, COLOR_GREY, "Level 3 Weapons: Eagle(6,500) Ak47(7,000) M4(7,500)");
						}
						if(PlayerInfo[playerid][pArmsSkill] >= 200)
						{
  							SendClientMessage(playerid, COLOR_GREY, "Level 4 Weapons: Sawnoff(8,000) MircoSMG(8,500) Tec9(9,000)");
						}
						if(PlayerInfo[playerid][pArmsSkill] >= 400)
						{
  							SendClientMessage(playerid, COLOR_GREY, "Level 5 Weapons: Spaz(12,000) SRifle(12,000)");
						}
						SendClientMessage(playerid, COLOR_SACBLUE, "________________________________________________");
						return 1;
					}
				}
				if(strcmp(x_weapon,"sdpistol",true) == 0) { if(PlayerInfo[playerid][pMats] > 1999 && PlayerInfo[playerid][pArmsSkill] >= 0 && GetPlayerWeapon(playerid) != 23) { weapon[playerid] = 23; price[playerid] = 2000; ammo[playerid] = 999999; PlayerInfo[giveplayerid][pGun2] = 23; PlayerInfo[giveplayerid][pAmmo2] = 999999; } else { SendClientMessage(playerid,COLOR_GREY,"   Not enough Materials for that Weapon / Incorrect Level or Player already has that Weapon!"); return 1; } }
				else if(strcmp(x_weapon,"flowers",true) == 0) { if(PlayerInfo[playerid][pMats] > 399 && PlayerInfo[playerid][pArmsSkill] >= 0 && GetPlayerWeapon(playerid) != 14) { weapon[playerid] = 14; price[playerid] = 400; ammo[playerid] = 1; PlayerInfo[giveplayerid][pGun1] = 14; PlayerInfo[giveplayerid][pAmmo1] = 1; } else { SendClientMessage(playerid,COLOR_GREY,"   Not enough Materials for that Weapon / Incorrect Level or Player already has that Weapon!"); return 1; } }
				else if(strcmp(x_weapon,"eagle",true) == 0) { if(PlayerInfo[playerid][pMats] > 6499 && PlayerInfo[playerid][pArmsSkill] >= 100 && GetPlayerWeapon(playerid) != 24) { weapon[playerid] = 24; price[playerid] = 6500; ammo[playerid] = 999999; PlayerInfo[giveplayerid][pGun2] = 24; PlayerInfo[giveplayerid][pAmmo2] = 999999; } else { SendClientMessage(playerid,COLOR_GREY,"   Not enough Materials for that Weapon / Incorrect Level or Player already has that Weapon!"); return 1; } }
				else if(strcmp(x_weapon,"mp5",true) == 0) {	if(PlayerInfo[playerid][pMats] > 5999 && PlayerInfo[playerid][pArmsSkill] >= 50 && GetPlayerWeapon(playerid) != 29) { weapon[playerid] = 29; price[playerid] = 6000; ammo[playerid] = 999999; PlayerInfo[giveplayerid][pGun2] = 29; PlayerInfo[giveplayerid][pAmmo2] = 999999; } else { SendClientMessage(playerid,COLOR_GREY,"   Not enough Materials for that Weapon / Incorrect Level or Player already has that Weapon!"); return 1; } }
				else if(strcmp(x_weapon,"shotgun",true) == 0) {	if(PlayerInfo[playerid][pMats] > 4999 && PlayerInfo[playerid][pArmsSkill] >= 50 && GetPlayerWeapon(playerid) != 25) { weapon[playerid] = 25; price[playerid] = 5000; ammo[playerid] = 999999; PlayerInfo[giveplayerid][pGun2] = 25; PlayerInfo[giveplayerid][pAmmo2] = 999999; } else { SendClientMessage(playerid,COLOR_GREY,"   Not enough Materials for that Weapon / Incorrect Level or Player already has that Weapon!"); return 1; } }
				else if(strcmp(x_weapon,"ak47",true) == 0) { if(PlayerInfo[playerid][pMats] > 6999 && PlayerInfo[playerid][pArmsSkill] >= 100 && GetPlayerWeapon(playerid) != 30) { weapon[playerid] = 30; price[playerid] = 7000; ammo[playerid] = 999999; PlayerInfo[giveplayerid][pGun2] = 30; PlayerInfo[giveplayerid][pAmmo2] = 999999; } else { SendClientMessage(playerid,COLOR_GREY,"   Not enough Materials for that Weapon / Incorrect Level or Player already has that Weapon!"); return 1; } }
				else if(strcmp(x_weapon,"m4",true) == 0) { if(PlayerInfo[playerid][pMats] > 7499 && PlayerInfo[playerid][pArmsSkill] >= 100 && GetPlayerWeapon(playerid) != 31) { weapon[playerid] = 31; price[playerid] = 7500; ammo[playerid] = 999999; PlayerInfo[giveplayerid][pGun2] = 31; PlayerInfo[giveplayerid][pAmmo2] = 999999; } else { SendClientMessage(playerid,COLOR_GREY,"   Not enough Materials for that Weapon / Incorrect Level or Player already has that Weapon!"); return 1; } }
				else if(strcmp(x_weapon,"rifle",true) == 0) { if(PlayerInfo[playerid][pMats] > 5999 && PlayerInfo[playerid][pArmsSkill] >= 50 && GetPlayerWeapon(playerid) != 33) { weapon[playerid] = 33; price[playerid] = 6000; ammo[playerid] = 999999; PlayerInfo[giveplayerid][pGun2] = 33; PlayerInfo[giveplayerid][pAmmo2] = 999999; } else { SendClientMessage(playerid,COLOR_GREY,"   Not enough Materials for that Weapon / Incorrect Level or Player already has that Weapon!"); return 1; } }
				else if(strcmp(x_weapon,"9mm",true) == 0) { if(PlayerInfo[playerid][pMats] > 2499 && PlayerInfo[playerid][pArmsSkill] >= 0 && GetPlayerWeapon(playerid) != 22) { weapon[playerid] = 22; price[playerid] = 2500; ammo[playerid] = 999999; PlayerInfo[giveplayerid][pGun2] = 22; PlayerInfo[giveplayerid][pAmmo2] = 999999; } else { SendClientMessage(playerid,COLOR_GREY,"   Not enough Materials for that Weapon / Incorrect Level or Player already has that Weapon!"); return 1; } }
                else if(strcmp(x_weapon,"sawnoff",true) == 0) { if(PlayerInfo[playerid][pMats] > 7999 && PlayerInfo[playerid][pArmsSkill] >= 200 && GetPlayerWeapon(playerid) != 26) { weapon[playerid] = 26; price[playerid] = 8000; ammo[playerid] = 999999; PlayerInfo[giveplayerid][pGun2] = 26; PlayerInfo[giveplayerid][pAmmo2] = 999999; } else { SendClientMessage(playerid,COLOR_GREY,"   Not enough Materials for that Weapon / Incorrect Level or Player already has that Weapon!"); return 1; } }
                else if(strcmp(x_weapon,"microsmg",true) == 0) { if(PlayerInfo[playerid][pMats] > 8499 && PlayerInfo[playerid][pArmsSkill] >= 200 && GetPlayerWeapon(playerid) != 28) { weapon[playerid] = 28; price[playerid] = 8500; ammo[playerid] = 999999; PlayerInfo[giveplayerid][pGun2] = 28; PlayerInfo[giveplayerid][pAmmo2] = 999999; } else { SendClientMessage(playerid,COLOR_GREY,"   Not enough Materials for that Weapon / Incorrect Level or Player already has that Weapon!"); return 1; } }
                else if(strcmp(x_weapon,"tec9",true) == 0) { if(PlayerInfo[playerid][pMats] > 8999 && PlayerInfo[playerid][pArmsSkill] >= 200 && GetPlayerWeapon(playerid) != 32) { weapon[playerid] = 32; price[playerid] = 9000; ammo[playerid] = 999999; PlayerInfo[giveplayerid][pGun2] = 32; PlayerInfo[giveplayerid][pAmmo2] = 999999; } else { SendClientMessage(playerid,COLOR_GREY,"   Not enough Materials for that Weapon / Incorrect Level or Player already has that Weapon!"); return 1; } }
                else if(strcmp(x_weapon,"spaz",true) == 0) { if(PlayerInfo[playerid][pMats] > 9999 && PlayerInfo[playerid][pArmsSkill] >= 400 && GetPlayerWeapon(playerid) != 27) { weapon[playerid] = 27; price[playerid] = 12000; ammo[playerid] = 999999; PlayerInfo[giveplayerid][pGun2] = 27; PlayerInfo[giveplayerid][pAmmo2] = 999999; } else { SendClientMessage(playerid,COLOR_GREY,"   Not enough Materials for that Weapon / Incorrect Level or Player already has that Weapon!"); return 1; } }
                else if(strcmp(x_weapon,"srifle",true) == 0) { if(PlayerInfo[playerid][pMats] > 9999 && PlayerInfo[playerid][pArmsSkill] >= 400 && GetPlayerWeapon(playerid) != 34) { weapon[playerid] = 34; price[playerid] = 12000; ammo[playerid] = 999999; PlayerInfo[giveplayerid][pGun2] = 34; PlayerInfo[giveplayerid][pAmmo2] = 999999; } else { SendClientMessage(playerid,COLOR_GREY,"   Not enough Materials for that Weapon / Incorrect Level or Player already has that Weapon!"); return 1; } }
				else { SendClientMessage(playerid,COLOR_GREY,"   Invalid Weapon name!"); return 1; }
				if (ProxDetectorS(5.0, playerid, giveplayerid))
				{
					if(PlayerInfo[playerid][pMiserPerk] > 0)
					{
					    new skill = 2 * PlayerInfo[playerid][pMiserPerk];
					    new mats = price[playerid] / 100;
					    price[playerid] -= (mats)*(skill);
					}
					if(jobTime[playerid] != 0)
   					{
			        	SendClientMessage(playerid, COLOR_GREY, "   You cannot sell guns that fast, please wait a minute !");
			        	return 1;
   					}
					ConsumingMoney[playerid] = 1;
					GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
					GetPlayerName(playerid, sendername, sizeof(sendername));
					format(string, sizeof(string), "   You have given %s, a %s with unlimited ammo, for %d Materials.", giveplayer,x_weapon, price[playerid]);
					PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
					SendClientMessage(playerid, COLOR_GRAD1, string);
					format(string, sizeof(string), "   You have recieved a %s with unlimited ammo from %s.", x_weapon, sendername);
					SendClientMessage(giveplayerid, COLOR_GRAD1, string);
					PlayerPlaySound(giveplayerid, 1052, 0.0, 0.0, 0.0);
					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);
					GivePlayerWeapon(giveplayerid,weapon[playerid],ammo[playerid]);
					PlayerInfo[playerid][pMats] -= price[playerid];
					PlayerInfo[playerid][pArmsSkill] ++;
					jobTime[playerid] = 60;
					if(PlayerInfo[playerid][pArmsSkill] == 50)
					{ SendClientMessage(playerid, COLOR_SACBLUE, "* Your Arms Dealer Skill is now Level 2, you can now go on Route 3, and sell more guns."); }
					else if(PlayerInfo[playerid][pArmsSkill] == 100)
					{ SendClientMessage(playerid, COLOR_SACBLUE, "* Your Arms Dealer Skill is now Level 3, you can now go on Route 4, and sell more guns."); }
					else if(PlayerInfo[playerid][pArmsSkill] == 200)
					{ SendClientMessage(playerid, COLOR_SACBLUE, "* Your Arms Dealer Skill is now Level 4, you can now go on Route 5, and sell more guns."); }
					else if(PlayerInfo[playerid][pArmsSkill] == 400)
					{ SendClientMessage(playerid, COLOR_SACBLUE, "* Your Arms Dealer Skill is now Level 5, you can now go on Route 6, and sell more guns."); }
				}
				else
				{
					SendClientMessage(playerid, COLOR_GRAD1, "   Your too far away.");
					return 1;
				}
			}
			else
			{
				format(string, sizeof(string), "   %d is not an active player.", giveplayerid);
				SendClientMessage(playerid, COLOR_GRAD1, string);
			}
		}
		return 1;
	}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)