SA-MP Forums Archive
New team command problem -.- - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: New team command problem -.- (/showthread.php?tid=277694)



New team command problem -.- - Rabbayazza - 18.08.2011

SO using these codes

Код:
new TEAM_POLICE;

public OnPlayerSpawn(playerid)
{
	if(GetPlayerSkin(playerid) == 105) SetPlayerTeam(playerid, TEAM_GROVE);
 	 	if(GetPlayerSkin(playerid) == 106) SetPlayerTeam(playerid, TEAM_GROVE);
 	 	 	if(GetPlayerSkin(playerid) == 107) SetPlayerTeam(playerid, TEAM_GROVE);
 	if(GetPlayerSkin(playerid) == 102) SetPlayerTeam(playerid, TEAM_BALLAS);
 	 	if(GetPlayerSkin(playerid) == 103) SetPlayerTeam(playerid, TEAM_BALLAS);
 	 	 	if(GetPlayerSkin(playerid) == 104) SetPlayerTeam(playerid, TEAM_BALLAS);
 	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(GetPlayerTeam(playerid) != TEAM_POLICE) return SendClientMessage(playerid, -1, "You can't use this as you are not in the police force.");
        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;
    }

    	if (strcmp("/cpdgate", cmdtext, true) == 0)
    {
        if(GetPlayerTeam(playerid) != TEAM_POLICE) return SendClientMessage(playerid, -1, "You can't use this as you are not in the police force.");
        if(IsPlayerInRangeOfPoint(playerid, 20, 1544.94104004,-1622.77990723,12.38281250))
    {
            MoveObject(gate, 1544.94104004,-1622.77990723,12.38281250, 4.00);
            SendClientMessage(playerid, 0xFF000000, "You have successfully closed the gate!");
    }
        return 1;
    }
I am STUMPED! It still lets people from TEAM_GROVE and TEAM_BALLAS open it.


Re: New team command problem -.- - ElieJabbour - 18.08.2011

PHP код:
if(GetPlayerTeam(playerid) == 1
Not sure, but, Replace the "1" with the Team Number and not TEAM_POLICE


Re: New team command problem -.- - Rabbayazza - 18.08.2011

Now it doesn't let any of them open it.
Code
Код:
 	if (strcmp("/opdgate", cmdtext, true) == 0)
    {
        if(GetPlayerTeam(playerid) == 0) return SendClientMessage(playerid, -1, "You can't use this as you are not a part of LAE");
        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;
    }
What's wrong?


Re: New team command problem -.- - ElieJabbour - 18.08.2011

Quote:
Originally Posted by Rabbayazza
Посмотреть сообщение
Now it doesn't let any of them open it.
Code
Код:
 	if (strcmp("/opdgate", cmdtext, true) == 0)
    {
        if(GetPlayerTeam(playerid) == 0) return SendClientMessage(playerid, -1, "You can't use this as you are not a part of LAE");
        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;
    }
What's wrong?
Edit the TEAM_POLICE to TeamID 1 then Replace

PHP код:
 if(GetPlayerTeam(playerid) == 0
0 with 1.


Re: New team command problem -.- - Rabbayazza - 18.08.2011

Thank you!!!!!!!!!


Re: New team command problem -.- - ElieJabbour - 18.08.2011

Quote:
Originally Posted by Rabbayazza
Посмотреть сообщение
Thank you!!!!!!!!!
No Problem, mate