IsPlayerClose(playerid, Float:radi)
{
new Float:oldposx, Float:oldposy, Float:oldposz;
new Float:tempposx, Float:tempposy, Float:tempposz;
new Float:otherx, Float:othery, Float:otherz;
for (new i=0; i < MAX_PLAYERS; i++)
{
GetPlayerPos(playerid, oldposx, oldposy, oldposz);
GetPlayerPos(i, otherx, othery, otherz);
tempposx = (oldposx -otherx);
tempposy = (oldposy -othery);
tempposz = (oldposz -otherz);
if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
{
return 1;
}
else
{
return 0;
}
}
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/sf", cmdtext, true, 10) == 0)
{
if (IsPlayerClose(playerid,10)==0)
{
Teleport(playerid,80,-1977.1107,285.8831,35.1719,0,0);
Announcecmd(playerid,": a ido hacia /sf","asd",1,COLOR_AZUL,3);
}
return 1;
}
return 0;
}
|
Originally Posted by MDFK ERROR
gamemodes\ChrisDM.pwn(190) : warning 209: function "IsPlayerClose" should return a value
|
stock IsPlayerClose(playerid, Float:radi)
{
new Float:oldposx, Float:oldposy, Float:oldposz;
new Float:tempposx, Float:tempposy, Float:tempposz;
new Float:otherx, Float:othery, Float:otherz;
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
GetPlayerPos(playerid, oldposx, oldposy, oldposz);
GetPlayerPos(i, otherx, othery, otherz);
tempposx = (oldposx -otherx);
tempposy = (oldposy -othery);
tempposz = (oldposz -otherz);
if(((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
{
return 1;
}
}
}
return 0;
}