Some help
#1

so im trying to create a cars who change colors automacly
every 1 second
is possible to make this ?
OnPlayerEnterVehice();
With timer
with 5 colors
Please fast repley with codes
really need it
Reply
#2

You don't need to use timers.

pawn Код:
new carColors[][2] =
{
     {0, 2},
     {22, 33},
     {45, 33},
     {101, 123}
};

public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(oldstate != PLAYER_STATE_DRIVER && newstate == PLAYER_STATE_DRIVER)
    {
        new vID = GetPlayerVehicleID(playerid);
        new randcolor = random(sizeof(carColors));
        ChangeVehicleColor(vID, carColors[randcolor][0], carColors[randcolor][1]);
    }
    return 1;
}
Reply
#3

pawn Код:
new carColors[][2] =
{
     {0, 2}, //0 = exterior color, 2 = interior color
     {22, 33},
     {45, 33},
     {101, 123},
     {13, 37}
};

forward ChangeVehicleColor(vehicleid)
{
    if(ChangeVehicleColor_Counter[vehicleid] > 4) return KillTimer(ChangeVehicleColor_Timer[vehicleid]);
    ChangeVehicleColor(vID, carColors[ChangeVehicleColor_Counter[vehicleid]][0], carColors[ChangeVehicleColor_Counter[vehicleid]][1]);
    ChangeVehicleColor_Counter[vehicleid]++;
}

new ChangeVehicleColor_Timer[MAX_VEHICLES]; //can probably be optimized not to use 2000 cells
new ChangeVehicleColor_Counter[MAX_VEHICLES];

public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(oldstate != PLAYER_STATE_DRIVER && newstate == PLAYER_STATE_DRIVER)
    {
        ChangeVehicleColor_Timer[GetPlayerVehicleID(playerid)] = SetTimerEx("ChangeVehicleColor", 1000, true, "i", GetPlayerVehicleID(playerid));
    }
    return 1;
}
Reply
#4

Some errors
Quote:

D:\Users\Korisnik Erik 2\Desktop\war z forest map 30 min\gamemodes\TDM.pwn(5 : error 021: symbol already defined: "ChangeVehicleColor"
D:\Users\Korisnik Erik 2\Desktop\war z forest map 30 min\gamemodes\TDM.pwn(59) : error 001: expected token: ";", but found "{"
D:\Users\Korisnik Erik 2\Desktop\war z forest map 30 min\gamemodes\TDM.pwn(60) : error 010: invalid function or declaration
D:\Users\Korisnik Erik 2\Desktop\war z forest map 30 min\gamemodes\TDM.pwn(973) : warning 203: symbol is never used: "ChangeVehicleColor_Counter"
D:\Users\Korisnik Erik 2\Desktop\war z forest map 30 min\gamemodes\TDM.pwn(973) : warning 203: symbol is never used: "carColors"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


3 Errors.

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)