SA-MP Forums Archive
[HELP] Error - 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)
+--- Thread: [HELP] Error (/showthread.php?tid=516970)



[HELP] Error - monster010 - 02.06.2014

What gives me this error? I do not understand...


Код:
error 017: undefined symbol "playerid"
pawn Код:
public timer_fuel_lower()
{
    new vehicle = GetPlayerVehicleID(playerid);
    if(Engine[vehicle] == 1)
    {
    for(new i=0;i<MAX_PLAYERS;i++) { //loop for all players
        if (isrefuelling[i]) continue; //stop when a player is already refuelling
        new vid = GetPlayerVehicleID(i); //getting vehicle ID
        if (GetPlayerVehicleSeat(i) == 0) { //if the player is a driver (it should only lower the fuel when theres an driver!)
            fuelcar[vid] = fuelcar[vid] -1; //lowering fuel value
            if (fuelcar[vid]<1) //if fuel is empty
            {
                fuelcar[vid] = 0; //setting fuel to 0 (else the timer will set it to -1 -2 -3 etc before removing player)
                RemovePlayerFromVehicle(i); //remove player out of vehicle
                GameTextForPlayer(i,"~r~Ai ramas fara~w~benzina~r~!",5000,4); //show text
            }
        }
        new string[125];format(string,sizeof string,"Benzina:%i",fuelcar[vid]); //preparing string with next fuel value
        TextDrawSetString(td_fuel[i],string); //updating textdraw
    }
    }
    return 1;
}



Re: [HELP] Error - Eth - 02.06.2014

change public timer_fuel_lower() to public timer_fuel_lower(playerid)
and change forward timer_fuel_lower() to forward timer_fuel_lower(playerid)


Re: [HELP] Error - Kyance - 02.06.2014

Quote:
Originally Posted by Eth
Посмотреть сообщение
change public timer_fuel_lower() to public timer_fuel_lower(playerid)
and change forward timer_fuel_lower() to forward timer_fuel_lower(playerid)
^
+
Change the "SetTimer" to "SetTimerEx";
Information about SetTimerEx here
So, it should look like;
pawn Код:
SetTimerEx("timer_fuel_lower", /*time*/, /*repeating*/, "i", playerid);
                             //Time in MS..Repeating (0/1)