[HELP] How To Make This Paint Job To Be Colored Once?
#1

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]
Reply
#2

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
Reply
#3

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 .
Reply
#4

i am using this on player update...

SOLVED
Reply
#5

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


Forum Jump:


Users browsing this thread: 1 Guest(s)