All pastes #167704 Raw Edit

CP:Simon

public cpp v1 · immutable
·published 2006-09-12 07:17 UTC
rendered paste body
public OnPlayerCommandText(playerid, cmdtext[]){	//------ /help		 if (strcmp(cmdtext,"/help",true)==0)	 {	 	SendClientMessage(playerid, C_PURPLE,"Cherry Poppers Deathmatch is a deathmatch created by Cherry Poppers clan.");	 	SendClientMessage(playerid, C_PURPLE,"It's mainly based in Angel Pine with small links to San Fierro and Los Santos,");	 	SendClientMessage(playerid, C_PURPLE,"this is so the city dwellers can use mod shops, banks and extra ammunations.");	 	SendClientMessage(playerid, C_PURPLE,"For command list please type '/commands\'.");	 	return 1;	 }	 	 //------ /commands	 	 if (strcmp(cmdtext,"/commands",true)==0)	 {	 	if(gTeam[playerid] == TEAM_POLICE)	 	{	 		SendClientMessage(playerid, C_PURPLE,"/arrest [id] - Arrests a player if they're within 3.0 units of your police car.");	 	}	 	else	 	{	 		SendClientMessage(playerid, C_PURPLE,"-");	 	}	 	return 1;	 }	//------ /unarrest [id]	 	new idx;	new cmd[30];    cmd = strtok(cmdtext,idx);        if (strcmp(cmd,"/unarrest",true)==0)    {		new tmp[256];		new arrestid; 	 	tmp = strtok(cmdtext, idx);		arrestid = strval(tmp);				TogglePlayerControllable(arrestid, 1);	}		//------ DEBUG: /vehicleid		if (strcmp(cmd,"/vehicleid",true)==0)    {		new string[256];		new vehicleid = GetPlayerVehicleID(playerid);			if(IsPlayerAdmin(playerid))		{		format(string, sizeof(string),"Vehicle ID: %d", vehicleid);		SendClientMessage(playerid, C_WHITE,string);		}		return 1;	}        //------ /arrest [id]    	if (strcmp(cmd,"/arrest",true)==0)	 {	 	new tmp[256];	 	new pstring[256];	 	new astring[256]; 		 	new arrestid;	 	new vehicleid = GetPlayerVehicleID(playerid);	 	new aname[MAX_PLAYER_NAME];	 	new pname[MAX_PLAYER_NAME];	 	new Float:player_x,Float:player_y,Float:player_z;	 	new Float:arrest_x,Float:arrest_y,Float:arrest_z;	 	tmp = strtok(cmdtext, idx);		arrestid = strval(tmp);				GetPlayerPos(playerid, player_x,player_y,player_z);		GetPlayerPos(arrestid, arrest_x,arrest_y,arrest_z);				GetPlayerName(playerid, pname, sizeof(pname));		GetPlayerName(arrestid, aname, sizeof(aname));				if (vehicleid != 0 && gTeam[playerid] == TEAM_POLICE)	 	{	 		if(!strlen(tmp))			{			SendClientMessage(playerid,C_RED,"ERROR: USAGE: /arrest [id]");			}				 	    else if(IsPlayerConnected(arrestid) && arrestid != playerid && player_x-arrest_x <= 3.0 && player_x-arrest_x >= -3.0 && player_y-arrest_y <= 3.0 && player_y-arrest_y >= -3.0 && player_z-arrest_z <= 10.0 && player_z-arrest_z >= -10.0)	 		{	 			if(vehicleid == 27) // Enforcer	 			{	 				PutPlayerInVehicle(arrestid,vehicleid,3);	 				TogglePlayerControllable(arrestid, 0);	 				 				format(astring, sizeof(astring),"You have been arrested by %s.",pname);	 				SendClientMessage(arrestid, C_RED, astring);	 				 				format(pstring, sizeof(pstring),"The suspect(%s) has been arrested.",pname,aname);	 				SendClientMessage(playerid, C_GREEN, pstring);	 			}	 				 			else if(vehicleid == 24 || vehicleid == 25 || vehicleid == 26 || vehicleid == 28) //SFPD Cars	 			{	 				PutPlayerInVehicle(arrestid,vehicleid,2);	 				TogglePlayerControllable(arrestid, 0);	 				 				format(astring, sizeof(astring),"You have been arrested by %s.",pname);	 				SendClientMessage(arrestid, C_RED, astring);	 				 				format(pstring, sizeof(pstring),"The suspect(%s) has been arrested.",pname,aname);	 				SendClientMessage(playerid, C_GREEN, pstring);	 			}	 				 			else	 			{	 				SendClientMessage(playerid, C_RED,"ERROR: You must be in a police vehicle to arrest.");	 			}	 		}	 			 			 		else if(IsPlayerConnected(arrestid))	 		{	 			if(player_x-arrest_x > 3.0 || player_x-arrest_x < -3.0 || player_y-arrest_y > 3.0 || player_y-arrest_y < -3.0 || player_z-arrest_z > 10.0 || player_z-arrest_z < -10.0)	 			{		 		    	SendClientMessage(playerid, C_RED,"ERROR: The criminal is to far away.");	 			}	 		}	 			 		else if(arrestid == playerid)	 		{	 			SendClientMessage(playerid, C_RED,"ERROR: You cannot arrest yourself.");	 		}	 			 		else	 		{	 			SendClientMessage(playerid, C_RED,"ERROR: Please arrest a connected player."); 		    } 		    		   return 1;	 	}	 		 	else if (gTeam[playerid] != TEAM_POLICE)	 	{	 		SendClientMessage(playerid, C_RED,"ERROR: You must be a police officer to arrest!");	 	}	 		 	else	 	{	 		SendClientMessage(playerid,C_RED,"ERROR: You must be in a vehicle to arrest!");	 	}	 	return 1;	 }	return 1;}