SA-MP Forums Archive
GetVehicleSpeed help.. - 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: GetVehicleSpeed help.. (/showthread.php?tid=184839)



GetVehicleSpeed help.. - Luis- - 21.10.2010

pawn Код:
public OnPlayerUpdate(playerid)
{
    new vehicleid = GetPlayerVehicleID(playerid);
    if (IsPlayerInAnyVehicle(playerid))
    if (GetVehicleSpeed(vehicleid) <= 110)
    {
        SendClientMessage(playerid, COLOR_ALERT, "You are going to fast!");
        return 1;
    }
    return 1;
}
I need it to send that message when a player is going to fast but it only sends it when I enter a vehicle?


Re: GetVehicleSpeed help.. - Guest3598475934857938411 - 21.10.2010

Код:
public OnPlayerUpdate(playerid)
{
    new vehicleid = GetPlayerVehicleID(playerid);
    if (IsPlayerInAnyVehicle(playerid))
    {
    
    if (GetVehicleSpeed(vehicleid) <= 110)
    {
        SendClientMessage(playerid, COLOR_ALERT, "You are going to fast!");
        return 1;
    }
    }

    return 1;
}



Re: GetVehicleSpeed help.. - Cameltoe - 21.10.2010

pawn Код:
public OnPlayerUpdate(playerid)
{
    if(IsPlayerInAnyVehicle(playerid))
    {
        if (GetVehicleSpeed(GetPlayerVehicleID(playerid)) >= 110)
        {
            SendClientMessage(playerid, COLOR_ALERT, "You are going to fast!");
        }
    }
    return 1;
}
Should work.


Re: GetVehicleSpeed help.. - -Sneaky- - 21.10.2010

It's probably cause you are checking if the player speed is less or equal to 110? Try changening the <= to >.


Re: GetVehicleSpeed help.. - Luis- - 21.10.2010

I'll try that


Re: GetVehicleSpeed help.. - Luis- - 21.10.2010

I used Cameltoes code and now It does not work at all


Re: GetVehicleSpeed help.. - Luis- - 21.10.2010

Sorry about this but it still does not work.. :/


Re: GetVehicleSpeed help.. - Luis- - 21.10.2010

Wow it now works but it kinda spams my screen with the message..?


Respuesta: Re: GetVehicleSpeed help.. - The_Moddler - 22.10.2010

Quote:
Originally Posted by -Luis
Посмотреть сообщение
Wow it now works but it kinda spams my screen with the message..?
Of course it will spam.. OnPlayerUpdate is called like 32 times in a second.. so in 5 seconds you have 160 MESSAGES!!

Make a timer like they told you..


Re: GetVehicleSpeed help.. - Luis- - 22.10.2010

I tried with a timer but i fail..