Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #include <zcmd>
- new Text:LuckEventTexT;
- new EventObj[17];
- new InEvent[MAX_PLAYERS];
- new Participanti;
- new EventStat;
- new obiectedisparuta;
- new timer1;
- new timer2;
- new Float:admins = 546.7480;
- forward EventStart();
- forward EventCheck();
- forward EventDestroy();
- main()
- {
- print("\n----------------------------------");
- print(" Luck Event by Gireada");
- print("----------------------------------\n");
- }
- public OnFilterScriptInit()
- {
- EventObj[0] = CreateObject(19378, -130.59, 3287.54, 547.00, 0.00, 90.00, 0.00);
- EventObj[1] = CreateObject(19375, -130.58, 3277.96, 547.00, 0.00, 90.00, 0.00);
- EventObj[2] = CreateObject(19378, -130.58, 3268.43, 547.00, 0.00, 90.00, 0.00);
- EventObj[3] = CreateObject(19375, -130.58, 3258.86, 547.00, 0.00, 90.00, 0.00);
- EventObj[4] = CreateObject(19378, -140.87, 3258.86, 547.00, 0.00, 90.00, 0.00);
- EventObj[5] = CreateObject(19375, -151.41, 3258.86, 547.00, 0.00, 90.00, 0.00);
- EventObj[6] = CreateObject(19378, -161.75, 3258.86, 547.00, 0.00, 90.00, 0.00);
- EventObj[7] = CreateObject(19375, -161.75, 3268.43, 547.00, 0.00, 90.00, 0.00);
- EventObj[8] = CreateObject(19378, -161.75, 3277.98, 547.00, 0.00, 90.00, 0.00);
- EventObj[9] = CreateObject(19375, -161.75, 3287.54, 547.00, 0.00, 90.00, 0.00);
- EventObj[10] = CreateObject(19375, -140.88, 3268.42, 547.00, 0.00, 90.00, 0.00);
- EventObj[11] = CreateObject(19378, -140.87, 3277.96, 547.00, 0.00, 90.00, 0.00);
- EventObj[12] = CreateObject(19375, -140.87, 3287.54, 547.00, 0.00, 90.00, 0.00);
- EventObj[13] = CreateObject(19378, -151.41, 3268.42, 547.00, 0.00, 90.00, 0.00);
- EventObj[14] = CreateObject(19375, -151.41, 3277.96, 547.00, 0.00, 90.00, 0.00);
- EventObj[15] = CreateObject(19378, -151.41, 3287.54, 547.00, 0.00, 90.00, 0.00);
- print("\n--------------------------------------");
- print(" Luck Event by Gireada");
- print("--------------------------------------\n");
- LuckEventTexT = TextDrawCreate(443.500000, 99.750000, "Participanti Luck:");
- TextDrawLetterSize(LuckEventTexT, 0.449999, 1.600000);
- TextDrawAlignment(LuckEventTexT, 1);
- TextDrawColor(LuckEventTexT, -16776961);
- TextDrawSetShadow(LuckEventTexT, 0);
- TextDrawSetOutline(LuckEventTexT, 1);
- TextDrawBackgroundColor(LuckEventTexT, -1);
- TextDrawFont(LuckEventTexT, 1);
- TextDrawSetProportional(LuckEventTexT, 1);
- return 1;
- }
- CMD:luckevent(playerid, params[])
- {
- new string[256], nume[MAX_PLAYER_NAME];
- if(IsPlayerAdmin(playerid))
- {
- if(EventStat == 0 && Participanti == 0)
- {
- EventStat = 1;
- format(string, sizeof(string),"Admin-ul %s a dat start la Luck Event. Aveti 20 de secunde de a da /luck .",nume);
- SendClientMessageToAll(0xFFFFFFFFF,string);
- SetTimer("EventStart", 20000, false);
- }
- }
- return 1;
- }
- CMD:luck(playerid, params[])
- {
- new string[256];
- if(EventStat == 1)
- {
- Participanti++; InEvent[playerid] = 1;
- SetPlayerPos(playerid,-150.9392, 3268.9268, 548.3915);
- format(string, sizeof(string), "Participanti Luck: %d", Participanti);
- TextDrawSetString(LuckEventTexT, string);
- TextDrawShowForPlayer(playerid, LuckEventTexT);
- }
- return 1;
- }
- public OnFilterScriptExit()
- {
- return 1;
- }
- public EventStart()
- {
- new string[512];
- EventStat = 0;
- format(string, sizeof(string),"Luck Event a inceput sunt %d participanti. Aveti grija la podea.",Participanti);
- SendClientMessageToAll(0xFFFFFFFFF,string);
- SendEventMessage("Luck Event: Aranjativa! Aveti 10 secunde.");
- for(new i=0;i<=MAX_PLAYERS;i++)
- {
- if(InEvent[i] == 1)
- {
- GivePlayerWeapon(i, 46, 1);
- }
- }
- format(string, sizeof(string), "Participanti Luck: %d", Participanti);
- TextDrawSetString(LuckEventTexT, string);
- timer2 = SetTimer("EventDestroy", 10000, false);
- return 1;
- }
- public EventCheck()
- {
- new string[256],Float:x,Float:y,Float:z,nume[MAX_PLAYER_NAME];
- for(new i=0;i<=MAX_PLAYERS;i++)
- {
- if(InEvent[i] == 1)
- {
- GetPlayerPos(i,x,y,z);
- if(z<admins)
- {
- Participanti--;InEvent[i]=0;
- TextDrawHideForPlayer(i, LuckEventTexT);
- }
- }
- }
- format(string, sizeof(string), "Participanti Luck: %d", Participanti);
- TextDrawSetString(LuckEventTexT, string);
- if(Participanti == 1)
- {
- for(new i=0;i<=MAX_PLAYERS;i++)
- {
- if(InEvent[i] == 1)
- {
- GetPlayerPos(i,x,y,z);
- if(Participanti == 1)
- {
- GetPlayerName(i,nume,sizeof(nume)); GivePlayerMoney(i, 1000000);
- Participanti = 0; EventStat = 0;
- KillTimer(timer2); KillTimer(timer1);
- TextDrawHideForPlayer(i, LuckEventTexT);
- GivePlayerMoney(i, 1000000);
- format(string, sizeof(string), "%s a castigat Luck Event",nume);
- SendEventMessage(string);
- }
- }
- }
- }
- if(Participanti == 0)
- {
- KillTimer(timer2);
- KillTimer(timer1);
- SendEventMessage("Luck Event s-a incheiat");
- }
- return 1;
- }
- public EventDestroy()
- {
- new obiect = random(16),string[512],string2[256],nume[MAX_PLAYER_NAME];
- if(obiectedisparuta <= 14)
- {
- if(IsValidObject(EventObj[obiect]))
- {
- SendEventMessage("Luck Event: Atentie dispare podeaua.");
- DestroyObject(EventObj[obiect]);
- obiectedisparuta++;
- timer1 = SetTimer("EventCheck", 1000, false);
- timer2 = SetTimer("EventDestroy", 10000, false);
- }
- else if(!IsValidObject(EventObj[obiect]))
- {
- SendEventMessage("Luck Event: Alarma falsa mai aveti 10 secunde.");
- timer1 = SetTimer("EventCheck", 1000, false);
- timer2 = SetTimer("EventDestroy", 10000, false);
- }
- }
- else
- {
- format(string, sizeof(string), "Luck Event: Castigatorii evenimentului sunt:");
- for(new i=0;i<MAX_PLAYERS;i++)
- {
- if(InEvent[i] == 1)
- {
- GetPlayerName(i, nume, sizeof(nume));
- GivePlayerMoney(i, 1000000);
- format(string2, sizeof(string2), " %s",nume);
- strcat(string, string2);
- }
- }
- SendClientMessageToAll(0xFFFFFFFFF,string);
- }
- return 1;
- }
- stock SendEventMessage(const mesaj[])
- {
- for(new i=0;i<MAX_PLAYERS;i++)
- {
- if(InEvent[i] == 1)
- {
- SendClientMessage(i, 0xFFFFFFFF, mesaj);
- }
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement