What's wrong here?
#1

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)
Reply
#2

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));}
Reply
#3

other sugestions please?
Reply
#4

Код:
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;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)