12.06.2011, 16:28
I'm trying to make radar system so that when a player passes by "saved coords" it gets playerspeed and shows it,but it's not working what's worng?
The clientmessage is not displayed,what's wrong,please need help ASAP(leaving in 10 minutes and I'd like to know the problem)
pawn Код:
stock GetPlayerSpeed(playerid, bool:kmh = true)
{
new
Float:xx,
Float:yy,
Float:zz,
Float:pSpeed;
if(IsPlayerInAnyVehicle(playerid))
{
GetVehicleVelocity(GetPlayerVehicleID(playerid),xx,yy,zz);
}
else
{
GetPlayerVelocity(playerid,xx,yy,zz);
}
pSpeed = floatsqroot((xx * xx) + (yy * yy) + (zz * zz));
return kmh ? floatround((pSpeed * 195.12)) : floatround((pSpeed * 121.9));
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
new vehicleid=GetPlayerVehicleID(playerid);
if(newstate == PLAYER_STATE_DRIVER)
{
SetVehicleParamsEx(vehicleid,0,0,0,0,0,0,0);
SendClientMessage(playerid,COLOR_PURPLE,"Press 2 to toggle engine");
}
if(newstate == PLAYER_STATE_DRIVER)
{
if(IsPlayerInRangeOfPoint(playerid,20.0,-2013.1947,-61.9978,35.3203))
{
GetPlayerSpeed(playerid);
new string[128];
new pName[MAX_PLAYER_NAME];
GetPlayerName(playerid,pName,sizeof(pName));
format(string,sizeof(string),"RadarInfo:%s(%d)-speed = %d",pName,playerid,GetPlayerSpeed(playerid));
SendClientMessageToAll(COLOR_BLUE,string);
}
}
return 1;
}