Jump to content
FREAKHOSTING





[Tutorial] Rainbow Car


Impulsive.
 Share

Recommended Posts

Bun pentru inceput, avem nevoie de o variabila de timer.

new TimerRainCar[MAX_PLAYERS];

Apoi mergem si la public OnPlayerDisconnect(playerid, reason) sa adaugam Timer-ul.

public OnPlayerDisconnect(playerid, reason){
	KillTimer(TimerRaiCar[playerid]);
}

Dupa ce am facut variabila si am adaugat timerul in OnPlayerDisconnect, sa facem comanda.

CMD:rainbowcar(playerid, params[]){
	if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "You need to login first.");
	if(!IsPlayerInAnyVehicle(playerid)) return SCM(playerid, -1, "Nu te aflii intr-un vehicul.");
	new time;
	if(sscanf(params, "i", time)) return SCM(playerid, COLOR_GREEN, "Sintaxa: {FFFFFF}/rainbowcar <time>");
	if(time < 0) return 1;
	KillTimer(TimerRainCar[playerid]);
	TimerRainCar[playerid] = SetTimerEx("RainbowChange", time, true, "i", playerid);
	return 1;
}
CMD:stoprainbow(playerid, params[]){
	if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "You need to login first.");
    KillTimer(TimerRainCar[playerid]);
    SCM(playerid, COLOR_GREEN, "Ai oprit Ranbowcar!");
    return 1;
}

Dupa ce am facut si comenzile haideti sa facem si functia pentru a fi treaba treaba.

function RainbowChange(playerid){
	if(IsPlayerInAnyVehicle(playerid)){
	    new c1 = random(255), c2= random (255);
	    ChangeVehicleColor(GetPlayerVehicleID(playerid), c1, c2);
 	}
 	return 1;
}

O mica observatie!

Aceasta este doar baza comenzi rainbow, de aici puteti voi sa ii adaugati sa aveti nevoie de puncte pentru a o folosi, sa fie valabila doar pentru admini/helperi/vip sau fiecare dupa preferinte.

Link to comment
Share on other sites

  • 0
  • 25
FREAKHOSTING





  • NeeD locked this topic
Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...