Beginner Question

Results 1 to 3 of 3
  1. #1
    Account Upgraded | Title Enabled! Zakhary is offline
    MemberRank
    Jan 2010 Join Date
    210Posts

    Beginner Question

    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.


  2. #2
    Proficient Member viroware is offline
    MemberRank
    Jan 2011 Join Date
    152Posts

    Re: Beginner Question

    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.

  3. #3
    Alpha Member bramdebouvere is offline
    MemberRank
    Aug 2006 Join Date
    BelgiumLocation
    2,409Posts

    Re: Beginner Question

    Quote Originally Posted by Zakhary View Post
    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



Advertisement