Cuff Command
#1

Im not sure if Im tripping or not. I've made a cuff command but somehow its reverted. Civilians can use it and police/army can't use it. Its quiet confusing since I used the same method for spawns and there it is working.


These are my basic defines:

Код:
new allTeams[MAX_PLAYERS];

#define TEAM_CIV 1
#define TEAM_POLICE 2
#define TEAM_SWAT 3
#define TEAM_ARMY 4
#define TEAM_MEDIC 5
#define TEAM_FF 6
#define TEAM_MAFIA 7
#define TEAM_YAKUZA 8
Код:
CMD:cuff(playerid, params[])
{	
	if(allTeams[playerid] == TEAM_POLICE) return SendClientMessage(playerid,COLOR_RED, "ERROR: You need to be a police officer or a army member!");
	if(allTeams[playerid] == TEAM_ARMY)	return SendClientMessage(playerid,COLOR_RED, "ERROR: You need to be a police officer or a army member!");
	{	
    new targetid;
    if(sscanf(params, "u", targetid)) return SendClientMessage(playerid,COLOR_RED, "ERROR: /cuff [Part of Name/Player ID]!");
    else if(targetid==playerid) return SendClientMessage(playerid,COLOR_RED, "ERROR: You can not use that on yourself!");
    else if(targetid==TEAM_ARMY) return SendClientMessage(playerid,COLOR_RED, "ERROR: You can not cuff members of the army!");
    else if(targetid==TEAM_POLICE) return SendClientMessage(playerid,COLOR_RED, "ERROR: You can not cuff police officers!");
    else if(targetid==INVALID_PLAYER_ID) return SendClientMessage(playerid,COLOR_RED, "ERROR: Invalid ID/Name or Player is not connected!");
    else if(IsPlayerInAnyVehicle(targetid)) return SendClientMessage(playerid,COLOR_RED,"ERROR: You can not cuff someone who is in a vehicle!");
    if(IsPlayerConnected(targetid)) return SendClientMessage(playerid,COLOR_RED, "ERROR: Player is not connected!");
    {
        new Float:x, Float:y, Float:z;
        GetPlayerPos(playerid, x, y, z);
        if(IsPlayerInRangeOfPoint(targetid, 5.0, x, y, z))  return SendClientMessage(playerid,COLOR_RED,"ERROR: Player is not in range to cuff!");
        {
         new str[88];

         new target[MAX_PLAYER_NAME];
         GetPlayerName(targetid, target, sizeof(target));
         format(str, sizeof(str), "Information:{FFFFFF} You have cuffed %s!",target);
         SendClientMessage(playerid,COLOR_ORANGE, str);

         SetPlayerAttachedObject(targetid, 0, 19418, 6, -0.011000, 0.028000, -0.022000, -15.600012, -33.699977,-81.700035, 0.891999, 1.000000, 1.168000);
         SetPlayerSpecialAction(targetid,SPECIAL_ACTION_CUFFED);
         TogglePlayerControllable(targetid,0);
         
         return 1;
        }

    }
    
}
	
}
As spawn code to set a player to a team I've used mSelection:

Код:
if(listid == skinscivilian)
	{
	    if(response)
	    {
		    allTeams[playerid] = TEAM_CIV;

		    SendClientMessage(playerid,COLOR_WHITE,"Faction & Skin Selected.");
	    	new civspawns = random(sizeof(CIV_RANDOM_SPAWNS));
	    	SetSpawnInfo(playerid,TEAM_CIV_SKINS,modelid,CIV_RANDOM_SPAWNS[civspawns][0],CIV_RANDOM_SPAWNS[civspawns][1],CIV_RANDOM_SPAWNS[civspawns][2],CIV_RANDOM_SPAWNS[civspawns][3],0,0,0,0,0,0);
	    	TogglePlayerSpectating(playerid,false);
	    	SendClientMessage(playerid,COLOR_WHITE,"You have selected to play as a innocent citizen.");
	    	SendClientMessage(playerid,COLOR_WHITE,"Make sure you have read our rules. You can find them under /help.");
	    	SendClientMessage(playerid,COLOR_WHITE,"Further help can be found under /help.");
	    	SetPlayerToTeamColour(playerid);

	 	    	    		   
	    }
	    else SendClientMessage(playerid,COLOR_GREY, "Selection aborted.");
	    
    	return 1;
	}
Could really use some help .-.
Reply


Messages In This Thread
Cuff Command - by Spectat0rDE - 28.05.2018, 11:16
Re: Cuff Command - by Mugala - 28.05.2018, 12:21
Re: Cuff Command - by Spectat0rDE - 28.05.2018, 12:54
Re: Cuff Command - by GTLS - 28.05.2018, 14:26
Re: Cuff Command - by Spectat0rDE - 28.05.2018, 15:24

Forum Jump:


Users browsing this thread: 2 Guest(s)