• Unfortunately, we have experienced significant hard drive damage that requires urgent maintenance and rebuilding. The forum will be a state of read only until we install our new drives and rebuild all the configurations needed. Please follow our Facebook page for updates, we will be back up shortly! (The forum could go offline at any given time due to the nature of the failed drives whilst awaiting the upgrades.) When you see an Incapsula error, you know we are in the process of migration.

Beginner Question

Experienced Elementalist
Joined
Jan 3, 2010
Messages
206
Reaction score
14
I started to learn pawn and i have small question.
Everything has to be under callbacks but what if i want to make something that doesn't suite any callback? For example i have a code like:

Code:
{
    new Float: health;
    new veh = GetPlayerVehicleID(playerid);

    GetVehicleHealth(veh, health);
    if (IsPlayerInVehicle(playerid, veh) && health < 900.0)
    {
    SendClientMessage(playerid, BLUE, "Your vehicle needs to be repaired!");
    }
    return 1;
}

Where to put it then? It can't be put randomly at the start i guess. How should i do it then? For example random if (){} case.
 
Junior Spellweaver
Joined
Jan 4, 2011
Messages
138
Reaction score
12
Hello, Im new to PAWN aswell. Im guessing onplayerupdate for this, Or to create a timer ongamemodeinit. Only because if you put it on lets say onplayerconnect, It only be run once. OnPlayerUpdate is run a few times a second, i think i read from a thread on samp's forum, But works for my anti-hackable money.
 
Joined
Aug 15, 2006
Messages
944
Reaction score
53
I started to learn pawn and i have small question.
Everything has to be under callbacks but what if i want to make something that doesn't suite any callback? For example i have a code like:

Code:
{
    new Float: health;
    new veh = GetPlayerVehicleID(playerid);

    GetVehicleHealth(veh, health);
    if (IsPlayerInVehicle(playerid, veh) && health < 900.0)
    {
    SendClientMessage(playerid, BLUE, "Your vehicle needs to be repaired!");
    }
    return 1;
}
Where to put it then? It can't be put randomly at the start i guess. How should i do it then? For example random if (){} case.

start a timer at the beginning of your script, and let that timer trigger a function that checks all players, checks if they are in a car, checks the car i they are in one, and displays the message
 
Back
Top