Command crashing the server
#1

Code:
/*CMD:giveitem(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin]>= 1338)
	{
		new giveplayerid, type;
		if(sscanf(params, "ud", giveplayerid, type))
		{
   			SendClientMessageEx(playerid, COLOR_LIGHTRED,"Darkside Gaming Roleplay Items");
			SendClientMessageEx(playerid, COLOR_GRAD2, "Items: [1]Screwdriver [2]SMS Log [3]Wristwatch [4]Surveillance Camera [5]Tire");
			SendClientMessageEx(playerid, COLOR_GRAD2, "Items: [6] First Aid Kit [7]RC Cam [8]Receiver [9] = GPS [10] Bug Sweep [11] Mask");
			SendClientMessageEx(playerid, COLOR_GRAD2, "Items: [12] Mailbox");
			return 1;
		}

		if(!IsPlayerConnected(giveplayerid))
		{
			SendClientMessageEx(playerid, COLOR_GRAD2, "Invalid player specified.");
			return 1;
		}
		switch(type)
		{
			case 1:
			{
				PlayerInfo[giveplayerid][pScrewdriver]++;
				SendClientMessageEx(giveplayerid, COLOR_WHITE, "You have been given a screwdriver /sellgun");
				SendClientMessageEx(playerid, COLOR_WHITE, "You have gave them a Screwdriver");
				return 1;
			}
			case 2:
			{
				PlayerInfo[giveplayerid][pSmslog]++;
    			SendClientMessageEx(giveplayerid, COLOR_WHITE, "You have been given a SMS log /smslog");
				SendClientMessageEx(playerid, COLOR_WHITE, "You have gave %s a SMS log", GetPlayerNameEx(giveplayerid));

				return 1;
			}
			case 3:
			{
				PlayerInfo[giveplayerid][pWristwatch]++;
 				SendClientMessageEx(giveplayerid, COLOR_WHITE, "You have been given a wristwatch /wristwatch");
				SendClientMessageEx(playerid, COLOR_WHITE, "You have gave %s a wristwatch", GetPlayerNameEx(giveplayerid));
				return 1;
			}
			case 4:
			{
				PlayerInfo[giveplayerid][pSurveillance]++;
				SendClientMessageEx(giveplayerid, COLOR_WHITE, "You have been given a Surveillance Camera.");
				SendClientMessageEx(giveplayerid, COLOR_WHITE, "Available Commands: /(p)lace©amera /(s)ee©amera /(d)estroy©amera");
				SendClientMessageEx(playerid, COLOR_WHITE, "You have gave %s a Surveillance Camera", GetPlayerNameEx(giveplayerid));
		        return 1;
			}
			case 5:
			{
				PlayerInfo[giveplayerid][pTire]++;
				SendClientMessageEx(giveplayerid, COLOR_WHITE, "You have been given 4x fresh tires.");
				SendClientMessageEx(giveplayerid, COLOR_WHITE, "Available Commands: /repair");
				SendClientMessageEx(playerid, COLOR_WHITE, "You have gave %s 4x fresh tires", GetPlayerNameEx(giveplayerid));
				return 1;
			}
			case 6:
			{
				PlayerInfo[giveplayerid][pFirstaid]++;
				SendClientMessageEx(giveplayerid, COLOR_WHITE, "You have been given a first aid kit");
				SendClientMessageEx(giveplayerid, COLOR_WHITE, "Available Commands: /firstaid");
				SendClientMessageEx(playerid, COLOR_WHITE, "You have gave %s a first aid kit", GetPlayerNameEx(giveplayerid));
				return 1;
			}
			case 7:
			{
				PlayerInfo[giveplayerid][pRccam]++;
				SendClientMessageEx(giveplayerid, COLOR_WHITE, "You have been given a RC Cam");
				SendClientMessageEx(giveplayerid, COLOR_WHITE, "Available Commands: /rccam");
				SendClientMessageEx(playerid, COLOR_WHITE, "You have gave %s a RC Cam", GetPlayerNameEx(giveplayerid));
				return 1;
			}
			case 8:
			{
				PlayerInfo[giveplayerid][pReceiver]++;
				SetPVarInt(giveplayerid, "pReceiverMLeft", 4);
				SendClientMessageEx(giveplayerid, COLOR_WHITE, "You have been given a receiver");
				SendClientMessageEx(giveplayerid, COLOR_WHITE, "Info: You will receive the next four department radio messages");
				SendClientMessageEx(playerid, COLOR_WHITE, "You have gave %s a receiver", GetPlayerNameEx(giveplayerid));
				return 1;
			}
			case 9:
			{
				PlayerInfo[giveplayerid][pGPS]++;
				SendClientMessageEx(giveplayerid, COLOR_WHITE, "You have been given a GPS");
				SendClientMessageEx(giveplayerid, COLOR_WHITE, "Available Commands: /GPS");
				SendClientMessageEx(playerid, COLOR_WHITE, "You have gave %s a GPS", GetPlayerNameEx(giveplayerid));
				return 1;
			}
			case 10:
			{
				PlayerInfo[giveplayerid][pSweep]++;
				PlayerInfo[giveplayerid][pSweepLeft] = 3;
				SendClientMessageEx(giveplayerid, COLOR_WHITE, "You have been given a sweeper");
				SendClientMessageEx(giveplayerid, COLOR_WHITE, "Available Commands: /sweep");
				SendClientMessageEx(playerid, COLOR_WHITE, "You have gave %s a sweeper", GetPlayerNameEx(giveplayerid));
				return 1;
			}
			case 11:
			{
				PlayerInfo[giveplayerid][pMask] = 1;
				SendClientMessageEx(giveplayerid, COLOR_WHITE, "You have been given a mask");
				SendClientMessageEx(giveplayerid, COLOR_WHITE, "Available Commands: /mask [wear,remove]");
				SendClientMessageEx(playerid, COLOR_WHITE, "You have gave %s a mask", GetPlayerNameEx(giveplayerid));
				return 1;
			}
			case 12:
			{
				PlayerInfo[playerid][pMailbox]++;
				SendClientMessageEx(giveplayerid, COLOR_WHITE, "You have been given a mailbox");
				SendClientMessageEx(giveplayerid, COLOR_WHITE, "Available Commands: /placemailbox");
				SendClientMessageEx(playerid, COLOR_WHITE, "You have gave %s a mailbox", GetPlayerNameEx(giveplayerid));
				return 1;
			}
			default:
			{
   			SendClientMessageEx(playerid, COLOR_LIGHTRED,"Darkside Gaming Items");
			SendClientMessageEx(playerid, COLOR_GRAD2, "Items: [1]Screwdriver [2]SMS Log [3]Wristwatch [4]Surveillance Camera [5]Tire");
			SendClientMessageEx(playerid, COLOR_GRAD2, "Items: [6] First Aid Kit [7]RC Cam [8]Receiver [9] = GPS [10] Bug Sweep [11] Mask");
			SendClientMessageEx(playerid, COLOR_GRAD2, "Items: [12] Mailbox");
			}
		}
	}
	else SendClientMessageEx(playerid, COLOR_GREY, "You're not authorised to use this command.");
	return 1;
}*/
Reply
#2

Use the plugin CrashDetect to troubleshoot this problem more accurately.
Reply
#3

May I ask why you are using SendClientMessageEx?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)