Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Module: Hotwire / BreakIgnition
- Created by: L3o
- */
- #include <YSI\y_hooks>
- //=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ [DEFINES]
- #define HotwireCooldown (120) //=> Koliko sekundi mora cekati do sljedeceg paljenja vozila na zice.
- //=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ [VARIABLES]
- new
- PlayerText:HotwireTextdraws[MAX_PLAYERS][8],
- PlayerHotwireVehicle[MAX_PLAYERS] = 0,
- PlayerHotwireCombination[MAX_PLAYERS] = 0,
- PlayerHotwireTime[MAX_PLAYERS] = 0,
- hotwiretimer[MAX_PLAYERS];
- /*
- ##### ###### # # ##### ##### ##### ## # # ####
- # # # # # # # # # # # # # #
- # ##### ## # # # # # # # # # ####
- # # ## # # # ##### ###### # ## # #
- # # # # # # # # # # # ## ## # #
- # ###### # # # ##### # # # # # # ####
- */
- stock CreateHotwireTextdraws(playerid, bool:created)
- {
- if(created == false) {
- for(new i = 0; i < 8; i++) {
- PlayerTextDrawHide(playerid, HotwireTextdraws[playerid][i]);
- }
- CancelSelectTextDraw(playerid);
- }
- else if(created == true) {
- HotwireTextdraws[playerid][0] = CreatePlayerTextDraw(playerid, 266.732788, 363.863342, "box");
- PlayerTextDrawLetterSize(playerid, HotwireTextdraws[playerid][0], 0.000000, 7.266665);
- PlayerTextDrawTextSize(playerid, HotwireTextdraws[playerid][0], 364.000000, 0.000000);
- PlayerTextDrawAlignment(playerid, HotwireTextdraws[playerid][0], 1);
- PlayerTextDrawColor(playerid, HotwireTextdraws[playerid][0], -1);
- PlayerTextDrawUseBox(playerid, HotwireTextdraws[playerid][0], 1);
- PlayerTextDrawBoxColor(playerid, HotwireTextdraws[playerid][0], 170);
- PlayerTextDrawSetShadow(playerid, HotwireTextdraws[playerid][0], 0);
- PlayerTextDrawSetOutline(playerid, HotwireTextdraws[playerid][0], 0);
- PlayerTextDrawBackgroundColor(playerid, HotwireTextdraws[playerid][0], 255);
- PlayerTextDrawFont(playerid, HotwireTextdraws[playerid][0], 1);
- PlayerTextDrawSetProportional(playerid, HotwireTextdraws[playerid][0], 1);
- PlayerTextDrawSetShadow(playerid, HotwireTextdraws[playerid][0], 0);
- HotwireTextdraws[playerid][1] = CreatePlayerTextDraw(playerid, 278.266571, 374.848541, "LD_SPAC:white"); // Zelena
- PlayerTextDrawLetterSize(playerid, HotwireTextdraws[playerid][1], 0.000000, 0.000000);
- PlayerTextDrawTextSize(playerid, HotwireTextdraws[playerid][1], 7.000000, 48.000000);
- PlayerTextDrawAlignment(playerid, HotwireTextdraws[playerid][1], 1);
- PlayerTextDrawColor(playerid, HotwireTextdraws[playerid][1], 8388863);
- PlayerTextDrawSetShadow(playerid, HotwireTextdraws[playerid][1], 0);
- PlayerTextDrawSetOutline(playerid, HotwireTextdraws[playerid][1], 0);
- PlayerTextDrawBackgroundColor(playerid, HotwireTextdraws[playerid][1], 255);
- PlayerTextDrawFont(playerid, HotwireTextdraws[playerid][1], 4);
- PlayerTextDrawSetProportional(playerid, HotwireTextdraws[playerid][1], 0);
- PlayerTextDrawSetShadow(playerid, HotwireTextdraws[playerid][1], 0);
- PlayerTextDrawSetSelectable(playerid, HotwireTextdraws[playerid][1], true);
- HotwireTextdraws[playerid][2] = CreatePlayerTextDraw(playerid, 298.667816, 374.648529, "LD_SPAC:white"); // Crvena
- PlayerTextDrawLetterSize(playerid, HotwireTextdraws[playerid][2], 0.000000, 0.000000);
- PlayerTextDrawTextSize(playerid, HotwireTextdraws[playerid][2], 7.000000, 48.000000);
- PlayerTextDrawAlignment(playerid, HotwireTextdraws[playerid][2], 1);
- PlayerTextDrawColor(playerid, HotwireTextdraws[playerid][2], -2147483393);
- PlayerTextDrawSetShadow(playerid, HotwireTextdraws[playerid][2], 0);
- PlayerTextDrawSetOutline(playerid, HotwireTextdraws[playerid][2], 0);
- PlayerTextDrawBackgroundColor(playerid, HotwireTextdraws[playerid][2], 255);
- PlayerTextDrawFont(playerid, HotwireTextdraws[playerid][2], 4);
- PlayerTextDrawSetProportional(playerid, HotwireTextdraws[playerid][2], 0);
- PlayerTextDrawSetShadow(playerid, HotwireTextdraws[playerid][2], 0);
- PlayerTextDrawSetSelectable(playerid, HotwireTextdraws[playerid][2], true);
- HotwireTextdraws[playerid][3] = CreatePlayerTextDraw(playerid, 319.669097, 374.648529, "LD_SPAC:white"); // Zuta
- PlayerTextDrawLetterSize(playerid, HotwireTextdraws[playerid][3], 0.000000, 0.000000);
- PlayerTextDrawTextSize(playerid, HotwireTextdraws[playerid][3], 7.000000, 48.000000);
- PlayerTextDrawAlignment(playerid, HotwireTextdraws[playerid][3], 1);
- PlayerTextDrawColor(playerid, HotwireTextdraws[playerid][3], -65281);
- PlayerTextDrawSetShadow(playerid, HotwireTextdraws[playerid][3], 0);
- PlayerTextDrawSetOutline(playerid, HotwireTextdraws[playerid][3], 0);
- PlayerTextDrawBackgroundColor(playerid, HotwireTextdraws[playerid][3], 255);
- PlayerTextDrawFont(playerid, HotwireTextdraws[playerid][3], 4);
- PlayerTextDrawSetProportional(playerid, HotwireTextdraws[playerid][3], 0);
- PlayerTextDrawSetShadow(playerid, HotwireTextdraws[playerid][3], 0);
- PlayerTextDrawSetSelectable(playerid, HotwireTextdraws[playerid][3], true);
- HotwireTextdraws[playerid][4] = CreatePlayerTextDraw(playerid, 341.970458, 374.233703, "LD_SPAC:white"); // Plava
- PlayerTextDrawLetterSize(playerid, HotwireTextdraws[playerid][4], 0.000000, 0.000000);
- PlayerTextDrawTextSize(playerid, HotwireTextdraws[playerid][4], 7.000000, 48.000000);
- PlayerTextDrawAlignment(playerid, HotwireTextdraws[playerid][4], 1);
- PlayerTextDrawColor(playerid, HotwireTextdraws[playerid][4], -1378294017);
- PlayerTextDrawSetShadow(playerid, HotwireTextdraws[playerid][4], 0);
- PlayerTextDrawSetOutline(playerid, HotwireTextdraws[playerid][4], 0);
- PlayerTextDrawBackgroundColor(playerid, HotwireTextdraws[playerid][4], 255);
- PlayerTextDrawFont(playerid, HotwireTextdraws[playerid][4], 4);
- PlayerTextDrawSetProportional(playerid, HotwireTextdraws[playerid][4], 0);
- PlayerTextDrawSetShadow(playerid, HotwireTextdraws[playerid][4], 0);
- PlayerTextDrawSetSelectable(playerid, HotwireTextdraws[playerid][4], true);
- HotwireTextdraws[playerid][5] = CreatePlayerTextDraw(playerid, 265.000000, 354.881652, "Select_Wire");
- PlayerTextDrawLetterSize(playerid, HotwireTextdraws[playerid][5], 0.258666, 1.189333);
- PlayerTextDrawAlignment(playerid, HotwireTextdraws[playerid][5], 1);
- PlayerTextDrawColor(playerid, HotwireTextdraws[playerid][5], -1);
- PlayerTextDrawSetShadow(playerid, HotwireTextdraws[playerid][5], 0);
- PlayerTextDrawSetOutline(playerid, HotwireTextdraws[playerid][5], -1);
- PlayerTextDrawBackgroundColor(playerid, HotwireTextdraws[playerid][5], 255);
- PlayerTextDrawFont(playerid, HotwireTextdraws[playerid][5], 1);
- PlayerTextDrawSetProportional(playerid, HotwireTextdraws[playerid][5], 1);
- PlayerTextDrawSetShadow(playerid, HotwireTextdraws[playerid][5], 0);
- HotwireTextdraws[playerid][6] = CreatePlayerTextDraw(playerid, 312.733398, 431.381500, " ");
- PlayerTextDrawLetterSize(playerid, HotwireTextdraws[playerid][6], 0.194666, 0.803555);
- PlayerTextDrawAlignment(playerid, HotwireTextdraws[playerid][6], 2);
- PlayerTextDrawColor(playerid, HotwireTextdraws[playerid][6], -1);
- PlayerTextDrawSetShadow(playerid, HotwireTextdraws[playerid][6], 0);
- PlayerTextDrawSetOutline(playerid, HotwireTextdraws[playerid][6], 1);
- PlayerTextDrawBackgroundColor(playerid, HotwireTextdraws[playerid][6], 255);
- PlayerTextDrawFont(playerid, HotwireTextdraws[playerid][6], 1);
- PlayerTextDrawSetProportional(playerid, HotwireTextdraws[playerid][6], 1);
- PlayerTextDrawSetShadow(playerid, HotwireTextdraws[playerid][6], 0);
- HotwireTextdraws[playerid][7] = CreatePlayerTextDraw(playerid, 358.666748, 357.429595, "ld_chat:thumbdn");
- PlayerTextDrawLetterSize(playerid, HotwireTextdraws[playerid][7], 0.000000, 0.000000);
- PlayerTextDrawTextSize(playerid, HotwireTextdraws[playerid][7], 10.000000, 11.000000);
- PlayerTextDrawAlignment(playerid, HotwireTextdraws[playerid][7], 1);
- PlayerTextDrawColor(playerid, HotwireTextdraws[playerid][7], -1);
- PlayerTextDrawSetShadow(playerid, HotwireTextdraws[playerid][7], 0);
- PlayerTextDrawSetOutline(playerid, HotwireTextdraws[playerid][7], 0);
- PlayerTextDrawBackgroundColor(playerid, HotwireTextdraws[playerid][7], 255);
- PlayerTextDrawFont(playerid, HotwireTextdraws[playerid][7], 4);
- PlayerTextDrawSetProportional(playerid, HotwireTextdraws[playerid][7], 0);
- PlayerTextDrawSetShadow(playerid, HotwireTextdraws[playerid][7], 0);
- PlayerTextDrawSetSelectable(playerid, HotwireTextdraws[playerid][7], true);
- for(new i = 0; i < 8; i++) {
- PlayerTextDrawShow(playerid, HotwireTextdraws[playerid][i]);
- }
- SelectTextDraw(playerid, 0xAFAFAFAA);
- }
- return (true);
- }
- //=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ [STOCKS]
- stock ResetHotwireFunctions(playerid)
- {
- //[player]
- CreateHotwireTextdraws(playerid, false); PlayerHotwireTime[playerid] = 80;
- PlayerHotwireVehicle[playerid] = 0; PlayerHotwireCombination[playerid] = 0;
- return 1;
- }
- FUNCTION: Hotwire_Timer()
- {
- new br_string[64],Float:Pos[3];
- foreach(new i: Player)
- {
- if(PlayerHotwireVehicle[i] == 1)
- {
- new vehicleid = GetNearestVehicle(i);
- new carid = isCOSVehicle(vehicleid);
- PlayerHotwireTime[i] --;
- format(br_string,sizeof(br_string),"(time):_~y~%d~w~seconds_remain...",PlayerHotwireTime[i]);
- PlayerTextDrawSetString(i, HotwireTextdraws[i][6], br_string);
- if(PlayerHotwireTime[i] < 0)
- {
- GetPlayerPos(i, Pos[0],Pos[1],Pos[2]);
- if(carid != (-1))
- {
- if(VehicleData[carid][pAlarmLevel] != 0)
- {
- SetAlarmStatus(VehicleData[carid][ownableVehicleID], VEHICLE_PARAMS_ON);
- ResetHotwireFunctions(i); KillTimer(hotwiretimer[i]);
- SendInfoMessage(i, "Niste uspijeli da upalite vozilo na zice, alarm je aktiviran.");
- // Dodati da izbaci PDu upozorenje
- }
- }
- }
- }
- }
- return (true);
- }
- //=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ [HOOKS]
- hook OnPlayerClickPlayerTD(playerid, PlayerText:playertextid)
- {
- if(playertextid == HotwireTextdraws[playerid][7])
- {
- CreateHotwireTextdraws(playerid, false);
- return 1;
- }
- // ZICE - SUSTAV
- if(playertextid == HotwireTextdraws[playerid][1])
- {
- if(PlayerHotwireCombination[playerid] == 1)
- {
- SCM(playerid, COLOR_GREEN,"[INFO]: Uspijesno ste pogodili kombinaciju zica i upalili ste motor na vozilu.");
- SetEngineStatus(GetPlayerVehicleID(playerid), VEHICLE_PARAMS_ON);
- CreateHotwireTextdraws(playerid, false); ResetHotwireFunctions(playerid);
- return 1;
- }
- if(PlayerHotwireCombination[playerid] != 1)
- {
- new comb = minrand(1, 4);
- SendErrorMessage(playerid, "Pogrijesili ste zicu, pokusajte ponovo (- 5 seconds).");
- PlayerHotwireTime[playerid] -= 5; PlayerHotwireCombination[playerid] = comb;
- return 1;
- }
- }
- if(playertextid == HotwireTextdraws[playerid][2])
- {
- if(PlayerHotwireCombination[playerid] == 2)
- {
- SCM(playerid, COLOR_GREEN,"[INFO]: Uspijesno ste pogodili kombinaciju zica i upalili ste motor na vozilu.");
- SetEngineStatus(GetPlayerVehicleID(playerid), VEHICLE_PARAMS_ON);
- CreateHotwireTextdraws(playerid, false); ResetHotwireFunctions(playerid);
- return 1;
- }
- if(PlayerHotwireCombination[playerid] != 2)
- {
- new comb = minrand(1, 4);
- SendErrorMessage(playerid, "Pogrijesili ste zicu, pokusajte ponovo (- 5 seconds).");
- PlayerHotwireTime[playerid] -= 5; PlayerHotwireCombination[playerid] = comb;
- return 1;
- }
- }
- if(playertextid == HotwireTextdraws[playerid][3])
- {
- if(PlayerHotwireCombination[playerid] == 3)
- {
- SCM(playerid, COLOR_GREEN,"[INFO]: Uspijesno ste pogodili kombinaciju zica i upalili ste motor na vozilu.");
- SetEngineStatus(GetPlayerVehicleID(playerid), VEHICLE_PARAMS_ON);
- CreateHotwireTextdraws(playerid, false); ResetHotwireFunctions(playerid);
- return 1;
- }
- if(PlayerHotwireCombination[playerid] != 3)
- {
- new comb = minrand(1, 4);
- SendErrorMessage(playerid, "Pogrijesili ste zicu, pokusajte ponovo (- 5 seconds).");
- PlayerHotwireTime[playerid] -= 5; PlayerHotwireCombination[playerid] = comb;
- return 1;
- }
- }
- if(playertextid == HotwireTextdraws[playerid][4])
- {
- if(PlayerHotwireCombination[playerid] == 4)
- {
- SCM(playerid, COLOR_GREEN,"[INFO]: Uspijesno ste pogodili kombinaciju zica i upalili ste motor na vozilu.");
- SetEngineStatus(GetPlayerVehicleID(playerid), VEHICLE_PARAMS_ON);
- CreateHotwireTextdraws(playerid, false); ResetHotwireFunctions(playerid);
- return 1;
- }
- if(PlayerHotwireCombination[playerid] != 4)
- {
- new comb = minrand(1, 4);
- SendErrorMessage(playerid, "Pogrijesili ste zicu, pokusajte ponovo (- 5 seconds).");
- PlayerHotwireTime[playerid] -= 5; PlayerHotwireCombination[playerid] = comb;
- return 1;
- }
- }
- return 1;
- }
- //=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ [COMMANDS]
- CMD:hotwire(playerid, params[])
- {
- new action[25],
- vehicleid = GetNearestVehicle(playerid),
- carid = isCOSVehicle(vehicleid);
- if(sscanf(params, "s[25] ", action))
- {
- SendCOMMANDMessage(playerid, "/hotwire [action].");
- SCM(playerid, 0xAFAFAFAA, "[actions] start, stop");
- return (true);
- }
- if(strcmp(action,"start",true) == 0)
- {
- if(carid != (-1))
- {
- new engineget = GetPlayerVehicleID(playerid), engine,lights,alarm,doors,bonnet,boot,objective,Float:vHealth;
- GetVehicleParamsEx(engineget,engine, lights, alarm, doors, bonnet, boot, objective );
- if(HTCooldownTimer[playerid] != 0)
- return va_SCM(playerid, COLOR_LIGHTRED,"[ERROR]: Do sljedeceg paljenja vozila na zice morate sacekati jos %d sekundi.",HTCooldownTimer[playerid]);
- if(VehicleData[carid][Fuel] <= 1) return SendErrorMessage(playerid, "U ovom vozilu nema goriva, ne mozete ga upaliti.");
- if(isequal(GetName(playerid), VehicleData[carid][vehicleOwner]))
- return SendErrorMessage(playerid,"Ne mozete ovu komandu koristit u vasem vozilu.");
- if(VehicleIsBike(GetPlayerVehicleID(playerid))) return SendErrorMessage(playerid, "Ne mozete upaliti motor na biciklu.");
- if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendErrorMessage(playerid, "Morate biti na vozacevom mjestu.");
- if( engine == 1 ) return SendErrorMessage( playerid, "Motor na ovom vozilu je vec upaljen." );
- GetVehicleHealth( GetPlayerVehicleID( playerid ), vHealth );
- if( vHealth < 400 ) return SendErrorMessage( playerid, "Motor na ovom vozilu je previse ostecen, ne mozete ga upaliti!");
- // Combination
- new comb = minrand(1, 5);
- if(comb == 5) { comb = 4; }
- if(VehicleData[carid][pImmobiliser] == 0) PlayerHotwireTime[playerid] = 90;
- else if(VehicleData[carid][pImmobiliser] == 1) PlayerHotwireTime[playerid] = 50;
- else if(VehicleData[carid][pImmobiliser] == 2) PlayerHotwireTime[playerid] = 40;
- else if(VehicleData[carid][pImmobiliser] == 3) PlayerHotwireTime[playerid] = 30;
- else if(VehicleData[carid][pImmobiliser] == 4) PlayerHotwireTime[playerid] = 20;
- HTCooldownTimer[playerid] = HotwireCooldown;
- hotwiretimer[playerid] = SetTimerEx("Hotwire_Timer", 1000, true, "i", playerid);
- CreateHotwireTextdraws(playerid, true); PlayerHotwireVehicle[playerid] = 1; PlayerHotwireCombination[playerid] = comb;
- SendInfoMessage(playerid, "Poceli ste sa paljenjem vozila na zice, da prekinete radnju kucajte /hotwire stop.");
- }
- }
- if(strcmp(action,"stop",true) == 0)
- {
- if(PlayerHotwireVehicle[playerid] == 1)
- {
- ResetHotwireFunctions(playerid);
- SendInfoMessage(playerid, "Odustali ste od paljenja vozila na zice, alarm je aktiviran.");
- SetAlarmStatus(VehicleData[carid][ownableVehicleID], VEHICLE_PARAMS_ON);
- // Dodati da izbaci PDu upozorenje
- }
- }
- return (true);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement