What's wrong here? - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: What's wrong here? (
/showthread.php?tid=261224)
What's wrong here? -
Cjgogo - 12.06.2011
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?
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;
}
The clientmessage is not displayed,what's wrong,please need help ASAP(leaving in 10 minutes and I'd like to know the problem)
Re: What's wrong here? -
Bmxerlmao5288 - 13.06.2011
It seems Like Someone Around Here You Would Need A Timer Around The First Segments
Код:
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));}
Re: What's wrong here? -
Cjgogo - 13.06.2011
other sugestions please?
Re: What's wrong here? -
Skaizo - 13.06.2011
Код:
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))
{
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,true),GetPlayerSpeed(playerid,false));
SendClientMessageToAll(COLOR_BLUE,string);
}
}
return 1;
}