Team commands.
#1

Код:
 new TEAM_POLICE;
Код:
  	if(GetPlayerSkin(playerid) == 280) SetPlayerTeam(playerid, TEAM_POLICE);
 	 	      if(GetPlayerSkin(playerid) == 281) SetPlayerTeam(playerid, TEAM_POLICE);
                           if(GetPlayerSkin(playerid) == 164) SetPlayerTeam(playerid, TEAM_POLICE);
				if(GetPlayerSkin(playerid) == 186) SetPlayerTeam(playerid, TEAM_POLICE);
				    if(GetPlayerSkin(playerid) == 283) SetPlayerTeam(playerid, TEAM_POLICE);
				        if(GetPlayerSkin(playerid) == 288) SetPlayerTeam(playerid, TEAM_POLICE);
				        	if(GetPlayerSkin(playerid) == 282) SetPlayerTeam(playerid, TEAM_POLICE);
Код:
     if (strcmp("/opdgate", cmdtext, true) == 0)
    {
        if(IsPlayerInRangeOfPoint(playerid, 20, 1544.94104004,-1622.77990723,12.38281250))
	{
        MoveObject(gate, 1544.63146973,-1631.57128906,12.38281250, 4.00);
        SendClientMessage(playerid, 0xFF000000, "You have successfully open the gate!");
	}
        return 1;
}
How do I make this only available to TEAM_POLICE and put in a message saying You can't use this as you are not in the police?
Reply
#2

This should do it

pawn Код:
if (strcmp("/opdgate", cmdtext, true) == 0)
    {
        if(GetPlayerTeam(playerid) != TEAM_POLICE) return SendClientMessage(playerid, -1, "You can't use this as you are not in the police");
        if(IsPlayerInRangeOfPoint(playerid, 20, 1544.94104004,-1622.77990723,12.38281250))
    {
            MoveObject(gate, 1544.63146973,-1631.57128906,12.38281250, 4.00);
            SendClientMessage(playerid, 0xFF000000, "You have successfully open the gate!");
    }
        return 1;
    }
Reply
#3

Quote:
Originally Posted by Rabbayazza
Посмотреть сообщение
Код:
 new TEAM_POLICE;
Код:
  	if(GetPlayerSkin(playerid) == 280) SetPlayerTeam(playerid, TEAM_POLICE);
 	 	      if(GetPlayerSkin(playerid) == 281) SetPlayerTeam(playerid, TEAM_POLICE);
                           if(GetPlayerSkin(playerid) == 164) SetPlayerTeam(playerid, TEAM_POLICE);
				if(GetPlayerSkin(playerid) == 186) SetPlayerTeam(playerid, TEAM_POLICE);
				    if(GetPlayerSkin(playerid) == 283) SetPlayerTeam(playerid, TEAM_POLICE);
				        if(GetPlayerSkin(playerid) == 288) SetPlayerTeam(playerid, TEAM_POLICE);
				        	if(GetPlayerSkin(playerid) == 282) SetPlayerTeam(playerid, TEAM_POLICE);
Код:
     if (strcmp("/opdgate", cmdtext, true) == 0)
    {
        if(IsPlayerInRangeOfPoint(playerid, 20, 1544.94104004,-1622.77990723,12.38281250))
	{
        MoveObject(gate, 1544.63146973,-1631.57128906,12.38281250, 4.00);
        SendClientMessage(playerid, 0xFF000000, "You have successfully open the gate!");
	}
        return 1;
}
How do I make this only available to TEAM_POLICE and put in a message saying You can't use this as you are not in the police?
PHP код:
if (strcmp("/opdgate"cmdtexttrue) == 0)
{
    if(
IsPlayerInRangeOfPoint(playerid201544.94104004,-1622.77990723,12.38281250))
    {
        if(
GetPlayerSkin(playerid) == 280 || 281 || 164 || 186 || 283 || 288 || 282)
        {
            
SendClientMessage(playerid0xFF000000"You have successfully open the gate!");
        }
    }
    else
    {
        
SendClientMessage(playerid, -1"You cannot open the gate!");
    }
    return 
1;

Untested.
Reply
#4

What's the whole point of that when you can just use
pawn Код:
if(GetPlayerTeam(playerid) != TEAM_POLICE) return SendClientMessage(playerid, -1, "You can't use this as you are not in the police");
Reply
#5

Код:
	if (strcmp("/opdgate", cmdtext, true) == 0)
    {
        if(GetPlayerTeam(playerid) != TEAM_POLICE) return SendClientMessage(playerid, -1, "You can't use this as you are not in the police");
        if(IsPlayerInRangeOfPoint(playerid, 20, 1544.94104004,-1622.77990723,12.38281250))
    {
            MoveObject(gate, 1544.63146973,-1631.57128906,12.38281250, 4.00);
            SendClientMessage(playerid, 0xFF000000, "You have successfully opened the gate!");
    }
        return 1;
    }
This still let's other people open the gate.. help?
Reply
#6

Where do you use this

if(GetPlayerSkin(playerid) == 280) SetPlayerTeam(playerid, TEAM_POLICE);
if(GetPlayerSkin(playerid) == 281) SetPlayerTeam(playerid, TEAM_POLICE);
if(GetPlayerSkin(playerid) == 164) SetPlayerTeam(playerid, TEAM_POLICE);
if(GetPlayerSkin(playerid) == 186) SetPlayerTeam(playerid, TEAM_POLICE);
if(GetPlayerSkin(playerid) == 283) SetPlayerTeam(playerid, TEAM_POLICE);
if(GetPlayerSkin(playerid) == 28 SetPlayerTeam(playerid, TEAM_POLICE);
if(GetPlayerSkin(playerid) == 282) SetPlayerTeam(playerid, TEAM_POLICE);
Reply
#7

Код:
public OnPlayerSpawn(playerid)
It's probably wrong and I've not noticed, help please.
Reply
#8

I changed that code to OnPlayerRequestClass, but to no avail, seriously needing help
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)