Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Fait par Christopher
- Change Car Color
- Mis à jour le 22/02/2015
- */
- #include <a_samp>
- forward RainBowColor(playerid);
- new TimerColor, bool:RainBow[MAX_PLAYERS];
- public OnPlayerCommandText(playerid, cmdtext[]) {
- if(strcmp(cmdtext, "/RainBow", true) == 0) {
- switch(RainBow[playerid]) {
- case false: {
- SendClientMessage(playerid, -1, "RainBow activé");
- RainBow[playerid] = true;
- if(IsPlayerInAnyVehicle(playerid)) RainBowColor(playerid);
- }
- case true: {
- SendClientMessage(playerid, -1, "Rainbow désactivé");
- KillTimer(TimerColor);
- RainBow[playerid] = false;
- }
- }
- return 1;
- }
- return 0;
- }
- public OnPlayerExitVehicle(playerid, vehicleid) {
- switch(RainBow[playerid]) {
- case true: { KillTimer(TimerColor); RainBow[playerid] = false; }
- }
- return 1;
- }
- public OnPlayerEnterVehicle(playerid, vehicleid) {
- switch(RainBow[playerid]) {
- case false: { RainBowColor(playerid); RainBow[playerid] = true; }
- }
- return 1;
- }
- public RainBowColor(playerid) {
- new Couleur = random(255) + 1, vehicleid = GetPlayerVehicleID(playerid);
- ChangeVehicleColor(vehicleid, Couleur, Couleur);
- TimerColor = SetTimerEx("RainBowColor", 500, 0, "d" ,playerid);
- }
- #error Un merci ne fait pas de mal. 1 point de réputation non plus.
Advertisement
Add Comment
Please, Sign In to add comment