22.05.2009, 11:49
Код:
#define TEAM_LVPD 1
new gTeam[MAX_PLAYERS];
public OnGameModeInit()
{
gatelvpd1 = CreateObject(969, 2238.020264, 2450.397705, 9.976515, 0.0000, 0.0000, 89.3814);
SetTimer("Neargatelvpd1", 500, true);
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp("/teamlvpd0152", cmdtext, true, 13) == 0)
{
gTeam[playerid] = TEAM_LVPD;
SendClientMessage(playerid, 0x00FF00FF, "You are now LVPD");
return 1;
}
}
forward Neargatelvpd1(playerid);
forward PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z);
public Neargatelvpd1(playerid)
{
for(new i=0; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(PlayerToPoint(10.0, i, 2238.3220,2453.8621,10.8203) && GetPlayerTeam(playerid) == TEAM_LVPD)
{
MoveObject(gatelvpd1, 2238.114014, 2457.015137, 9.959967, 3.5);
}
else
{
MoveObject(gatelvpd1, 2238.020264, 2450.397705, 9.976515, 3.5);
}
}
}
}
public PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
{
new Float:oldposx, Float:oldposy, Float:oldposz;
new Float:tempposx, Float:tempposy, Float:tempposz;
GetPlayerPos(playerid, oldposx, oldposy, oldposz);
tempposx = (oldposx -x);
tempposy = (oldposy -y);
tempposz = (oldposz -z);
if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
{
return 1;
}
return 0;
}
The gate won't open when I typed /teamlvpd0152 and when I'm near the gate ofc...
Greetz Rizzy



