GetVehicleSpeed help..
#1

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

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

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.
Reply
#4

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

I'll try that
Reply
#6

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

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

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

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..
Reply
#10

I tried with a timer but i fail..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)