23.07.2013, 22:23
boas, eu tenho um gm que quando se faz login vai-se para um lobby e nesse lobby nao queria que as pessoas se atacassem. ha alguma forma de proibir isso?
forward PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z);
forward lobby(playerid);
public lobby(playerid)
{
if(PlayerToPoint(10.0,playerid,X,Y,Z))
//10.0 й o Tamanho da бrea que vai pegar, playerid й уbvio que й os players e o X , Y , Z vocк poeem as coordenadas da lobby
{
ResetPlayerWeaponsEx(playerid);
return 1;
}
return 1;
}
forward PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z);
forward lobbytimer(playerid);
public PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
{
if(IsPlayerConnected(playerid))
{
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);
//printf("DEBUG: X:%f Y:%f Z:%f",posx,posy,posz);
if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
{
return 1;
}
}
return 0;
}
public lobbytimer(playerid)
{
if(IsPlayerConnected(playerid))
{
ResetPlayerWeaponsEx(playerid);
SetPlayerHealth(playerid,100);
}
}
forward lobby(playerid);
public lobby(playerid)
{
if(PlayerToPoint(10.0,playerid,X,Y,Z))
//10.0 й o Tamanho da бrea que vai pegar, playerid й уbvio que й os players e o X , Y , Z vocк poeem as coordenadas da lobby
{
SetTimerEx("lobbytimer", 100, true, "i", playerid);
return 1;
}
else
{
KillTimer(lobbytimer);
}
return 1;
}