SA-MP Forums Archive
Help gate TDM - 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)
+--- Thread: Help gate TDM (/showthread.php?tid=637707)



Help gate TDM - CDGlock - 19.07.2017

Good, I have a small doubt, I hope they guide me to solve my problem.


I have a gate that opens for a Key, but I want that gate to be opened only by the TEAM GROOVE, that the others can not.


Код:
new idEquipo[MAX_PLAYERS]; 
#define Ballas 0
#define Groove 1
#define Astecaz 2
#define Militares 3
#define Vagos 4
#define Policia 5
#define Mafia 6
#define Motoqueros 7

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(pressed(KEY_ANALOG_RIGHT)) 
{
    if(IsPlayerInRangeOfPoint(playerid,30, 2496.386,-1742.320,15.883)) 
    {

        MoveObject(Puerta,2496.386,-1742.320,5.883, 8.0);
        SetTimer("CerrarPuerta", 7000, true); 
    }
}
	return 1;
}

forward CerrarPuerta(playerid);
public CerrarPuerta(playerid)
{
	  MoveObject(Puerta,2496.386,-1742.320,15.883,2.0); 
	  return 1;
}



Re: Help gate TDM - Kane - 19.07.2017

Simply use GetPlayerTeam().


PHP код:
if(pressed(KEY_ANALOG_RIGHT)) 
{
    if(
IsPlayerInRangeOfPoint(playerid,302496.386,-1742.320,15.883)) 
    {
        if(
GetPlayerTeam(playerid) == Groove)
        {
             
MoveObject(Puerta,2496.386,-1742.320,5.8838.0);
             
SetTimer("CerrarPuerta"7000true); 
        }
    }




Respuesta: Re: Help gate TDM - CDGlock - 19.07.2017

Quote:
Originally Posted by Arthur Kane
Посмотреть сообщение
Simply use GetPlayerTeam().


PHP код:
if(pressed(KEY_ANALOG_RIGHT)) 
{
    if(
IsPlayerInRangeOfPoint(playerid,302496.386,-1742.320,15.883)) 
    {
        if(
GetPlayerTeam(playerid) == Groove)
        {
             
MoveObject(Puerta,2496.386,-1742.320,5.8838.0);
             
SetTimer("CerrarPuerta"7000true); 
        }
    }

Thanks for your help.