SA-MP Forums Archive
[HELP] How To Make This Paint Job To Be Colored Once? - 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] How To Make This Paint Job To Be Colored Once? (/showthread.php?tid=389165)



[HELP] How To Make This Paint Job To Be Colored Once? - Danyal - 01.11.2012

here is code:
pawn Код:
stock IsPlayerNearPaintShop(playerid)
{
    new vehicleid = GetPlayerVehicleID(playerid);
    if(IsPlayerInRangeOfPoint(playerid, 4, 2032.47, 1418.05, 9.82))
    {
        if(IsPlayerInVehicle(playerid, vehicleid))
        {
            new colora = random(255);
            new colorb = random(255);
            ChangeVehicleColor(vehicleid, colora, colorb);
        }
        return true;
    }
    return true;
}
i want car to change car paint only once if i am in range of point...

the above posted code changes color very often if i am i in rage of point i want paint job to be changed once if i leave or may not leave place
[SORRY FOR MEH BAD ENGLISH]


Re: [HELP] How To Make This Paint Job To Be Colored Once? - NewerthRoleplay - 01.11.2012

I believe you should use this callback https://sampwiki.blast.hk/wiki/OnVehicleRespraywith the modification that SA-MP wiki says to use however pastebin is down for me at this current point in time.

-Howelley


Re: [HELP] How To Make This Paint Job To Be Colored Once? - rjjj - 01.11.2012

This should solve your problem :


pawn Код:
stock IsPlayerNearPaintShop(playerid)
{
    new vehicleid = GetPlayerVehicleID(playerid);
    if(IsPlayerInRangeOfPoint(playerid, 4, 2032.47, 1418.05, 9.82))
    {
        if(IsPlayerInVehicle(playerid, vehicleid))
        {
            if(!GetPVarInt(playerid, "Once"))
            {
                new colora = random(255);
                new colorb = random(255);
                ChangeVehicleColor(vehicleid, colora, colorb);
                SetPVarInt(playerid, "Once", true);
            }
        }
        return true;
    }
    return true;
}


I hope that I have helped .


Re: [HELP] How To Make This Paint Job To Be Colored Once? - Danyal - 01.11.2012

i am using this on player update...

SOLVED


Re: [HELP] How To Make This Paint Job To Be Colored Once? - Danyal - 01.11.2012

Thanks ****** that worked but some time color isnt changed it doesnt matter