11.08.2012, 11:09
Try
pawn Code:
public ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5)
{
if(IsPlayerConnected(playerid) && GetPlayerState(playerid) != PLAYER_STATE_SPECTATING)
{
new Float:posx, Float:posy, Float:posz;
new Float:oldposx, Float:oldposy, Float:oldposz;
new Float:tempposx, Float:tempposy, Float:tempposz;
new result[128];format(result, 128, "%s", string);
GetPlayerPos(playerid, oldposx, oldposy, oldposz);
//radi = 2.0; //Trigger Radius
foreach(Player, i)
if(GetPlayerInterior(playerid) == GetPlayerInterior(i))
if(!BigEar[i])
{
GetPlayerPos(i, posx, posy, posz);
tempposx = (oldposx -posx);
tempposy = (oldposy -posy);
tempposz = (oldposz -posz);
if(((tempposx < floatdiv(radi,16)) && (tempposx > -floatdiv(radi,16))) && ((tempposy < floatdiv(radi,16)) && (tempposy > -floatdiv(radi,16))) && ((tempposz < floatdiv(radi,16)) && (tempposz > -floatdiv(radi,16))))
{
SendClientMessage(i, col1, result); // <- this line makes the crash
}
else if(((tempposx < floatdiv(radi,8)) && (tempposx > -floatdiv(radi,8))) && ((tempposy < floatdiv(radi,8)) && (tempposy > -floatdiv(radi,8))) && ((tempposz < floatdiv(radi,8)) && (tempposz > -floatdiv(radi,8))))
{
SendClientMessage(i, col2, result);
}
else if(((tempposx < floatdiv(radi,4)) && (tempposx > -floatdiv(radi,4))) && ((tempposy < floatdiv(radi,4)) && (tempposy > -floatdiv(radi,4))) && ((tempposz < floatdiv(radi,4)) && (tempposz > -floatdiv(radi,4))))
{
SendClientMessage(i, col3, result);
}
else if(((tempposx < floatdiv(radi,2)) && (tempposx > -floatdiv(radi,2))) && ((tempposy < floatdiv(radi,2)) && (tempposy > -floatdiv(radi,2))) && ((tempposz < floatdiv(radi,2)) && (tempposz > -floatdiv(radi,2))))
{
SendClientMessage(i, col4, result);
}
else if(((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
{
SendClientMessage(i, col5, result);
}
}
else
{
SendClientMessage(i, col1, result);
}
}
return 1;
}