SHOW:
|
|
- or go back to the newest paste.
| 1 | /* | |
| 2 | - | Fait par Christopher # Kiki_Readon # Kiki53 |
| 2 | + | |
| 3 | - | CCC [ChangeCarColor] |
| 3 | + | Fait par Christopher |
| 4 | Change Car Color | |
| 5 | Mis à jour le 22/02/2015 | |
| 6 | ||
| 7 | */ | |
| 8 | ||
| 9 | #include <a_samp> | |
| 10 | - | new RainBowColor1; |
| 10 | + | |
| 11 | - | new RainBow[MAX_PLAYERS]; |
| 11 | + | |
| 12 | ||
| 13 | - | public OnPlayerCommandText(playerid, cmdtext[]) |
| 13 | + | new TimerColor, bool:RainBow[MAX_PLAYERS]; |
| 14 | - | {
|
| 14 | + | |
| 15 | - | if(strcmp(cmdtext, "/RainBow", true) == 0) |
| 15 | + | public OnPlayerCommandText(playerid, cmdtext[]) {
|
| 16 | - | {
|
| 16 | + | if(strcmp(cmdtext, "/RainBow", true) == 0) {
|
| 17 | - | if( !IsPlayerInAnyVehicle( playerid ) ) return SendClientMessage( playerid, -1, "Tu doit être dans un véhicule!" ); |
| 17 | + | switch(RainBow[playerid]) {
|
| 18 | - | if(RainBow[playerid] == 0) |
| 18 | + | case false: {
|
| 19 | - | {
|
| 19 | + | |
| 20 | RainBow[playerid] = true; | |
| 21 | - | RainBowColor(playerid); |
| 21 | + | if(IsPlayerInAnyVehicle(playerid)) RainBowColor(playerid); |
| 22 | - | RainBow[playerid] = 1; |
| 22 | + | } |
| 23 | case true: {
| |
| 24 | - | else |
| 24 | + | |
| 25 | - | {
|
| 25 | + | KillTimer(TimerColor); |
| 26 | RainBow[playerid] = false; | |
| 27 | - | KillTimer(RainBowColor1); |
| 27 | + | } |
| 28 | - | RainBow[playerid] = 0; |
| 28 | + | |
| 29 | return 1; | |
| 30 | } | |
| 31 | return 0; | |
| 32 | } | |
| 33 | public OnPlayerExitVehicle(playerid, vehicleid) {
| |
| 34 | - | public RainBowColor(playerid) |
| 34 | + | switch(RainBow[playerid]) {
|
| 35 | - | {
|
| 35 | + | case true: { KillTimer(TimerColor); RainBow[playerid] = false; }
|
| 36 | - | new Couleur = random(255) + 1; |
| 36 | + | |
| 37 | - | new vehicleid = GetPlayerVehicleID(playerid); |
| 37 | + | return 1; |
| 38 | } | |
| 39 | public OnPlayerEnterVehicle(playerid, vehicleid) {
| |
| 40 | - | RainBowColor1 = SetTimerEx("RainBowColor", 500, 0, "d" ,playerid);
|
| 40 | + | switch(RainBow[playerid]) {
|
| 41 | - | } |
| 41 | + | case false: { RainBowColor(playerid); RainBow[playerid] = true; }
|
| 42 | } | |
| 43 | return 1; | |
| 44 | } | |
| 45 | public RainBowColor(playerid) {
| |
| 46 | new Couleur = random(255) + 1, vehicleid = GetPlayerVehicleID(playerid); | |
| 47 | ||
| 48 | ChangeVehicleColor(vehicleid, Couleur, Couleur); | |
| 49 | TimerColor = SetTimerEx("RainBowColor", 500, 0, "d" ,playerid);
| |
| 50 | } | |
| 51 | #error Un merci ne fait pas de mal. 1 point de réputation non plus. |