A Little Help
#1

Greeting.
I got the fs change the car color after another, and I want to do when you / vchange to go all the time even if you get out of the car when you get out of the car no longer change colors and have to give and / vchange, I hope you understand.

Command:
Quote:

CMD:vchange ( playerid , params [ ] )
{
if ( CVeh_Color [ playerid ] == 0)
{
CVeh_Color [ playerid ] = 1 ;
Timer = SetTimerEx ( "ccolor" , 100 , true , "i" , GetPlayerVehicleID ( playerid ) ) ;
}
else
{
CVeh_Color [ playerid ] = 0 ;
KillTimer ( Timer ) ;
}
return 1 ;
}

All Fs:
Quote:

public OnPlayerStateChange(playerid, newstate, oldstate)
{
if ( newstate == PLAYER_STATE_ONFOOT )
{
CVeh_Color [ playerid ] = 0 ;
KillTimer ( Timer ) ;
}
return 1;
}
forward ccolor ( vehicleid ) ;
public ccolor ( vehicleid )
{
ChangeVehicleColor( vehicleid , random ( 256 ) , random ( 256 ) ) ;
return 1;
}
CMD:vchange ( playerid , params [ ] )
{
if ( CVeh_Color [ playerid ] == 0)
{
CVeh_Color [ playerid ] = 1 ;
Timer = SetTimerEx ( "ccolor" , 100 , true , "i" , GetPlayerVehicleID ( playerid ) ) ;
}
else
{
CVeh_Color [ playerid ] = 0 ;
KillTimer ( Timer ) ;
}
return 1 ;
}

Reply
#2

pawn Код:
forward ccolor ( vehicleid ) ;
public ccolor ( vehicleid )
{
ChangeVehicleColor( vehicleid , random ( 256 ) , random ( 256 ) ) ;
return 1;
}
CMD:vchange ( playerid , params [ ] )
{
if ( CVeh_Color [ playerid ] == 0)
{
CVeh_Color [ playerid ] = 1 ;
Timer = SetTimerEx ( "ccolor" , 100 , true , "i" , GetPlayerVehicleID ( playerid ) ) ;
}
else
{
CVeh_Color [ playerid ] = 0 ;
KillTimer ( Timer ) ;
}
return 1 ;
}
If you want to change even you are not in car just remove OnPlayerStateChange.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)