Jump to content

(Tutorial): #1 Sistem RainBow;


AleksandruAdv
 Share

Recommended Posts

What is that?

    _________________________________________________
    |                                                        _________             |
    |    |    /          /|        |\            |      /                   \          |
    |    |  /        /   |          |  \          |      |                              |
    |    |/       /     |           |    \        |      |                              |   
    |    |\              |           |      \      |      |        _____            |
    |    |  \            |           |        \    |      |                 \           |
    |    |    \          |           |          \  |      |                   |          |
    |    |      \        |           |            \|      \_________/           |
    |_______________________________________________|

Link to comment
Share on other sites

  • Retired
// adaugam asta sub include-uri
 
new TimerRainBow[MAX_PLAYERS];//creem o variabila pentru un player
new CarRainBow[MAX_PLAYERS]; // creem o variabila in care stocam id-ul masinii cand intra
new SavedC1[MAX_PLAYERS], SavedC2[MAX_PLAYERS];//creem variabila in care o sa stocam culorile pe care le va avea masina
 
CMD:rainbowspeed(playerid, params[]){ // creem comanda
    if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "You need to login first.");// daca nu e logat o sa-i apara asta
    if(TimerRainBow[playerid] != -1)return SendClientMessage(playerid, COLOR_LIGHTRED, "The rainbow is already activated.");// verifica daca are timer-ul pornit
    if(PlayerInfo[playerid][pVipAccount] == 0 && PlayerInfo[playerid][pAdmin] == 0) return 1;//daca nu e admin si nici VIP nu o sa actioneza comanda
    //if(CarInfo[carid][cVip] < 1) return SendClientMessage(playerid, COLOR_WHITE,"(Error): This vehicle is not VIP."); asta e verificare data are vip pe masina :))
  	CarRainBow[playerid] = GetPlayerVehicleID(playerid);//Ii conferim valoarea variabileli
    GetVehicleColor(CarRainBow[playerid], SavedC1[playerid], SavedC2[playerid]);//Salvam culorile
    if(!IsPlayerInAnyVehicle(playerid)) return SCM(playerid, -1, "(RainBow): Nu esti intr-un vehicul!");//Verifica daca e in vehicul
    TimerRainBow[playerid] = SetTimerEx("RainbowChange", 1000, true, "i", playerid);//Setezi timer-ul
    new string[64];//creezi o variabila de tip-ul string
    format(string, sizeof(string), "(VIPBot): %s a pornit RainBow-ul.",GetName(playerid));// Formatezi text-ul
    ABroadCast(COLOR_ADMCHAT, string,1);//Trimiti catre admini (inutil)
    return 1;// returnam ca sa nu luam warning
}
// Acum ne trebuie comana /rainbowspeedoff.
CMD:rainbowspeedoff(playerid, params[]){//Cream comanda
  	if(TimerRainBow[playerid] == -1) return SendClientMessage(playerid, COLOR_LIGHTRED, "You don`t have the rainbow activated.");//verificam daca e pornit rainbow-ul
    if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "You need to login first.");//verificam daca e logat
    KillTimer(TimerRainBow[playerid]);//Oprim rainbow-ul
    SCM(playerid, COLOR_YELLOW, "(RainBow): Ai oprit rainbow!");//Trimitem acest mesaj
    return 1;//returnam ca sa nu luam warning
}
// avem nevoie de aceasta functie pentru a da culoare random 0-255.
function RainbowChange(playerid){//definim timer-ul
 	new c1 = random(255), c2= random (255);//creem niste variabile random cu culori(nush cum sa explic asta :)))
 	ChangeVehicleColor(GetPlayerVehicleID(playerid), c1, c2);//Schimbam culoarea vehiculului
    return 1;//returnam
}
public OnPlayerExitVehicle(playerid, vehicleid){
  	if(vehicleid == CarRainBow[playerid]){
      	KillTimer(TimerRainBow[playerid]);//Oprim rainbow-ul
 		ChangeVehicleColor(vehicleid, SavedC1[playerid], SavedC2[playerid]);//Schimbam culoarea vehiculului
    }
  	return 1; 
}

Aici aveti un sistem care merge :))

ASGOOD#8460

forum.png

Link to comment
Share on other sites

  • 1 month later...
  • 5 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...