/fixveh help
#4

This might be confusing for a beginner, but I have a solution for such commands/parts of script using only one native function.

pawn Код:
if(!strcmp(cmd, "/fixveh", true))
{
    new vID = GetPlayerVehicleID(playerid);
    if(vID != 0)
    {
        RepairVehicle(vID);
    }
    return 1;
}
What's the benefit from this? You might start arguing me over the necessity of such "optimization", but theoretically speaking this is faster than a command that first calls IsPlayerInAnyVehicle and then GetPlayerVehicleID. And further on, if you're going to do more things with the vehicle ID, you're going to need to store it in a variable anyways (or it would be good to do so).

GetPlayerVehicleID(playerid) returns 0 when the player isn't in a vehicle, so this is an helpful thing to keep in mind.
Reply


Messages In This Thread
/fixveh help - by darkvsoul36 - 12.05.2012, 20:46
Re: /fixveh help - by SnG.Scot_MisCuDI - 12.05.2012, 20:51
Re: /fixveh help - by Mimic - 12.05.2012, 20:52
Re: /fixveh help - by AndreT - 12.05.2012, 20:56
Re: /fixveh help - by darkvsoul36 - 12.05.2012, 20:56
Re: /fixveh help - by sniperwars - 12.05.2012, 21:00
Re: /fixveh help - by RedWingz - 12.05.2012, 21:13
Re: /fixveh help - by darkvsoul36 - 14.05.2012, 17:55
Re: /fixveh help - by Faisal_khan - 14.05.2012, 18:01
Re: /fixveh help - by darkvsoul36 - 14.05.2012, 18:08

Forum Jump:


Users browsing this thread: 1 Guest(s)