SHARE
TWEET

Untitled

a guest Nov 17th, 2019 73 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. CMD:unrentvehicle(playerid, params[])
  2. {
  3.     if(!pLoggedIn[playerid])return true;
  4.     if(!IsPlayerInAnyVehicle(playerid))return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} Niste u vozilu.");
  5.  
  6.     new vehicleid = GetPlayerVehicleID(playerid), string[128];
  7.  
  8.     if(!IsValidRentalCar(vehicleid))return SendClientMessage(playerid, COLOR_ADM, "SERVER: This isn't a rental vehicle.");
  9.     if(!RentalData[vehicleid][rentalcarRented])return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} This vehicle isn't rented by anyone.");
  10.     if(RentalData[vehicleid][rentalcarRentedBy] != PlayerData[playerid][pSQLID])return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} This isn't your rental vehicle.");
  11.  
  12.     if(!IsPlayerInRangeOfPoint(playerid, 9.0, RentalData[vehicleid][rentalcarPos][0], RentalData[vehicleid][rentalcarPos][1], RentalData[vehicleid][rentalcarPos][2])){
  13.         SendClientMessage(playerid, COLOR_ADM, "You aren't near your rental vehicles park spot.");
  14.         SendClientMessage(playerid, COLOR_PINK, "Hint: Follow the red marker to the park spot if you want your money back.");
  15.         SetPlayerCheckpoint(playerid, RentalData[vehicleid][rentalcarPos][0], RentalData[vehicleid][rentalcarPos][1], RentalData[vehicleid][rentalcarPos][2], 3.0);
  16.         return true;
  17.     }
  18.  
  19.     RentalData[vehicleid][rentalcarRented] = false;
  20.     RentalData[vehicleid][rentalcarRentedBy] = 0;
  21.  
  22.     format(string, sizeof(string), "You unrented the %s and got your money back.", ReturnVehicleName(vehicleid));
  23.     SendClientMessage(playerid, COLOR_DARKGREEN, string);
  24.  
  25.     format(string, sizeof(string), "Unrented Rental Vehicle DBID %i", RentalData[vehicleid][rentalcarSQLID]);
  26.     LogPlayerAction(playerid, string);
  27.  
  28.     GiveMoney(playerid, 300);
  29.     SetVehicleToRespawn(vehicleid);
  30.     return true;
  31. }
  32.  
  33. CMD:note(playerid, params[])
  34. {
  35.     if(!pLoggedIn[playerid])return true;
  36.  
  37.     new sub_param[128], sub_z_param[128], string[400], query[177];
  38.  
  39.     if(sscanf(params, "s[128]S()[128]", sub_param, sub_z_param)){
  40.         SendClientMessage(playerid, COLOR_ACTION, "____________________________________________________");
  41.         SendClientMessage(playerid, COLOR_ACTION, "USAGE: /note [action]");
  42.         SendClientMessage(playerid, COLOR_ACTION, "/note create [text] - Create a new note.");
  43.         SendClientMessage(playerid, COLOR_ACTION, "/note display - See all your existing notes.");
  44.         SendClientMessage(playerid, COLOR_ACTION, "/note show [noteid] [playerid] - Show another player your note.");
  45.         SendClientMessage(playerid, COLOR_ACTION, "/note add [noteid] - Add text to existing note ID.");
  46.         SendClientMessage(playerid, COLOR_ACTION, "/note delete [noteid] - Delete an existing note ID.");
  47.         SendClientMessage(playerid, COLOR_ACTION, "____________________________________________________");
  48.         return true;
  49.     }
  50.  
  51.     if(!strcmp(sub_param, "create")){
  52.         new note_id;
  53.  
  54.         if(isnull(sub_z_param))return SendClientMessage(playerid, COLOR_ACTION, "USAGE: /note create [text]");
  55.  
  56.         for(new i = 1; i < MAX_PLAYER_NOTES; i++)
  57.         {
  58.             if(!NoteData[playerid][i][NoteID]){
  59.                 note_id = i;
  60.                 break;
  61.             }
  62.         }
  63.  
  64.         if(note_id == 0)return SendClientMessage(playerid, COLOR_ACTION, "You can't make anymore notes!");
  65.  
  66.         format(NoteData[playerid][note_id][NoteDetail], 128, "%s", sub_z_param);
  67.         NoteData[playerid][note_id][NoteID] = note_id;
  68.  
  69.         note_save_id[playerid] = note_id;
  70.  
  71.         mysql_format(m_Handle, query, sizeof(query), "INSERT INTO `player_notes` (playersqlid, slotid, details) VALUES(%i, %i, '%e')",
  72.             PlayerData[playerid][pSQLID], note_id, sub_z_param);
  73.         mysql_pquery(m_Handle, query, "SQL_AddPlayerNote", "i", playerid);
  74.  
  75.         SendNearbyMessage(playerid, 20.0, COLOR_EMOTE, "* %s takes out a paper sheet and writes something.", ReturnName(playerid, 0));
  76.  
  77.         format(string, sizeof(string), "[Notes] You've created a note with text: %s", sub_z_param);
  78.         SendClientMessage(playerid, COLOR_ACTION, string);
  79.     }
  80.     else if(!strcmp(sub_param, "display")){
  81.  
  82.         new hasNotes;
  83.  
  84.         for(new i = 1; i < MAX_PLAYER_NOTES; i++){
  85.             if(NoteData[playerid][i][NoteID] != 0) {
  86.                 if(!isnull(NoteData[playerid][i][NoteDetail])){
  87.                     format(string, sizeof(string), "[Notes] Note(%d) says: %s", i, NoteData[playerid][i][NoteDetail]);
  88.                     SendClientMessage(playerid, COLOR_ACTION, string);
  89.                     hasNotes++;
  90.                 }
  91.             }
  92.         }
  93.         if(!hasNotes)return SendClientMessage(playerid, COLOR_ACTION, "You don't have any notes ( /note create )!");
  94.  
  95.         //SendClientMessage(playerid, COLOR_ACTION, string);
  96.     }
  97.     else if(!strcmp(sub_param, "show")){
  98.         new playerb, noteid;
  99.  
  100.         if(sscanf(sub_z_param, "du", noteid, playerb))
  101.             return SendClientMessage(playerid, COLOR_ACTION, "USAGE: /note show [note_id] [playerid ILI ime]");
  102.  
  103.         if(!IsPlayerConnected(playerb))return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} Taj igrac nije konektovan.");
  104.         if(!GetDistanceBetweenPlayers(playerid, playerb, 4.5)) return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} Morate biti blize tom igracu.");
  105.  
  106.         if(!NoteData[playerid][noteid][NoteID])return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} There isn't a note there.");
  107.  
  108.         format(string, sizeof(string), "[Notes] Note(%d) says: %s", noteid, NoteData[playerid][noteid][NoteDetail]);
  109.         SendClientMessage(playerb, COLOR_ACTION, string);
  110.  
  111.         SendNearbyMessage(playerid, 20.0, COLOR_EMOTE, "* %s shows %s a piece of paper.", ReturnName(playerid, 0), ReturnName(playerb, 0));
  112.     }
  113.     else if(!strcmp(sub_param, "add")){
  114.         new addtext[128], noteid;
  115.  
  116.         if(sscanf(sub_z_param, "ds[128]", noteid, addtext))
  117.             return SendClientMessage(playerid, COLOR_ACTION, "USAGE: /note add [note_id] [text]");
  118.  
  119.         if(!NoteData[playerid][noteid][NoteID])return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} There isn't a note there.");
  120.  
  121.         format(string, sizeof(string), "[Notes] Note(%d) now says: %s", noteid, addtext);
  122.         SendClientMessage(playerid, COLOR_ACTION, string);
  123.  
  124.         format(NoteData[playerid][noteid][NoteDetail], 128, "%s", addtext);
  125.  
  126.         mysql_format(m_Handle, query, sizeof(query), "UPDATE player_notes SET details = '%e' WHERE id = %i",
  127.             NoteData[playerid][noteid][NoteDetail], NoteData[playerid][noteid][NoteSQLID]);
  128.         mysql_tquery(m_Handle, query);
  129.     }
  130.     else if(!strcmp(sub_param, "delete")){
  131.         new noteid;
  132.  
  133.         if(sscanf(sub_z_param, "d", noteid))
  134.             return SendClientMessage(playerid, COLOR_ACTION, "USAGE: /note delete [note_id]");
  135.  
  136.         if(!NoteData[playerid][noteid][NoteID])return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} There isn't a note there.");
  137.  
  138.         format(string, sizeof(string), "You deleted Note(%d): %s", noteid, NoteData[playerid][noteid][NoteDetail]);
  139.         SendClientMessage(playerid, COLOR_ACTION, string);
  140.  
  141.         mysql_format(m_Handle, query, sizeof(query), "DELETE FROM player_notes WHERE id = %i", NoteData[playerid][noteid][NoteSQLID]);
  142.         mysql_tquery(m_Handle, query);
  143.  
  144.         NoteData[playerid][noteid][NoteID] = 0;
  145.         NoteData[playerid][noteid][NoteSQLID] = 0;
  146.     }
  147.     return true;
  148. }
  149.  
  150. CMD:colorlist(playerid, params[])
  151. {
  152.     if(!pLoggedIn[playerid])return true;
  153.  
  154.     new color_list[4000];
  155.     color_list[0] = EOS;
  156.  
  157.     for(new colorid = 0; colorid != sizeof(VehicleColoursTableRGBA); colorid++)
  158.     {
  159.         format(color_list, sizeof(color_list), "%s{%06x}Color %03d%s", color_list, VehicleColoursTableRGBA[colorid] >>> 8, colorid, !((colorid + 1) % 21) ? ("\n") : (" "));
  160.     }
  161.  
  162.     ShowPlayerDialog(playerid, DIALOG_USE, DIALOG_STYLE_MSGBOX, "Color List", color_list, "<<", "");
  163.  
  164.     return true;
  165. }
  166.  
  167. CMD:contacts(playerid, params[])
  168. {
  169.     if(!pLoggedIn[playerid])return true;
  170.     if(PlayerData[playerid][pPhoneOff])return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} Your cellphone has to be on to use this.");
  171.  
  172.     new a_string[128], b_string[128], string[128], query[177];
  173.  
  174.     if(sscanf(params, "s[128]S()[128]", a_string, b_string))
  175.     {
  176.         SendClientMessage(playerid, COLOR_ACTION, "USAGE: /contacts [action]");
  177.         SendClientMessage(playerid, COLOR_ACTION, "/contacts create [name] [number] - Create a contact.");
  178.         SendClientMessage(playerid, COLOR_ACTION, "/contacts delete [contact id] - Delete a contact.");
  179.         SendClientMessage(playerid, COLOR_ACTION, "/contacts show [playerid ILI ime] [contact id] - Show to another player.");
  180.         SendClientMessage(playerid, COLOR_ACTION, "/contacts display - Display all contacts.");
  181.         SendClientMessage(playerid, COLOR_ACTION, "/contacts edit [contact id] [name] [phone] - Edit a contact.");
  182.         return true;
  183.     }
  184.  
  185.     if(!strcmp(a_string, "create")){
  186.         new c_name[128], c_num, c_id;
  187.  
  188.         if(sscanf(b_string, "s[128]d", c_name, c_num))
  189.             return SendClientMessage(playerid, COLOR_ACTION, "USAGE: /contacts create [name of contact] [number of contact]");
  190.  
  191.         if(c_num == 911 || c_num == WEAPON_ORDER_NUMBER || c_num == MECHANIC_NUMBER || c_num == TAXI_NUMBER)
  192.             return SendClientMessage(playerid, COLOR_ADM, "ERROR: We don't allow those numbers as contacts.");
  193.  
  194.         for(new i = 1; i < MAX_PLAYER_CONTACTS; i++){
  195.             if(!ContactsData[playerid][i][contactID]){
  196.                 c_id = i;
  197.                 break;
  198.             }
  199.         }
  200.  
  201.         format(string, sizeof(string), "* %s takes out their cellphone.", ReturnName(playerid, 0));
  202.         SetPlayerChatBubble(playerid, string, COLOR_EMOTE, 20.0, 3000);
  203.         SendClientMessage(playerid, COLOR_EMOTE, string);
  204.  
  205.         format(string, sizeof(string), "You created a contact ( %d )!", c_id);
  206.         SendClientMessage(playerid, COLOR_ACTION, string);
  207.  
  208.         contact_save_id[playerid] = c_id;
  209.  
  210.         mysql_format(m_Handle, query, sizeof(query), "INSERT INTO player_contacts (`playersqlid`, `contactid`, `contact_name`, `contact_num`) VALUES(%i, %i, '%e', %i)",
  211.             PlayerData[playerid][pSQLID], c_id, c_name, c_num);
  212.         mysql_pquery(m_Handle, query, "SQL_AddPlayerContact", "i", playerid);
  213.  
  214.         ContactsData[playerid][c_id][contactID] = c_id;
  215.         format(ContactsData[playerid][c_id][contactName], 128, "%s", c_name);
  216.         ContactsData[playerid][c_id][contactNumber] = c_num;
  217.     }
  218.     else if(!strcmp(a_string, "delete")){
  219.         new c_id;
  220.  
  221.         if(sscanf(b_string, "d", c_id))return SendClientMessage(playerid, COLOR_ACTION, "USAGE: /contacts delete [contact id]");
  222.  
  223.         if(c_id < 1 || c_id > MAX_PLAYER_NOTES)return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} That contact doesn't exist.");
  224.         if(!ContactsData[playerid][c_id][contactID])return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} That contact doesn't exist.");
  225.  
  226.         mysql_format(m_Handle, query, sizeof(query), "DELETE FROM player_contacts WHERE id = %i", ContactsData[playerid][c_id][contactSQLID]);
  227.         mysql_pquery(m_Handle, query);
  228.  
  229.         ContactsData[playerid][c_id][contactID] = 0;
  230.         ContactsData[playerid][c_id][contactSQLID] = 0;
  231.  
  232.         format(string, sizeof(string), "* %s takes out their cellphone.", ReturnName(playerid, 0));
  233.         SetPlayerChatBubble(playerid, string, COLOR_EMOTE, 20.0, 3000);
  234.         SendClientMessage(playerid, COLOR_EMOTE, string);
  235.     }
  236.     else if(!strcmp(a_string, "show")){
  237.         new c_id, playerb;
  238.  
  239.         if(sscanf(b_string, "ud", playerb, c_id))
  240.             return SendClientMessage(playerid, COLOR_ACTION, "USAGE: /contacts show [playerid ILI ime] [contact id]");
  241.  
  242.         if(!IsPlayerConnected(playerb))return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You specified an invalid playerid ILI ime.");
  243.         if(!pLoggedIn[playerb])return SendClientMessage(playerid, COLOR_ADM, "That player hasn't logged in yet.");
  244.  
  245.         if(!GetDistanceBetweenPlayers(playerid, playerb, 4.5)) return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} Morate biti blize tom igracu.");
  246.  
  247.         if(c_id < 1 || c_id > MAX_PLAYER_NOTES)return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} That contact doesn't exist.");
  248.         if(!ContactsData[playerid][c_id][contactID])return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} That contact doesn't exist.");
  249.  
  250.         format(string, sizeof(string), "* %s shows %s their cellphone.", ReturnName(playerid, 0), ReturnName(playerb, 0));
  251.         SetPlayerChatBubble(playerid, string, COLOR_EMOTE, 20.0, 3000);
  252.         SendClientMessage(playerid, COLOR_EMOTE, string);
  253.  
  254.         format(string, sizeof(string), "Contact(%d): Name: %s : Number: %d", c_id, ContactsData[playerid][c_id][contactName], ContactsData[playerid][c_id][contactNumber]);
  255.         SendClientMessage(playerb, COLOR_ACTION, string);
  256.     }
  257.     else if(!strcmp(a_string, "display"))
  258.     {
  259.         new found = 0;
  260.         for(new i = 1; i < MAX_PLAYER_CONTACTS; i++)
  261.         {
  262.             if(ContactsData[playerid][i][contactID] != 0)
  263.             {
  264.                 if(!isnull(ContactsData[playerid][i][contactName]))
  265.                 {
  266.                     format(string, sizeof(string), "Contact(%d): Name: %s : Number: %d", i, ContactsData[playerid][i][contactName], ContactsData[playerid][i][contactNumber]);
  267.                     SendClientMessage(playerid, COLOR_ACTION, string);
  268.                     found = 1;
  269.                 }
  270.             }
  271.         }
  272.         if(found == 0)SendClientMessage(playerid, COLOR_ACTION, "You don't have any contacts ( /contacts create )!");
  273.     }
  274.     else if(!strcmp(a_string, "edit")){
  275.         new c_id, c_name[128], c_num;
  276.  
  277.         if(sscanf(b_string, "ds[128]d", c_id, c_name, c_num))
  278.             return SendClientMessage(playerid, COLOR_ACTION, "USAGE: /contacts edit [contact id] [contact name] [contact number]");
  279.  
  280.         if(!ContactsData[playerid][c_id][contactID])return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} That contact doesn't exist.");
  281.  
  282.         mysql_format(m_Handle, query, sizeof(query), "UPDATE player_contacts SET contact_name = '%e', contact_num = %i WHERE id = %i",
  283.             c_name, c_num, ContactsData[playerid][c_id][contactSQLID]);
  284.         mysql_pquery(m_Handle, query);
  285.  
  286.         format(ContactsData[playerid][c_id][contactName], 128, "%s", c_name);
  287.         ContactsData[playerid][c_id][contactNumber] = c_num;
  288.  
  289.         format(string, sizeof(string), "* %s takes out their cellphone.", ReturnName(playerid, 0));
  290.         SetPlayerChatBubble(playerid, string, COLOR_EMOTE, 20.0, 3000);
  291.         SendClientMessage(playerid, COLOR_EMOTE, string);
  292.  
  293.         SendClientMessage(playerid, COLOR_ADM, "You edited your contact page.");
  294.     }
  295.     return true;
  296. }
  297.  
  298. CMD:weapon(playerid, params[])
  299. {
  300.     new string[128], specifier[40], specifierex[40];
  301.  
  302.     if (sscanf(params, "s[40]S()[40]", specifier, specifierex))
  303.     {
  304.         SendClientMessage(playerid, COLOR_ADM, "USAGE:{FFFFFF} /weapon [adjust, bone, hide, reset] [weapon id]");
  305.         SendClientMessage(playerid, COLOR_ADM, "TIP:{FFFFFF} Use /weapon hide [id] to hide smaller weapons from being seen.");
  306.         return true;
  307.     }
  308.  
  309.     if (!strcmp(specifier, "hide"))
  310.     {
  311.         new id, query[450];
  312.  
  313.         if (sscanf(specifierex, "d", id))
  314.             return SendClientMessage(playerid, COLOR_ADM, "USAGE:{FFFFFF} /weapon hide [weapon id]");
  315.  
  316.         if (!IsValidDisplayWeapon(id))
  317.             return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You specified a weapon ID that can't be edited.");
  318.  
  319.         if (NotHideableWeapon(id))
  320.             return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} This is a weapon you can't hide.");
  321.  
  322.         if (WeaponDisplay[playerid][id][weaponHidden])
  323.         {
  324.             WeaponDisplay[playerid][id][weaponHidden] = false;
  325.  
  326.             format (string, sizeof(string), "You've shown your %s.", ReturnWeaponName(id));
  327.             SendClientMessage(playerid, COLOR_ADM, string);
  328.         }
  329.         else
  330.         {
  331.             WeaponDisplay[playerid][id][weaponHidden] = true;
  332.             if (IsPlayerAttachedObjectSlotUsed(playerid, ReturnWeaponsSlot(id))) RemovePlayerAttachedObject(playerid, ReturnWeaponsSlot(id));
  333.  
  334.             format (string, sizeof(string), "You've hidden your %s.", ReturnWeaponName(id));
  335.             SendClientMessage(playerid, COLOR_ADM, string);
  336.         }
  337.  
  338.         mysql_format(m_Handle, query, sizeof(query), "INSERT INTO weapon_attachments(playerdbid, weaponid, boneid, PosX, PosY, PosZ, RotX, RotY, RotZ, Hidden) VALUES(%i, %i, %i, %f, %f, %f, %f, %f, %f, %i) ON DUPLICATE KEY UPDATE boneid = %i, PosX = %f, PosY = %f, PosZ = %f, RotX = %f, RotY = %f, RotZ = %f, Hidden = %i",
  339.                 PlayerData[playerid][pSQLID], id, WeaponDisplay[playerid][id][weaponBone], -0.055998, 0.188999, 0.053998, 0.000000, 44.500007, 0.000000, WeaponDisplay[playerid][id][weaponHidden], WeaponDisplay[playerid][id][weaponBone], WeaponDisplay[playerid][id][weaponPos][0], WeaponDisplay[playerid][id][weaponPos][1], WeaponDisplay[playerid][id][weaponPos][2], WeaponDisplay[playerid][id][weaponRot][0], WeaponDisplay[playerid][id][weaponRot][1], WeaponDisplay[playerid][id][weaponRot][2], WeaponDisplay[playerid][id][weaponHidden]);
  340.  
  341.         mysql_tquery(m_Handle, query);
  342.     }
  343.     else if (!strcmp(specifier, "adjust"))
  344.     {
  345.         new id;
  346.         new WEAPON_INDEX;
  347.  
  348.         if (EditingDisplay[playerid])
  349.             return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You're already editing a weapon.");
  350.  
  351.         if (sscanf(specifierex, "d", id))
  352.             return SendClientMessage(playerid, COLOR_ADM, "USAGE:{FFFFFF} /weapon adjust [weapon id]");
  353.  
  354.         if(Weapon[playerid][WEAPON_INDEX][eWeaponID] < 0)
  355.         return SendClientMessage(playerid, COLOR_ADM, "You cannot adjust the position of a weapon you do not have");
  356.  
  357.         if (!IsValidDisplayWeapon(id))
  358.             return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You specified a weapon ID that can't be edited.");
  359.  
  360.         EditingDisplay[playerid] = id;
  361.  
  362.         if (IsPlayerAttachedObjectSlotUsed(playerid, ReturnWeaponsSlot(id))) RemovePlayerAttachedObject(playerid, ReturnWeaponsSlot(id));
  363.         SetPlayerArmedWeapon(playerid, 0);
  364.  
  365.         SetPlayerAttachedObject(playerid, ReturnWeaponsSlot(id), GetGunObjectID(id), WeaponDisplay[playerid][id][weaponBone], WeaponDisplay[playerid][id][weaponPos][0], WeaponDisplay[playerid][id][weaponPos][1], WeaponDisplay[playerid][id][weaponPos][2],
  366.                 WeaponDisplay[playerid][id][weaponRot][0], WeaponDisplay[playerid][id][weaponRot][1], WeaponDisplay[playerid][id][weaponRot][2]);
  367.  
  368.         EditAttachedObject(playerid, ReturnWeaponsSlot(id));
  369.     }
  370.     else if(!strcmp(specifier, "bone"))
  371.     {
  372.         new
  373.             id, bone, query[350];
  374.  
  375.         if (EditingDisplay[playerid])
  376.             return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} Stop editing your weapon first.");
  377.  
  378.         if (sscanf(specifierex, "ii", id, bone))
  379.         {
  380.             SendClientMessage(playerid, COLOR_ADM, "USAGE: /weapon bone [weapon id] [bone]");
  381.             SendClientMessage(playerid, COLOR_WHITE, "Bone: 1 - Spine, 2 - Head, 3 - Upper L Arm, 4 - Upper R Arm, 5 - Left Hand");
  382.             SendClientMessage(playerid, COLOR_WHITE, "Bone: 6 - Right Hand, 7 - Left Thigh, 8 - Right Thigh, 9 - Left Foot, 10 - Right Foot");
  383.             return 1;
  384.         }
  385.  
  386.         if (!IsValidDisplayWeapon(id))
  387.             return SendClientMessage(playerid, COLOR_ADM, "ERROR: You specified a weapon ID that can't be edited.");
  388.  
  389.         if(bone < 1 || bone > 10)
  390.             return SendClientMessage(playerid, COLOR_ADM, "ERROR: You specified an invalid bone.");
  391.  
  392.         mysql_format(m_Handle, query, sizeof(query), "INSERT INTO weapon_attachments(playerdbid, weaponid, boneid, PosX, PosY, PosZ, RotX, RotY, RotZ, Hidden) VALUES(%i, %i, %i, %f, %f, %f, %f, %f, %f, %i) ON DUPLICATE KEY UPDATE boneid = %i, PosX = %f, PosY = %f, PosZ = %f, RotX = %f, RotY = %f, RotZ = %f, Hidden = %i",
  393.                 PlayerData[playerid][pSQLID], id, bone, -0.055998, 0.188999, 0.053998, 0.000000, 44.500007, 0.000000, WeaponDisplay[playerid][id][weaponHidden], bone, WeaponDisplay[playerid][id][weaponPos][0], WeaponDisplay[playerid][id][weaponPos][1], WeaponDisplay[playerid][id][weaponPos][2], WeaponDisplay[playerid][id][weaponRot][0], WeaponDisplay[playerid][id][weaponRot][1], WeaponDisplay[playerid][id][weaponRot][2], WeaponDisplay[playerid][id][weaponHidden]);
  394.  
  395.         mysql_tquery(m_Handle, query);
  396.  
  397.         if(IsPlayerAttachedObjectSlotUsed(playerid, ReturnWeaponsSlot(id)))
  398.         {
  399.             RemovePlayerAttachedObject(playerid, ReturnWeaponsSlot(id));
  400.  
  401.             SetPlayerAttachedObject(playerid, ReturnWeaponsSlot(id), GetGunObjectID(id), WeaponDisplay[playerid][id][weaponBone], WeaponDisplay[playerid][id][weaponPos][0], WeaponDisplay[playerid][id][weaponPos][1], WeaponDisplay[playerid][id][weaponPos][2],
  402.                 WeaponDisplay[playerid][id][weaponRot][0], WeaponDisplay[playerid][id][weaponRot][1], WeaponDisplay[playerid][id][weaponRot][2]);
  403.  
  404.             WeaponDisplay[playerid][id][weaponBone] = bone;
  405.         }
  406.         else WeaponDisplay[playerid][id][weaponBone] = bone;
  407.         SendClientMessage(playerid, COLOR_ADM, "Your weapons bone was updated.");
  408.     }
  409.     else if(!strcmp(specifier, "reset"))
  410.     {
  411.         new
  412.             id,
  413.             query[350];
  414.  
  415.         if (EditingDisplay[playerid])
  416.             return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} Stop editing your weapon first.");
  417.  
  418.         if(sscanf(specifierex, "i", id))
  419.             return SendClientMessage(playerid, COLOR_ADM, "USAGE: /weapon reset [weapon id]");
  420.  
  421.         if (!IsValidDisplayWeapon(id))
  422.             return SendClientMessage(playerid, COLOR_ADM, "ERROR: You specified a weapon ID that can't be edited.");
  423.  
  424.         WeaponDisplay[playerid][id][weaponBone] = 1;
  425.  
  426.         WeaponDisplay[playerid][id][weaponPos][0] = -0.055998;
  427.         WeaponDisplay[playerid][id][weaponPos][1] = 0.188999;
  428.         WeaponDisplay[playerid][id][weaponPos][2] = 0.053998;
  429.  
  430.         WeaponDisplay[playerid][id][weaponRot][0] = 0.000000;
  431.         WeaponDisplay[playerid][id][weaponRot][1] = 44.500007;
  432.         WeaponDisplay[playerid][id][weaponRot][2] = 0.000000;
  433.  
  434.         mysql_format(m_Handle, query, sizeof(query), "INSERT INTO weapon_attachments(playerdbid, weaponid, boneid, PosX, PosY, PosZ, RotX, RotY, RotZ, Hidden) VALUES(%i, %i, %i, %f, %f, %f, %f, %f, %f, %i) ON DUPLICATE KEY UPDATE boneid = %i, PosX = %f, PosY = %f, PosZ = %f, RotX = %f, RotY = %f, RotZ = %f, Hidden = %i",
  435.                 PlayerData[playerid][pSQLID], id, WeaponDisplay[playerid][id][weaponBone], -0.055998, 0.188999, 0.053998, 0.000000, 44.500007, 0.000000, WeaponDisplay[playerid][id][weaponHidden], WeaponDisplay[playerid][id][weaponBone], WeaponDisplay[playerid][id][weaponPos][0], WeaponDisplay[playerid][id][weaponPos][1], WeaponDisplay[playerid][id][weaponPos][2], WeaponDisplay[playerid][id][weaponRot][0], WeaponDisplay[playerid][id][weaponRot][1], WeaponDisplay[playerid][id][weaponRot][2], WeaponDisplay[playerid][id][weaponHidden]);
  436.  
  437.         mysql_tquery(m_Handle, query);
  438.  
  439.         if(IsPlayerAttachedObjectSlotUsed(playerid, ReturnWeaponsSlot(id)))
  440.         {
  441.             RemovePlayerAttachedObject(playerid, ReturnWeaponsSlot(id));
  442.  
  443.             SetPlayerAttachedObject(playerid, ReturnWeaponsSlot(id), GetGunObjectID(id), WeaponDisplay[playerid][id][weaponBone], WeaponDisplay[playerid][id][weaponPos][0], WeaponDisplay[playerid][id][weaponPos][1], WeaponDisplay[playerid][id][weaponPos][2],
  444.                 WeaponDisplay[playerid][id][weaponRot][0], WeaponDisplay[playerid][id][weaponRot][1], WeaponDisplay[playerid][id][weaponRot][2]);
  445.         }
  446.  
  447.         Message(playerid, COLOR_ADM, "Your %s was reset to a default position.", ReturnWeaponName(id));
  448.     }
  449.     else return SendClientMessage(playerid, COLOR_ADM, "SERVER: Nevazeca opcija.");
  450.     return true;
  451. }
  452.  
  453. CMD:boombox(playerid, params[])
  454. {
  455.     new string[128], specifier[40], specifier_ex[40];
  456.  
  457.     if (sscanf(params, "s[40]S()[40]", specifier, specifier_ex))
  458.     {
  459.         SendClientMessage(playerid, COLOR_ADM, "USAGE:{FFFFFF} /boombox [action]");
  460.         SendClientMessage(playerid, COLOR_ADM, "[Action] place, adjust, destroy, pickup, giveto");
  461.         SendClientMessage(playerid, COLOR_ADM, "** Use /setstation to set the station. **");
  462.         return true;
  463.     }
  464.  
  465.     if (!PlayerData[playerid][pHasBoombox])
  466.         return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You don't have a Boombox.");
  467.  
  468.     if (!strcmp(specifier, "place"))
  469.     {
  470.         new bool:alreadyPlaced = false, bool:nearbyBoombox = false, id = FreeBoomboxID();
  471.  
  472.         if (id == -1)
  473.             return SendClientMessage(playerid, COLOR_ADM, "SERVER: You can't place Boombox's right now. Try again later. (Max 30)");
  474.  
  475.         for (new i = 1; i < MAX_BOOMBOXS; i++)
  476.         {
  477.             if (BoomboxData[i][boomboxExists])
  478.             {
  479.                 if (BoomboxData[i][boomboxPlayerID] == PlayerData[playerid][pSQLID])
  480.                 {
  481.                     alreadyPlaced = true;
  482.                 }
  483.             }
  484.         }
  485.  
  486.         if(alreadyPlaced == true)
  487.             return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You already have a boombox placed.");
  488.  
  489.         for (new i = 1; i < MAX_BOOMBOXS; i++)
  490.         {
  491.             if (BoomboxData[i][boomboxExists])
  492.             {
  493.                 if (IsPlayerInRangeOfPoint(playerid, 20.0, BoomboxData[i][boomboxPos][0], BoomboxData[i][boomboxPos][1], BoomboxData[i][boomboxPos][2]))
  494.                 {
  495.                     nearbyBoombox = true;
  496.                 }
  497.             }
  498.         }
  499.  
  500.         if (nearbyBoombox == true)
  501.             return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} There's already a boombox placed near you. You need to get away from it.");
  502.  
  503.         GetPlayerPos(playerid, PlayerData[playerid][pPos][0], PlayerData[playerid][pPos][1], PlayerData[playerid][pPos][2]);
  504.  
  505.         BoomboxData[id][boomboxArea] = CreateDynamicCircle(PlayerData[playerid][pPos][0], PlayerData[playerid][pPos][1], 30.0, GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid));
  506.  
  507.         BoomboxData[id][boomboxObject] = CreateDynamicObject(2226, PlayerData[playerid][pPos][0], PlayerData[playerid][pPos][1], PlayerData[playerid][pPos][2] - 1, 0.0, 0.0, 0.0,
  508.             GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid));
  509.  
  510.         BoomboxData[id][boomboxExists] = true;
  511.         BoomboxData[id][boomboxPlayerID] = PlayerData[playerid][pSQLID];
  512.         BoomboxData[id][boomboxPos][0] = PlayerData[playerid][pPos][0];
  513.         BoomboxData[id][boomboxPos][1] = PlayerData[playerid][pPos][1];
  514.         BoomboxData[id][boomboxPos][2] = PlayerData[playerid][pPos][2];
  515.  
  516.         SendClientMessage(playerid, COLOR_DARKGREEN, "You put down a Boombox. To move it, use /boombox adjust while near it. /setstation");
  517.     }
  518.     else if (!strcmp(specifier, "adjust"))
  519.     {
  520.         new bool:nearBoombox, id;
  521.  
  522.         for (new i = 1; i < MAX_BOOMBOXS; i++)
  523.         {
  524.             if (BoomboxData[i][boomboxExists])
  525.             {
  526.                 if (IsPlayerInRangeOfPoint(playerid, 4.0, BoomboxData[i][boomboxPos][0], BoomboxData[i][boomboxPos][1], BoomboxData[i][boomboxPos][2]))
  527.                 {
  528.                     if (BoomboxData[i][boomboxPlayerID] != PlayerData[playerid][pSQLID])
  529.                         return SendClientMessage(playerid, COLOR_ADM, "You don't own this boombox.");
  530.  
  531.                     nearBoombox = true;
  532.                     id = i;
  533.                 }
  534.             }
  535.         }
  536.  
  537.         if(nearBoombox == false)
  538.             return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You aren't near a boombox.");
  539.  
  540.         EditDynamicObject(playerid, BoomboxData[id][boomboxObject]);
  541.         EditingBoombox[playerid] = id;
  542.     }
  543.     else if (!strcmp(specifier, "destroy"))
  544.     {
  545.         new bool:nearBoombox, id;
  546.  
  547.         for (new i = 1; i < MAX_BOOMBOXS; i++)
  548.         {
  549.             if (BoomboxData[i][boomboxExists])
  550.             {
  551.                 if (IsPlayerInRangeOfPoint(playerid, 4.0, BoomboxData[i][boomboxPos][0], BoomboxData[i][boomboxPos][1], BoomboxData[i][boomboxPos][2]))
  552.                 {
  553.                     if (BoomboxData[i][boomboxPlayerID] != PlayerData[playerid][pSQLID])
  554.                         return SendClientMessage(playerid, COLOR_ADM, "You don't own this boombox.");
  555.  
  556.                     nearBoombox = true;
  557.                     id = i;
  558.                 }
  559.             }
  560.         }
  561.  
  562.         if(nearBoombox == false)
  563.             return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You aren't near a boombox.");
  564.  
  565.         SendClientMessage(playerid, COLOR_ADM, "You destroyed your Boombox.");
  566.  
  567.         foreach (new i : Player)
  568.         {
  569.             if(pLoggedIn[i])
  570.             {
  571.                 if (IsPlayerInRangeOfPoint(i, 10.0, BoomboxData[id][boomboxPos][0], BoomboxData[id][boomboxPos][1], BoomboxData[id][boomboxPos][2]))
  572.                 {
  573.                     StopAudioStreamForPlayer(i);
  574.                 }
  575.             }
  576.         }
  577.  
  578.         RemoveBoombox(id);
  579.         DestroyDynamicObject(BoomboxData[id][boomboxObject]);
  580.         PlayerData[playerid][pHasBoombox] = false;
  581.     }
  582.     else if (!strcmp(specifier, "pickup"))
  583.     {
  584.         new bool:nearBoombox, id;
  585.  
  586.         for (new i = 1; i < MAX_BOOMBOXS; i++)
  587.         {
  588.             if (BoomboxData[i][boomboxExists])
  589.             {
  590.                 if (IsPlayerInRangeOfPoint(playerid, 4.0, BoomboxData[i][boomboxPos][0], BoomboxData[i][boomboxPos][1], BoomboxData[i][boomboxPos][2]))
  591.                 {
  592.                     if (BoomboxData[i][boomboxPlayerID] != PlayerData[playerid][pSQLID])
  593.                         return SendClientMessage(playerid, COLOR_ADM, "You don't own this boombox.");
  594.  
  595.                     nearBoombox = true;
  596.                     id = i;
  597.                 }
  598.             }
  599.         }
  600.  
  601.         if(nearBoombox == false)
  602.             return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You aren't near a boombox.");
  603.  
  604.         SendClientMessage(playerid, COLOR_ADM, "You picked up your Boombox. Use /boombox place later");
  605.  
  606.         foreach (new i : Player)
  607.         {
  608.             if(pLoggedIn[i])
  609.             {
  610.                 if (IsPlayerInRangeOfPoint(i, 10.0, BoomboxData[id][boomboxPos][0], BoomboxData[id][boomboxPos][1], BoomboxData[id][boomboxPos][2]))
  611.                 {
  612.                     StopAudioStreamForPlayer(i);
  613.                 }
  614.             }
  615.         }
  616.  
  617.         RemoveBoombox(id);
  618.         DestroyDynamicObject(BoomboxData[id][boomboxObject]);
  619.     }
  620.     else if (!strcmp(specifier, "giveto"))
  621.     {
  622.         new bool:nearBoombox, id, playerb;
  623.  
  624.         for (new i = 1; i < MAX_BOOMBOXS; i++)
  625.         {
  626.             if (BoomboxData[i][boomboxExists])
  627.             {
  628.                 if (IsPlayerInRangeOfPoint(playerid, 4.0, BoomboxData[i][boomboxPos][0], BoomboxData[i][boomboxPos][1], BoomboxData[i][boomboxPos][2]))
  629.                 {
  630.                     if (BoomboxData[i][boomboxPlayerID] != PlayerData[playerid][pSQLID])
  631.                         return SendClientMessage(playerid, COLOR_ADM, "You don't own this boombox.");
  632.  
  633.                     nearBoombox = true;
  634.                     id = i;
  635.                 }
  636.             }
  637.         }
  638.  
  639.         if(nearBoombox == false)
  640.             return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You aren't near a boombox.");
  641.  
  642.         if (sscanf(specifier_ex, "u", playerb))
  643.             return SendClientMessage(playerid, COLOR_ADM, "USAGE:{FFFFFF} /boombox giveto [playerid/DioImena]");
  644.  
  645.         if (!IsPlayerConnected(playerb))
  646.             return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You specified a player that isn't connected.");
  647.  
  648.         if (!pLoggedIn[playerb])
  649.             return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} Taj igrac nije ulogovan.");
  650.  
  651.         if (PlayerData[playerb][pHasBoombox])
  652.             return SendClientMessage(playerid, COLOR_ADM, "That player already owns a boombox.");
  653.  
  654.         BoomboxData[id][boomboxPlayerID] = PlayerData[playerb][pSQLID];
  655.  
  656.         format (string, sizeof(string), "* %s gave %s their Boombox.", ReturnName(playerid, 0), ReturnName(playerb, 0));
  657.         SetPlayerChatBubble(playerid, string, COLOR_EMOTE, 20.0, 3000);
  658.  
  659.         format (string, sizeof(string), "** You gave %s your Boombox.", ReturnName(playerb, 0));
  660.         SendClientMessage(playerid, COLOR_DARKGREEN, string);
  661.  
  662.         PlayerData[playerid][pHasBoombox] = false;
  663.     }
  664.     else return SendClientMessage(playerid, COLOR_ADM, "SERVER: Nevazeca opcija.");
  665.     return true;
  666. }
  667.  
  668. CMD:eat(playerid, params[])
  669. {
  670.     new id = IsPlayerInBusiness(playerid) ;
  671.  
  672.     if (!id)
  673.         return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You aren't in an establishment.");
  674.  
  675.     if (BusinessData[id][businessType] != BIZ_RESTAURANT)
  676.         return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You aren't in a restaurant.");
  677.  
  678.     if (MealMenu[playerid][mealExists] == true)
  679.         return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You already have a meal.");
  680.  
  681.     ShowMealMenu(playerid);
  682.     return true;
  683. }
  684.  
  685. CMD:meal(playerid, params[])
  686. {
  687.     new stringb[90];
  688.  
  689.     if (sscanf(params, "s[90]", stringb))
  690.         return SendClientMessage(playerid, COLOR_ADM, "USAGE:{FFFFFF} /meal [order / place / pickup / throw]");
  691.  
  692.     if (!strcmp(stringb, "order"))
  693.     {
  694.         return cmd_eat(playerid, "");
  695.     }
  696.  
  697.     else if (!strcmp(stringb, "throw"))
  698.     {
  699.         if (!MealMenu[playerid][mealExists])
  700.             return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You don't have a meal.");
  701.  
  702.         if (MealMenu[playerid][mealPlaced] == true)
  703.         {
  704.             if (!IsPlayerInRangeOfPoint(playerid, 4.0, MealMenu[playerid][mealPos][0], MealMenu[playerid][mealPos][1], MealMenu[playerid][mealPos][2]))
  705.                 return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You aren't near your meal tray.");
  706.  
  707.             DestroyDynamicObject(MealMenu[playerid][mealObject]);
  708.             SendNearbyMessage(playerid, 20.0, COLOR_EMOTE, "* %s throws their meal away.", ReturnName(playerid, 0));
  709.  
  710.             MealMenu[playerid][mealExists] = false;
  711.             MealMenu[playerid][mealPlaced] = false;
  712.             return true;
  713.         }
  714.  
  715.         SendNearbyMessage(playerid, 20.0, COLOR_EMOTE, "* %s throws their meal away.", ReturnName(playerid, 0));
  716.  
  717.         MealMenu[playerid][mealExists] = false;
  718.         PlayerData[playerid][pCarryingMeal] = false;
  719.  
  720.         RemovePlayerAttachedObject(playerid, 9);
  721.         SetPlayerSpecialAction(playerid, SPECIAL_ACTION_NONE);
  722.     }
  723.  
  724.     else if (!strcmp(stringb, "place"))
  725.     {
  726.         if (!MealMenu[playerid][mealExists])
  727.             return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You don't have a meal.");
  728.  
  729.         if (MealMenu[playerid][mealPlaced])
  730.             return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You already have a meal placed.");
  731.  
  732.         SendNearbyMessage(playerid, 20.0, COLOR_EMOTE, "* %s places their meal down.", ReturnName(playerid, 0));
  733.  
  734.         RemovePlayerAttachedObject(playerid, 9);
  735.         SetPlayerSpecialAction(playerid, SPECIAL_ACTION_NONE);
  736.  
  737.         new modelid = MealMenu[playerid][mealModel];
  738.         new Float:playersPos[3];
  739.  
  740.         GetPlayerPos(playerid, playersPos[0], playersPos[1], playersPos[2]);
  741.         PlayerData[playerid][pPlacingMeal] = true;
  742.  
  743.         MealMenu[playerid][mealObject] =
  744.             CreateDynamicObject(modelid, playersPos[0] - 1, playersPos[1], playersPos[2], -22.500001, 22.199998, 162.999984, GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid));
  745.  
  746.         EditDynamicObject(playerid, MealMenu[playerid][mealObject]);
  747.     }
  748.     else if (!strcmp(stringb, "pickup"))
  749.     {
  750.         if (!MealMenu[playerid][mealExists])
  751.             return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You don't have a meal.");
  752.  
  753.         if (!MealMenu[playerid][mealPlaced])
  754.             return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You don't have a meal placed.");
  755.  
  756.         if (!IsPlayerInRangeOfPoint(playerid, 4.0, MealMenu[playerid][mealPos][0], MealMenu[playerid][mealPos][1], MealMenu[playerid][mealPos][2]))
  757.                 return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You aren't near your meal tray.");
  758.  
  759.         DestroyDynamicObject(MealMenu[playerid][mealObject]);
  760.  
  761.         SendNearbyMessage(playerid, 20.0, COLOR_EMOTE, "* %s picks up their meal down.", ReturnName(playerid, 0));
  762.         SetPlayerSpecialAction(playerid, SPECIAL_ACTION_CARRY);
  763.  
  764.         SetPlayerAttachedObject(playerid, 9, MealMenu[playerid][mealModel], 1, 0.027000, 0.426000, -0.268000, 127.699913, 119.700027, -66.799972);
  765.  
  766.         MealMenu[playerid][mealPlaced] = false;
  767.         PlayerData[playerid][pCarryingMeal] = true;
  768.     }
  769.  
  770.     else return SendClientMessage(playerid, COLOR_ADM, "SERVER: Nevazeca opcija.");
  771.  
  772.     return true;
  773. }
  774.  
  775. //Vehicle Commands
  776.  
  777. CMD:v(playerid, params[])return cmd_vehicle(playerid, params);
  778. CMD:vehicle(playerid, params[])
  779. {
  780.     if(!pLoggedIn[playerid])return true;
  781.  
  782.     new a_string[60], b_string[128], string[128];
  783.  
  784.     if(sscanf(params, "s[60]S()[128]", a_string, b_string)){
  785.         SendClientMessage(playerid, COLOR_ACTION, "____________________________________________________");
  786.         SendClientMessage(playerid, COLOR_ACTION, "USAGE: /v(ehicle) [action]");
  787.         SendClientMessage(playerid, COLOR_ACTION, "[Actions] get, park, buypark, stats, list");
  788.         SendClientMessage(playerid, COLOR_ACTION, "[Actions] find, tow, faction, buy, trunk, hood");
  789.         SendClientMessage(playerid, COLOR_ACTION, "[Actions] payfines, sell, accept, refill, lights");
  790.         SendClientMessage(playerid, COLOR_ACTION, "[Actions] lock, duplicatekey, (un)register");
  791.         SendClientMessage(playerid, COLOR_ACTION, "[Actions] scrap (warning: permanently deletes your vehicle)");
  792.         SendClientMessage(playerid, COLOR_ACTION, "____________________________________________________");
  793.         return true;
  794.     }
  795.  
  796.     if(!strcmp(a_string, "get") || !strcmp(a_string, "g", true)){
  797.  
  798.         if(_has_vehicle_spawned[playerid])
  799.             return SendClientMessage(playerid, COLOR_ADM, "SERVER: Vec imate vozilo koje je spawnovano.");
  800.  
  801.         if(gettime() - PlayerListShow[playerid] < 3)
  802.             return SendClientMessage(playerid, COLOR_ADM, "You need to wait 3 seconds before using this again.");
  803.  
  804.         if(GetPVarInt(playerid, "Viewing_OwnedCarList") > 0)
  805.             return SendClientMessage(playerid, COLOR_ADM, "You're already looking at it.");
  806.  
  807.         ShowPlayerVehicleList(playerid);
  808.         PlayerListShow[playerid] = gettime();
  809.         return 1;
  810.  
  811.         /*new slotid;
  812.  
  813.         if(sscanf(b_string, "d", slotid))
  814.             return SendClientMessage(playerid, COLOR_ADM, "USAGE:{FFFFFF} /v(ehicle) get [vehicle slot ID]");
  815.  
  816.         if(slotid > MAX_OWNED_CARS || slotid < 1)
  817.             return SendClientMessage(playerid, COLOR_ADM, "SERVER: Invalid Slot.");
  818.  
  819.         if(!PlayerData[playerid][pOwnedCar][slotid])
  820.             return SendClientMessage(playerid, COLOR_ADM, "ERROR: You don't have a vehicle in that slot.");
  821.  
  822.         if(_has_vehicle_spawned[playerid])
  823.             return SendClientMessage(playerid, COLOR_ADM, "SERVER: Vec imate vozilo koje je spawnovano.");
  824.  
  825.         LoadOwnedCars(playerid, slotid);*/
  826.     }
  827.     else if(!strcmp(a_string, "park") || !strcmp(a_string, "p", true)) {
  828.  
  829.         if(!IsPlayerInAnyVehicle(playerid))return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} Niste u vozilu.");
  830.  
  831.         if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You aren't in the driver's seat.");
  832.  
  833.         new vehicleid = GetPlayerVehicleID(playerid);
  834.  
  835.         if(!IsValidPlayerCar(vehicleid))
  836.             return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You can't park this type of vehicle.");
  837.  
  838.         if(PlayerData[playerid][pSQLID] != CarData[vehicleid][carOwnerID])
  839.             return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You don't own this vehicle.");
  840.  
  841.         if(!IsPlayerInRangeOfPoint(playerid, 5.0, CarData[vehicleid][carPos][0], CarData[vehicleid][carPos][1], CarData[vehicleid][carPos][2])){
  842.  
  843.             SetPlayerCheckpoint(playerid, CarData[vehicleid][carPos][0], CarData[vehicleid][carPos][1], CarData[vehicleid][carPos][2], 3.0);
  844.             SendClientMessage(playerid, COLOR_ADM, "You have to be at your vehicle's parking place.");
  845.             SendClientMessage(playerid, COLOR_PINK, "Follow the marker.");
  846.             return true;
  847.         }
  848.  
  849.         for(new i = 1; i < 5; i++)
  850.         {
  851.             if(CarData[vehicleid][carWeapons][i])
  852.             {
  853.                 if(IsValidDynamicObject(CarData[vehicleid][carWeaponObject][i]))
  854.                     DestroyDynamicObject(CarData[vehicleid][carWeaponObject][i]);
  855.             }
  856.         }
  857.  
  858.         foreach(new i : Player)
  859.         {
  860.             if(PlayerPlacingWeapon[i] && PlayerPlacingInVehicle[i] == vehicleid)
  861.             {
  862.                 CancelEdit(i);
  863.  
  864.                 if(IsValidDynamicObject(CarData[ PlayerPlacingInVehicle[i] ][carWeaponObject][PlayerPlacingWeaponSlot[i]]))
  865.                     DestroyDynamicObject(CarData[ PlayerPlacingInVehicle[i] ][carWeaponObject][PlayerPlacingWeaponSlot[i]]);
  866.             }
  867.         }
  868.  
  869.         foreach(new i : Player)
  870.         {
  871.             if(GetPVarInt(i, "DuplicateKey") == CarData[vehicleid][carID])
  872.             {
  873.                 DeletePVar(i, "DuplicateKey");
  874.                 Message(i, COLOR_WHITE, "Your duplicate key to %s's vehicle expired.", ReturnSQLName(CarData[vehicleid][carOwnerID]));
  875.             }
  876.         }
  877.  
  878.         CarData[vehicleid][carExists] = false;
  879.         SaveCar(vehicleid);
  880.  
  881.         _has_vehicle_spawned[playerid] = false;
  882.         _has_spawned_vehicleid[playerid] = 0;
  883.  
  884.         format(string, sizeof(string), "Parked by %s", ReturnName(playerid));
  885.         LogVehicleAction(vehicleid, string);
  886.  
  887.         format(string, sizeof(string), "Your %s was parked.", ReturnVehicleName(vehicleid));
  888.         SendClientMessage(playerid, COLOR_DARKGREEN, string);
  889.  
  890.         SetVehicleHealth(vehicleid, 300);
  891.         DefaultVehicleValues(vehicleid);
  892.         DestroyVehicle(vehicleid);
  893.     }
  894.     else if(!strcmp(a_string, "unregister")) {
  895.  
  896.         new pcar = GetPlayerVehicleID(playerid);
  897.         new Float:x, Float:y, Float:z;
  898.         new engine, lights, alarm, doors, bonnet, boot, objective;
  899.         GetVehicleParamsEx(pcar, engine, lights, alarm, doors, bonnet, boot, objective);
  900.  
  901.         if(IsValidFactionCar(pcar)) return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You can't perform this action on faction vehicles.");
  902.  
  903.         if(!IsPlayerInAnyVehicle(playerid))return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You aren't in a vehicle.");
  904.  
  905.         if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You aren't in the driver's seat.");
  906.  
  907.         if(!IsPlayerInRangeOfPoint(playerid, 5.0, 2520.11, -1485.05, 24.00))
  908.         {
  909.             SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You aren't at the illegal vehicle operations site.");
  910.             SetPlayerCheckpoint(playerid, 2520.11, -1485.05, 24.00, 3.0);
  911.             SendClientMessage(playerid, COLOR_ADM, "SERVER:{FFFFFF} A checkpoint has been placed on your minimap.");
  912.             return 1;
  913.         }
  914.  
  915.         format(CarData[pcar][carPlates], 32, " ");
  916.  
  917.         SetVehicleNumberPlate(pcar, " ");
  918.  
  919.         SaveCar(pcar);
  920.  
  921.         SetVehicleToRespawn(pcar);
  922.         GetPlayerPos(playerid, x, y, z);
  923.         SetVehiclePos(pcar, x, y, z);
  924.        
  925.         PutPlayerInVehicle(playerid, pcar, 0);
  926.         SetVehicleParamsEx(pcar, VEHICLE_PARAMS_ON, lights, alarm, doors, bonnet, boot, objective);
  927.         ToggleVehicleLock(pcar, false);
  928.         CarData[pcar][carLocked] = false;
  929.         GiveMoney(playerid, -500);
  930.         SendClientMessage(playerid, COLOR_ADM, "SERVER:{FFFFFF} Your vehicle is now unregistered at the cost of $500.");
  931.         SendClientMessage(playerid, COLOR_ADM, "SERVER:{FFFFFF} Note that this is illegal and you are breaking the law.");
  932.        
  933.     }
  934.     else if(!strcmp(a_string, "register")){
  935.         new pcar = GetPlayerVehicleID(playerid);
  936.         new Float:x, Float:y, Float:z;
  937.         new rand[3];
  938.         new outcome = 100;
  939.         new engine, lights, alarm, doors, bonnet, boot, objective;
  940.         GetVehicleParamsEx(pcar, engine, lights, alarm, doors, bonnet, boot, objective);
  941.  
  942.         if (!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You aren't in an vehicle.");
  943.         if(PlayerData[playerid][pSQLID] != CarData[pcar][carOwnerID]) return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You don't own this vehicle.");
  944.         if(!IsPlayerInRangeOfPoint(playerid, 5.0, 2520.11, -1485.05, 24.00))
  945.         {
  946.             SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You aren't at the illegal vehicle operations site.");
  947.             SetPlayerCheckpoint(playerid, 2520.11, -1485.05, 24.00, 3.0);
  948.             SendClientMessage(playerid, COLOR_ADM, "SERVER:{FFFFFF} A checkpoint has been placed on your minimap.");
  949.             return 1;
  950.         }
  951.         rand[0] = random(sizeof(PlatePossible));
  952.         rand[1] = random(sizeof(PlatePossible));
  953.         rand[2] = random(sizeof(PlatePossible));
  954.  
  955.         format(CarData[pcar][carPlates], 32, "%d%s%s%s%d%d%d", random(9), PlatePossible[rand[0]], PlatePossible[rand[1]], PlatePossible[rand[2]], random(9), random(9), random(9));
  956.  
  957.         SetVehicleNumberPlate(pcar, CarData[pcar][carPlates]);
  958.         SaveCar(pcar);
  959.         SetVehicleToRespawn(pcar);
  960.         GetPlayerPos(playerid, x, y, z);
  961.         SetVehiclePos(pcar, x, y, z);
  962.         PutPlayerInVehicle(playerid, pcar, 0);
  963.         ToggleVehicleLock(pcar, false);
  964.         CarData[pcar][carLocked] = false;
  965.         SetVehicleParamsEx(pcar, VEHICLE_PARAMS_ON, lights, alarm, doors, bonnet, boot, objective);
  966.         format(string, sizeof(string), "%s registered their vehicle (Vehicle ID %d - new plate: %s).", ReturnName(playerid, 1), pcar, CarData[pcar][carPlates]);
  967.         SendClientMessage(playerid, COLOR_ADM, "This vehicle has been registered to the DMV and is now legal.");
  968.         switch(outcome)
  969.         {
  970.             case 1 .. 49:
  971.             {
  972.                 SendClientMessage(playerid, COLOR_ADM, "The process was plain sailing, you manage to register your vehicle for $1750");
  973.                 GiveMoney(playerid, -1750);
  974.             }
  975.             case 50 .. 100:
  976.             {
  977.                 SendClientMessage(playerid, COLOR_ADM, "It wasn't easy - passing official paperwork without repercussions cost you $2500.");
  978.                 GiveMoney(playerid, -2500);
  979.             }
  980.             default:
  981.             {
  982.                 SendClientMessage(playerid, COLOR_ADM, "You managed to submit the paperwork off yourself for a free registration!");
  983.             }
  984.         }
  985.         adminWarn(3, string);
  986.     }
  987.     else if(!strcmp(a_string, "buypark") || !strcmp(a_string, "bp")) {
  988.  
  989.         if(!IsPlayerInAnyVehicle(playerid))return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You aren't in any vehicle to park.");
  990.  
  991.         if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You aren't in the driver's seat.");
  992.  
  993.         new ownedHouse, freePark = 0, vehicleid = GetPlayerVehicleID(playerid);
  994.  
  995.         if(IsValidPlayerCar(vehicleid)){
  996.  
  997.             if(CarData[vehicleid][carOwnerID] != PlayerData[playerid][pSQLID])return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You don't own this vehicle.");
  998.  
  999.             GetPlayerPos(playerid, CarData[vehicleid][carPos][0], CarData[vehicleid][carPos][1], CarData[vehicleid][carPos][2]);
  1000.             GetVehicleZAngle(vehicleid, CarData[vehicleid][carPos][3]);
  1001.  
  1002.             CarData[vehicleid][carInterior] = GetPlayerInterior(playerid);
  1003.             CarData[vehicleid][carWorld] = GetPlayerVirtualWorld(playerid);
  1004.  
  1005.             for(new i = 0; i < MAX_PROPERTY; i++){
  1006.                 if(PropertyData[i][propertyid] != 0){
  1007.                     if(PropertyData[i][propertyOwnerSQL] == PlayerData[playerid][pSQLID]){
  1008.                         ownedHouse = i;
  1009.                     }
  1010.                 }
  1011.             }
  1012.  
  1013.  
  1014.             if(PlayerData[playerid][pInsideGarage]){
  1015.                 if(GarageData[playerid][garagePropertyID] == ownedHouse){
  1016.                     freePark = 1;
  1017.                 }
  1018.             }
  1019.             else {
  1020.                 for(new i = 0; i < MAX_PROPERTY; i++){
  1021.                     if(PropertyData[i][propertyid] != 0){
  1022.                         if(IsPlayerInRangeOfPoint(playerid, 15.0, PropertyData[i][propertyExterior][0], PropertyData[i][propertyExterior][1], PropertyData[i][propertyExterior][2])){
  1023.                             if(PropertyData[i][propertyOwnerSQL] == PlayerData[playerid][pSQLID]){
  1024.                                 freePark = 1;
  1025.                             }
  1026.                         }
  1027.                     }
  1028.                 }
  1029.             }
  1030.  
  1031.             if(!freePark) {
  1032.                 if(150 > PlayerData[playerid][pMoney])
  1033.                     return SendClientMessage(playerid, COLOR_ADM, "You can't afford this parking. ($150)");
  1034.  
  1035.                 GiveMoney(playerid, -150);
  1036.                 SendClientMessage(playerid, COLOR_DARKGREEN, "Parking place purchased for $150 (Area change).");
  1037.             }
  1038.             else {
  1039.                 SendClientMessage(playerid, COLOR_DARKGREEN, "Parking place changed for free of charge!");
  1040.             }
  1041.         }
  1042.         else if(IsValidFactionCar(vehicleid)){
  1043.             if(PlayerData[playerid][pAdmin] < 3)return SendClientMessage(playerid, COLOR_ADM, "PRISTUP ODBIJEN:{FFFFFF} You can't park this vehicle.");
  1044.  
  1045.             GetVehiclePos(vehicleid, FactionCar[vehicleid][carPos][0], FactionCar[vehicleid][carPos][1], FactionCar[vehicleid][carPos][2]);
  1046.             GetVehicleZAngle(vehicleid, FactionCar[vehicleid][carPos][3]);
  1047.  
  1048.             FactionCar[vehicleid][carInterior] = GetPlayerInterior(playerid);
  1049.             FactionCar[vehicleid][carWorld] = GetPlayerVirtualWorld(playerid);
  1050.  
  1051.             SaveFactionCar(vehicleid);
  1052.             RefreshFactionCar(vehicleid);
  1053.  
  1054.             GiveMoney(playerid, -150);
  1055.             SendClientMessage(playerid, COLOR_DARKGREEN, "Parking place purchased for $150.");
  1056.         }
  1057.         else return SendClientMessage(playerid, COLOR_ADM, "SERVER: This command can only be used for private vehicles. You are in a public static vehicle.");
  1058.  
  1059.     }
  1060.     else if(!strcmp(a_string, "stats")){
  1061.         if (!IsPlayerInAnyVehicle(playerid))return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} Niste u vozilu.");
  1062.  
  1063.         new pcar = GetPlayerVehicleID(playerid);
  1064.         if (CarData[pcar][carOwnerID] != PlayerData[playerid][pSQLID])return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You don't own this vehicle");
  1065.  
  1066.         format(string, sizeof(string), "Life Span: Engine Life[%.2f], Battery Life[%.2f], Times Destroyed[%d]", CarData[pcar][carEngine], CarData[pcar][carBattery], CarData[pcar][carTimeDestroyed]);
  1067.         SendClientMessage(playerid, COLOR_WHITE, string);
  1068.  
  1069.         format(string, sizeof(string), "Security: Lock[%d], Alarm[%d], Immobiliser[%d], Insurance[%d]", CarData[pcar][carLock], CarData[pcar][carAlarm], CarData[pcar][carImmob], CarData[pcar][carInsurance]);
  1070.         SendClientMessage(playerid, COLOR_WHITE, string);
  1071.  
  1072.         format(string, sizeof(string), "Misc: Primary Color[{%06x}%d{FFFFFF}], Secondary Color[{%06x}%d{FFFFFF}], License Plate[%s] ", VehicleColoursTableRGBA[CarData[pcar][carColor1]] >>> 8, CarData[pcar][carColor1], VehicleColoursTableRGBA[CarData[pcar][carColor2]] >>> 8, CarData[pcar][carColor2], CarData[pcar][carPlates]);
  1073.         SendClientMessage(playerid, COLOR_WHITE, string);
  1074.     }
  1075.     else if(!strcmp(a_string, "list"))
  1076.     {
  1077.         if (CountPlayerCars(playerid) == 0)
  1078.             return SendClientMessage(playerid, COLOR_ADM, "SERVER: You don't own any vehicles.");
  1079.  
  1080.         ShowVehicleList(playerid);
  1081.     }
  1082.     else if(!strcmp(a_string, "find")){
  1083.         if(!_has_vehicle_spawned[playerid])return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You don't have a vehicle spawned.");
  1084.  
  1085.         if(!IsVehicleOccupied(_has_spawned_vehicleid[playerid])){
  1086.             new
  1087.                 Float: car_pos[3]
  1088.             ;
  1089.  
  1090.             GetVehiclePos(_has_spawned_vehicleid[playerid], car_pos[0], car_pos[1], car_pos[2]);
  1091.  
  1092.             SetPlayerCheckpoint(playerid, car_pos[0], car_pos[1], car_pos[2], 4.0);
  1093.         }
  1094.         else return SendClientMessage(playerid, COLOR_ADM, "Your vehicle is in use / stolen right now!");
  1095.     }
  1096.     else if(!strcmp(a_string, "tow")){
  1097.         if(!_has_vehicle_spawned[playerid])return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You don't have a vehicle spawned.");
  1098.  
  1099.         if(playerTowingVehicle[playerid])
  1100.             return SendClientMessage(playerid, COLOR_ADM, "You're already towing a vehicle. ");
  1101.  
  1102.         if(!IsVehicleOccupied(_has_spawned_vehicleid[playerid]))
  1103.         {
  1104.             SendClientMessage(playerid, COLOR_DARKGREEN, "Tow Request Sent");
  1105.  
  1106.             vehicleTowSign[_has_spawned_vehicleid[playerid]] =
  1107.                 Create3DTextLabel("(( | ))\nTOWING VEHICLE", COLOR_DARKGREEN, 0.0, 0.0, 0.0, 25.0, 0, 1);
  1108.  
  1109.             Attach3DTextLabelToVehicle(vehicleTowSign[_has_spawned_vehicleid[playerid]], _has_spawned_vehicleid[playerid], -0.0, -0.0, -0.0);
  1110.  
  1111.             playerTowingVehicle[playerid] = true;
  1112.             playerTowTimer[playerid] = SetTimerEx("OnVehicleTow", 4500, true, "i", playerid);
  1113.         }
  1114.         else return SendClientMessage(playerid, COLOR_ADM, "Your vehicle is in use / stolen right now!");
  1115.     }
  1116.     else if(!strcmp(a_string, "faction")){
  1117.         if(PlayerData[playerid][pAdmin] < 3 && PlayerData[playerid][pFactionRank] != 1)
  1118.             return SendClientMessage(playerid, COLOR_ADM, "PRISTUP ODBIJEN:{FFFFFF} You don't have permission to do this.");
  1119.         if(!IsPlayerInAnyVehicle(playerid))return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} Niste u vozilu.");
  1120.  
  1121.         new vehicleid = GetPlayerVehicleID(playerid);
  1122.         new query[256];
  1123.         new Float:currPos[4];
  1124.  
  1125.         GetPlayerPos(playerid, currPos[0], currPos[1], currPos[2]);
  1126.         GetVehicleZAngle(vehicleid, currPos[3]);
  1127.  
  1128.         if(IsValidPlayerCar(vehicleid)) {
  1129.             if(CarData[vehicleid][carOwnerID] != PlayerData[playerid][pSQLID])return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You don't own this vehicle.");
  1130.  
  1131.             Resources[playerid][v_Model] = CarData[vehicleid][carModel];
  1132.             Resources[playerid][v_Faction] = PlayerData[playerid][pFaction];
  1133.             Resources[playerid][v_Color1] = CarData[vehicleid][carColor1];
  1134.             Resources[playerid][v_Color2] = CarData[vehicleid][carColor2];
  1135.             Resources[playerid][v_Pos][0] = currPos[0];
  1136.             Resources[playerid][v_Pos][1] = currPos[1];
  1137.             Resources[playerid][v_Pos][2] = currPos[2];
  1138.             Resources[playerid][v_Pos][3] = currPos[3];
  1139.  
  1140.             mysql_format(m_Handle, query, sizeof(query), "DELETE FROM `ownedcars` WHERE id = %i", CarData[vehicleid][carID]);
  1141.             mysql_query(m_Handle, query);
  1142.  
  1143.             mysql_format(m_Handle, query, sizeof(query), "INSERT INTO `factioncars` (`factionid`, `ModelID`, `PosX`, `PosY`, `PosZ`, `PosA`, `Interior`, `World`, `Color1`, `Color2`) VALUES(%i, %i, %f, %f, %f, %f, %i, %i, %i, %i)",
  1144.                 PlayerData[playerid][pFaction], CarData[vehicleid][carModel], currPos[0], currPos[1], currPos[2], currPos[3], GetPlayerInterior(playerid), GetPlayerVirtualWorld(playerid), CarData[vehicleid][carColor1],
  1145.                 CarData[vehicleid][carColor2]);
  1146.             mysql_pquery(m_Handle, query, "SQL_AddFactionVehicle", "i", playerid);
  1147.  
  1148.             for(new i = 1; i < MAX_OWNED_CARS; i++){
  1149.                 if(PlayerData[playerid][pOwnedCar][i] == CarData[vehicleid][carID]){
  1150.                     PlayerData[playerid][pOwnedCar][i] = 0;
  1151.                 }
  1152.             }
  1153.  
  1154.             DefaultVehicleValues(vehicleid);
  1155.  
  1156.             _has_spawned_vehicleid[playerid] = 0;
  1157.             _has_vehicle_spawned[playerid] = 0;
  1158.  
  1159.             format(string, sizeof(string), "%s made their %s a faction vehicle", ReturnName(playerid, 1), ReturnVehicleName(vehicleid));
  1160.             adminWarn(3, string);
  1161.  
  1162.             format(string, sizeof(string), "Your %s now belongs to the %s. You will no longer own it.", ReturnVehicleName(vehicleid), ReturnFactionName(PlayerData[playerid][pFaction]));
  1163.             SendClientMessage(playerid, COLOR_YELLOW, string);
  1164.  
  1165.             WriteLog("vehicle_logs/factionize_log.txt", "[%s] %s factionized their vehicle to factionid %d", ReturnDate(), ReturnName(playerid, 1), PlayerData[playerid][pFaction]);
  1166.             return true;
  1167.         }
  1168.         else if(AdminCar[vehicleid]) {
  1169.             if(PlayerData[playerid][pAdmin] < 4)return SendClientMessage(playerid, COLOR_ADM, "PRISTUP ODBIJEN:{FFFFFF} You don't have permission to factionize this vehicle.");
  1170.  
  1171.             new factionid;
  1172.  
  1173.             if(sscanf(b_string, "d", factionid))
  1174.                 return SendClientMessage(playerid, COLOR_ADM, "USAGE:{FFFFFF} /v(ehicle) faction [faction_id] - {FF6346}THIS IS AN ADMIN VEHICLE.");
  1175.  
  1176.             new color1 = AdminCarColor1[vehicleid];
  1177.             new color2 = AdminCarColor2[vehicleid];
  1178.  
  1179.             format(string, sizeof(string), "This %s now belongs to the %s.", ReturnVehicleName(vehicleid), ReturnFactionName(factionid));
  1180.             SendClientMessage(playerid, COLOR_YELLOW, string);
  1181.  
  1182.             AdminCar[vehicleid] = false;
  1183.  
  1184.             Resources[playerid][v_Model] = GetVehicleModel(vehicleid);
  1185.             Resources[playerid][v_Faction] = factionid;
  1186.             Resources[playerid][v_Color1] = color1;
  1187.             Resources[playerid][v_Color2] = color2;
  1188.             Resources[playerid][v_Pos][0] = currPos[0];
  1189.             Resources[playerid][v_Pos][1] = currPos[1];
  1190.             Resources[playerid][v_Pos][2] = currPos[2];
  1191.             Resources[playerid][v_Pos][3] = currPos[3];
  1192.  
  1193.             mysql_format(m_Handle, query, sizeof(query), "INSERT INTO `factioncars` (`factionid`, `ModelID`, `PosX`, `PosY`, `PosZ`, `PosA`, `Interior`, `World`, `Color1`, `Color2`) VALUES(%i, %i, %f, %f, %f, %f, %i, %i, %i, %i)",
  1194.                 factionid, GetVehicleModel(vehicleid), currPos[0], currPos[1], currPos[2], currPos[3], GetPlayerInterior(playerid), GetPlayerVirtualWorld(playerid), color1, color2);
  1195.             mysql_pquery(m_Handle, query, "SQL_AddFactionVehicle", "i", playerid);
  1196.  
  1197.             WriteLog("admin_logs/factions/carfactionize_log.txt", "[%s] %s factionized their vehicle to factionid %d", ReturnDate(), ReturnName(playerid, 1), factionid);
  1198.             return true;
  1199.         }
  1200.         else return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You can't factionize this vehicle.");
  1201.     }
  1202.     else if(!strcmp(a_string, "buy")){
  1203.         if(_has_vehicle_spawned[playerid])return SendClientMessage(playerid, COLOR_ADM, "SERVER: You need to despawn your vehicle before buying a new one.");
  1204.         for(new i = 0; i < MAX_BUSINESS; i++)
  1205.         {
  1206.             if(BusinessData[i][businessID] != 0){
  1207.                 if(IsPlayerInRangeOfPoint(playerid, 6.0, BusinessData[i][businessExt][0], BusinessData[i][businessExt][1], BusinessData[i][businessExt][2])){
  1208.                     if(BusinessData[i][businessType] >= 9){
  1209.                         new newString[300];
  1210.  
  1211.                         string[0] = EOS;
  1212.  
  1213.                         for(new v = 0; v < sizeof(g_aDealershipCategory); v++){
  1214.                             format(newString, sizeof(newString), "%s%s\n", newString, g_aDealershipCategory[v]);
  1215.                         }
  1216.                         ShowPlayerDialog(playerid, DIALOG_DEALERSHIP, DIALOG_STYLE_LIST, "Categories:", newString, "Odaberi", "<<");
  1217.                         PlayerData[playerid][pAtDealership] = i;
  1218.  
  1219.                         ClearDealershipVar(playerid);
  1220.                         return true;
  1221.                     }
  1222.                 }
  1223.             }
  1224.         }
  1225.         SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You aren't at a dealership OR aren't near one.");
  1226.     }
  1227.     else if(!strcmp(a_string, "scrap")){
  1228.         new confirm[60], query[60], str[128], vehicleid = GetPlayerVehicleID(playerid);
  1229.  
  1230.         if(!IsPlayerInAnyVehicle(playerid))
  1231.             return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} Niste u vozilu.");
  1232.  
  1233.         if(!IsValidPlayerCar(vehicleid))
  1234.             return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You can't scrap this vehicle.");
  1235.  
  1236.         if(PlayerData[playerid][pSQLID] != CarData[vehicleid][carOwnerID])
  1237.             return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You don't own this vehicle.");
  1238.  
  1239.         if(sscanf(b_string, "s[60]", confirm)){
  1240.             SendClientMessage(playerid, COLOR_ACTION, "You're about to scrap your vehicle. Type /v scrap confirm to do it.");
  1241.             SendClientMessage(playerid, COLOR_RED, "This action is permanent and cannot be undone.");
  1242.             return true;
  1243.         }
  1244.  
  1245.         if(!strcmp(b_string, "confirm")){
  1246.             WriteLog("vehicle_logs/scrap_log.txt", "[%s] %s scrapped their %s (DBID: %i)", ReturnDate(), ReturnName(playerid), ReturnVehicleName(vehicleid), CarData[vehicleid][carID]);
  1247.  
  1248.             format(str, sizeof(str), "You scrapped your %s.", ReturnVehicleName(vehicleid));
  1249.             SendClientMessage(playerid, COLOR_ACTION, str);
  1250.  
  1251.             _has_vehicle_spawned[playerid] = false;
  1252.             _has_spawned_vehicleid[playerid] = 0;
  1253.  
  1254.             for(new i = 1; i < MAX_OWNED_CARS; i++)
  1255.             {
  1256.                 if(PlayerData[playerid][pOwnedCar][i] == CarData[vehicleid][carID])
  1257.                 {
  1258.                     PlayerData[playerid][pOwnedCar][i] = 0;
  1259.                 }
  1260.             }
  1261.  
  1262.             mysql_format(m_Handle, query, sizeof(query), "DELETE FROM ownedcars WHERE id = %i", CarData[vehicleid][carID]);
  1263.             mysql_pquery(m_Handle, query);
  1264.  
  1265.             DefaultVehicleValues(vehicleid);
  1266.             DestroyVehicle(vehicleid);
  1267.  
  1268.             RefreshPlayerCarSlots(playerid);
  1269.         }
  1270.         else return SendClientMessage(playerid, COLOR_ADM, "SERVER: Nevazeca opcija.");
  1271.     }
  1272.     else if(!strcmp(a_string, "hood"))
  1273.     {
  1274.         new
  1275.             Float:x,
  1276.             Float:y,
  1277.             Float:z
  1278.         ;
  1279.  
  1280.         new engine, lights, alarm, doors, bonnet, boot, objective;
  1281.  
  1282.         if(!IsPlayerInAnyVehicle(playerid) && GetNearestVehicle(playerid) != INVALID_VEHICLE_ID)
  1283.         {
  1284.             GetVehicleHood(GetNearestVehicle(playerid), x, y, z);
  1285.  
  1286.             new
  1287.                 vehicleid = GetNearestVehicle(playerid)
  1288.             ;
  1289.  
  1290.             if(IsValidFactionCar(vehicleid) && PlayerData[playerid][pFaction] != FactionCar[vehicleid][carFaction])
  1291.                 return SendClientMessage(playerid, COLOR_YELLOW, "SERVER: You don't have access to this vehicle.");
  1292.  
  1293.             if(!IsValidFactionCar(vehicleid) && CarData[vehicleid][carLocked])
  1294.                 return SendClientMessage(playerid, COLOR_YELLOW, "This vehicle is locked.");
  1295.  
  1296.             if(!IsPlayerInRangeOfPoint(playerid, 2.5, x, y, z))
  1297.                 return SendClientMessage(playerid, COLOR_YELLOW, "You aren't near the vehicles hood.");
  1298.  
  1299.             GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
  1300.  
  1301.             if(!bonnet)
  1302.             {
  1303.                 SetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, 1, boot, objective);
  1304.                 SendClientMessage(playerid, COLOR_YELLOW, "You have opened the hood.");
  1305.             }
  1306.             else
  1307.             {
  1308.                 SetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, 0, boot, objective);
  1309.                 SendClientMessage(playerid, COLOR_YELLOW, "You have closed the hood.");
  1310.             }
  1311.         }
  1312.         else if(IsPlayerInAnyVehicle(playerid))
  1313.         {
  1314.             new
  1315.                 vehicleid = GetPlayerVehicleID(playerid)
  1316.             ;
  1317.  
  1318.             if(IsValidFactionCar(vehicleid) && PlayerData[playerid][pFaction] != FactionCar[vehicleid][carFaction])
  1319.                 return SendClientMessage(playerid, COLOR_YELLOW, "SERVER: You don't have access to this vehicle.");
  1320.  
  1321.             if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER)
  1322.                 return SendClientMessage(playerid, COLOR_YELLOW, "SERVER: You aren't in the driver's seat.");
  1323.  
  1324.             GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
  1325.  
  1326.             if(!bonnet)
  1327.             {
  1328.                 SetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, 1, boot, objective);
  1329.                 SendClientMessage(playerid, COLOR_YELLOW, "You have opened the hood.");
  1330.             }
  1331.             else
  1332.             {
  1333.                 SetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, 0, boot, objective);
  1334.                 SendClientMessage(playerid, COLOR_YELLOW, "You have closed the hood.");
  1335.             }
  1336.         }
  1337.         else return SendClientMessage(playerid, COLOR_YELLOW, "SERVER: You aren't in or near a vehicle.");
  1338.     }
  1339.     else if(!strcmp(a_string, "trunk"))
  1340.     {
  1341.         new
  1342.             Float:x,
  1343.             Float:y,
  1344.             Float:z
  1345.         ;
  1346.  
  1347.         new engine, lights, alarm, doors, bonnet, boot, objective;
  1348.  
  1349.         if(!IsPlayerInAnyVehicle(playerid) && GetNearestVehicle(playerid) != INVALID_VEHICLE_ID)
  1350.         {
  1351.             GetVehicleBoot(GetNearestVehicle(playerid), x, y, z);
  1352.  
  1353.             new
  1354.                 vehicleid = GetNearestVehicle(playerid)
  1355.             ;
  1356.  
  1357.             if(IsValidFactionCar(vehicleid) && PlayerData[playerid][pFaction] != FactionCar[vehicleid][carFaction])
  1358.                 return SendClientMessage(playerid, COLOR_YELLOW, "SERVER: You don't have access to this vehicle.");
  1359.  
  1360.             if(!IsValidFactionCar(vehicleid) && CarData[vehicleid][carLocked])
  1361.                 return SendClientMessage(playerid, COLOR_YELLOW, "This vehicle is locked.");
  1362.  
  1363.             if(!IsPlayerInRangeOfPoint(playerid, 2.5, x, y, z))
  1364.                 return SendClientMessage(playerid, COLOR_YELLOW, "You aren't near the vehicles trunk.");
  1365.  
  1366.             GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
  1367.  
  1368.             if(!boot)
  1369.             {
  1370.                 SetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, 1, objective);
  1371.  
  1372.                 SendClientMessage(playerid, COLOR_YELLOW, "You have opened the trunk.");
  1373.                 SendClientMessage(playerid, COLOR_WHITE, "You can use /check to take a gun or /place to put one in.");
  1374.             }
  1375.             else
  1376.             {
  1377.                 SetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, 0, objective);
  1378.  
  1379.                 SendClientMessage(playerid, COLOR_YELLOW, "You have closed the trunk.");
  1380.             }
  1381.         }
  1382.         else if(IsPlayerInAnyVehicle(playerid))
  1383.         {
  1384.             new
  1385.                 vehicleid = GetPlayerVehicleID(playerid)
  1386.             ;
  1387.  
  1388.             if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER)
  1389.                 return SendClientMessage(playerid, COLOR_YELLOW, "You aren't in the driver's seat.");
  1390.  
  1391.             if(IsValidFactionCar(vehicleid) && PlayerData[playerid][pFaction] != FactionCar[vehicleid][carFaction])
  1392.                 return SendClientMessage(playerid, COLOR_YELLOW, "SERVER: You don't have access to this vehicle.");
  1393.  
  1394.             GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
  1395.  
  1396.             if(!boot)
  1397.             {
  1398.                 SetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, 1, objective);
  1399.  
  1400.                 SendClientMessage(playerid, COLOR_YELLOW, "You have opened the trunk.");
  1401.                 SendClientMessage(playerid, COLOR_WHITE, "You can use /check, /takegun and /place.");
  1402.             }
  1403.             else
  1404.             {
  1405.                 SetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, 0, objective);
  1406.                 SendClientMessage(playerid, COLOR_YELLOW, "You have closed the trunk.");
  1407.             }
  1408.         }
  1409.         else return SendClientMessage(playerid, COLOR_YELLOW, "SERVER: You aren't near or in a vehicle.");
  1410.     }
  1411.     else if(!strcmp(a_string, "payfines"))
  1412.     {
  1413.         new
  1414.             vehicleid = GetPlayerVehicleID(playerid);
  1415.  
  1416.         if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER)
  1417.                 return SendClientMessage(playerid, COLOR_YELLOW, "You aren't in the driver's seat.");
  1418.  
  1419.         if(CarData[vehicleid][carOwnerID] != PlayerData[playerid][pSQLID])
  1420.             return SendClientMessage(playerid, COLOR_ADM, "SERVER: You don't own this vehicle.");
  1421.  
  1422.         if(!CountVehicleFines(vehicleid))
  1423.             return SendClientMessage(playerid, COLOR_ADM, "SERVER: This vehicle doesn't have any fines.");
  1424.  
  1425.         if(PlayerData[playerid][pMoney] < CountVehicleFinesTotal(vehicleid))
  1426.             return SendClientMessage(playerid, COLOR_ADM, "SERVER: You don't have enough money to pay all the fines.");
  1427.  
  1428.         if(!IsPlayerNearBusiness(playerid) || IsPlayerNearBusiness(playerid) && BusinessData[IsPlayerNearBusiness(playerid)][businessType] != 9)
  1429.             return SendClientMessage(playerid, COLOR_ADM, "SERVER: You aren't at a dealership.");
  1430.  
  1431.         format(string, sizeof(string), "[-] You paid fines accumulating up to $%s.", MoneyFormat(CountVehicleFinesTotal(vehicleid)));
  1432.         SendClientMessage(playerid, COLOR_YELLOW, string);
  1433.  
  1434.         GiveMoney(playerid, -CountVehicleFinesTotal(vehicleid));
  1435.         ClearVehicleFines(vehicleid);
  1436.     }
  1437.     else if(!strcmp(a_string, "sell"))
  1438.     {
  1439.         new playerb, price, hasSpace = -1;
  1440.         new vehicleid = GetPlayerVehicleID(playerid);
  1441.  
  1442.         if(!isnull(b_string) && !strcmp(b_string, "cancel", true))
  1443.         {
  1444.             if(VehicleOfferedTo[playerid] == INVALID_PLAYER_ID)
  1445.                 return SendClientMessage(playerid, COLOR_ADM, "ERROR: You haven't offered to sell a vehicle.");
  1446.  
  1447.             Message(playerid, COLOR_ACTION, "SERVER: You cancelled your offer. %s was notified.", ReturnName(VehicleOfferedTo[playerid]));
  1448.             Message(VehicleOfferedTo[playerid], COLOR_ACTION, "SERVER: %s cancelled their vehicle offer.", ReturnName(playerid));
  1449.  
  1450.             VehicleOfferedTo[VehicleOfferBy[playerid]] = INVALID_PLAYER_ID;
  1451.             VehicleOfferBy[playerid] = INVALID_PLAYER_ID;
  1452.  
  1453.             VehiclePrice[playerid] = 0;
  1454.             VehicleDBIDOffered[VehicleOfferedTo[playerid]] = 0;
  1455.             return 1;
  1456.         }
  1457.        
  1458.         if(playerid == playerb) return SendClientMessage(playerid, COLOR_ADM, "ERROR: You can't sell a vehicle to yourself.");
  1459.  
  1460.         if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER)
  1461.             return SendClientMessage(playerid, COLOR_ADM, "ERROR: You aren't in a vehicle.");
  1462.  
  1463.         if(CarData[vehicleid][carOwnerID] != PlayerData[playerid][pSQLID])
  1464.             return SendClientMessage(playerid, COLOR_ADM, "ERROR: You don't own this vehicle.");
  1465.  
  1466.         if(VehicleOfferedTo[playerid] != INVALID_PLAYER_ID)
  1467.             return SendClientMessage(playerid, COLOR_ADM, "ERROR: You already offered your vehicle. Wait for their reply.");
  1468.  
  1469.         if(sscanf(b_string, "ui", playerb, price))
  1470.             return SendClientMessage(playerid, COLOR_ACTION, "USAGE: /v sell [playerid/DioImena] [price]");
  1471.  
  1472.         if(!IsPlayerConnected(playerb))
  1473.             return SendClientMessage(playerid, COLOR_ADM, "ERROR: You specified an invalid player.");
  1474.  
  1475.         if(!GetDistanceBetweenPlayers(playerid, playerb, 4.5))
  1476.             return SendClientMessage(playerid, COLOR_ADM, "ERROR: Niste u blizini te osobe.");
  1477.  
  1478.         if(price < 1)
  1479.             return SendClientMessage(playerid, COLOR_ADM, "SERVER: Invalid Price.");
  1480.  
  1481.         if(VehicleOfferBy[playerb] != INVALID_PLAYER_ID)
  1482.             return SendClientMessage(playerid, COLOR_ADM, "ERROR: That player has already been offered a vehicle.");
  1483.  
  1484.         hasSpace = FreePlayerCarID(playerb);
  1485.         if(hasSpace == -1) return SendClientMessage(playerid, COLOR_ADM, "SERVER: That player can't own anymore vehicles.");
  1486.  
  1487.         format(string, sizeof(string), "Are you sure you want to offer %s your %s for $%s?", ReturnName(playerb, 1), ReturnVehicleName(vehicleid), MoneyFormat(price));
  1488.         ConfirmDialog(playerid, "Potvrda", string, "OnVehicleOffer", playerb, price);
  1489.         return 1;
  1490.     }
  1491.     else if(!strcmp(a_string, "accept"))
  1492.     {
  1493.         if(VehicleOfferBy[playerid] == INVALID_PLAYER_ID)
  1494.             return SendClientMessage(playerid, COLOR_ADM, "ERROR: You haven't been offered a vehicle.");
  1495.  
  1496.         if(!strcmp(b_string, "yes", true))
  1497.         {
  1498.  
  1499.             if(!GetDistanceBetweenPlayers(playerid, VehicleOfferBy[playerid], 4.5))
  1500.             {
  1501.                 Message(playerid, COLOR_ACTION, "You're no longer near your offerer (%s). The sale was cancelled.", ReturnName(VehicleOfferBy[playerid]));
  1502.                 VehicleOfferedTo[VehicleOfferBy[playerid]] = INVALID_PLAYER_ID;
  1503.                 VehicleOfferBy[playerid] = INVALID_PLAYER_ID;
  1504.  
  1505.                 VehiclePrice[playerid] = 0;
  1506.                 VehicleDBIDOffered[playerid] = 0;
  1507.                 return 1;
  1508.             }
  1509.  
  1510.             if(VehiclePrice[playerid] > PlayerData[playerid][pMoney])
  1511.             {
  1512.                 Message(playerid, COLOR_ACTION, "You can't afford this price. The sale was cancelled.", ReturnName(VehicleOfferBy[playerid]));
  1513.                 Message(VehicleOfferBy[playerid], COLOR_ACTION, "%s can't afford your sale.", ReturnName(playerid));
  1514.  
  1515.                 VehicleOfferedTo[VehicleOfferBy[playerid]] = INVALID_PLAYER_ID;
  1516.                 VehicleOfferBy[playerid] = INVALID_PLAYER_ID;
  1517.  
  1518.                 VehiclePrice[playerid] = 0;
  1519.                 VehicleDBIDOffered[playerid] = 0;
  1520.                 return 1;
  1521.             }
  1522.  
  1523.             new slot, foundCar = -1;
  1524.  
  1525.             for(new i = 1, j = GetVehiclePoolSize(); i <= j; i++)
  1526.             {
  1527.                 if(CarData[i][carID] == VehicleDBIDOffered[playerid])
  1528.                 {
  1529.                     foundCar = i;
  1530.                 }
  1531.             }
  1532.             if(foundCar == -1)
  1533.             {
  1534.                 Message(playerid, COLOR_ACTION, "An error occurred. %s's vehicle is no longer spawned.", ReturnName(VehicleOfferBy[playerid]));
  1535.                 Message(VehicleOfferBy[playerid], COLOR_ACTION, "An error occurred. Your vehicle is no longer spawned.", ReturnName(playerid));
  1536.  
  1537.                 VehicleOfferedTo[VehicleOfferBy[playerid]] = INVALID_PLAYER_ID;
  1538.                 VehicleOfferBy[playerid] = INVALID_PLAYER_ID;
  1539.  
  1540.                 VehiclePrice[playerid] = 0;
  1541.                 VehicleDBIDOffered[playerid] = 0;
  1542.                 return 1;
  1543.             }
  1544.  
  1545.             format(string, sizeof(string), "%s sold their %s to %s for $%d", ReturnName(VehicleOfferBy[playerid]), ReturnVehicleModelName(CarData[foundCar][carModel]), ReturnName(playerid), VehiclePrice[VehicleOfferBy[playerid]]);
  1546.             adminWarn(1, string);
  1547.  
  1548.             _has_vehicle_spawned[VehicleOfferBy[playerid]] = false;
  1549.             _has_spawned_vehicleid[VehicleOfferBy[playerid]] = INVALID_VEHICLE_ID;
  1550.  
  1551.             Message(VehicleOfferBy[playerid], COLOR_ACTION, "SERVER: %s accepted your vehicle offer! (%s)", ReturnName(playerid), ReturnDateEx());
  1552.             Message(playerid, COLOR_ACTION, "SERVER: You accepted %s's vehicle offer! (%s)", ReturnName(VehicleOfferBy[playerid]), ReturnDateEx());
  1553.  
  1554.             WriteLog("vehicle_logs/acceptsale_log.txt", "[%s] %s accepted %s's offer for their Vehicle DBID %i (Price: $%s)", ReturnDate(), ReturnName(playerid), ReturnName(VehicleOfferBy[playerid]), VehicleDBIDOffered[playerid], MoneyFormat(VehiclePrice[playerid]));
  1555.  
  1556.             slot = FreePlayerCarID(playerid);
  1557.  
  1558.             PlayerData[playerid][pOwnedCar][slot] = VehicleDBIDOffered[playerid];
  1559.  
  1560.             for(new i = 1; i < MAX_OWNED_CARS; i++)
  1561.             {
  1562.                 if(PlayerData[VehicleOfferBy[playerid]][pOwnedCar][i] == VehicleDBIDOffered[playerid])
  1563.                 {
  1564.                     PlayerData[VehicleOfferBy[playerid]][pOwnedCar][i] = 0;
  1565.                 }
  1566.             }
  1567.  
  1568.             CarData[foundCar][carOwnerID] = PlayerData[playerid][pSQLID];
  1569.             SaveCar(foundCar);
  1570.  
  1571.             GiveMoney(playerid, -VehiclePrice[VehicleOfferBy[playerid]]);
  1572.             GiveMoney(VehicleOfferBy[playerid], VehiclePrice[VehicleOfferBy[playerid]]);
  1573.  
  1574.             SavePlayer(playerid); SavePlayer(VehicleOfferBy[playerid]);
  1575.             RefreshPlayerCarSlots(VehicleOfferBy[playerid]);
  1576.  
  1577.             VehiclePrice[playerid] = 0;
  1578.             VehicleDBIDOffered[playerid] = 0;
  1579.  
  1580.             VehiclePrice[VehicleOfferBy[playerid]] = 0;
  1581.             VehicleDBIDOffered[VehicleOfferBy[playerid]] = 0;
  1582.  
  1583.             VehicleOfferedTo[VehicleOfferBy[playerid]] = INVALID_PLAYER_ID;
  1584.             VehicleOfferBy[playerid] = INVALID_PLAYER_ID;
  1585.         }
  1586.         else if(!strcmp(b_string, "no", true))
  1587.         {
  1588.             Message(VehicleOfferBy[playerid], COLOR_ACTION, "SERVER: %s declined your vehicle offer.", ReturnName(playerid));
  1589.             Message(playerid, COLOR_ACTION, "SERVER: You declined %s's offer.", ReturnName(VehicleOfferBy[playerid]));
  1590.  
  1591.             VehiclePrice[playerid] = 0;
  1592.             VehicleDBIDOffered[playerid] = 0;
  1593.  
  1594.             VehiclePrice[VehicleOfferBy[playerid]] = 0;
  1595.             VehicleDBIDOffered[VehicleOfferBy[playerid]] = 0;
  1596.  
  1597.             VehicleOfferedTo[VehicleOfferBy[playerid]] = INVALID_PLAYER_ID;
  1598.             VehicleOfferBy[playerid] = INVALID_PLAYER_ID;
  1599.         }
  1600.         else return SendClientMessage(playerid, COLOR_ADM, "SERVER: It's either a yes or a no.");
  1601.     }
  1602.     else if(!strcmp(a_string, "refill"))
  1603.     {
  1604.         if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER)
  1605.             return SendClientMessage(playerid, COLOR_ADM, "ERROR: You aren't driving a vehicle.");
  1606.  
  1607.         if(!IsValidPlayerCar(GetPlayerVehicleID(playerid)))
  1608.             return SendClientMessage(playerid, COLOR_ADM, "ERROR: This isn't a player vehicle.");
  1609.  
  1610.         if(PlayerRefilling[playerid])
  1611.             return SendClientMessage(playerid, COLOR_DARKGREEN, "You're in the process of refilling.");
  1612.  
  1613.         new
  1614.             vehicleid = GetPlayerVehicleID(playerid),
  1615.             vehicleType;
  1616.  
  1617.         if(GetVehicleModelInfoAsInt(GetVehicleModel(vehicleid), "TransMissionData_nEngineType") == 'P')
  1618.             vehicleType = FUEL_TYPE_PETROL;
  1619.  
  1620.         else if(GetVehicleModelInfoAsInt(GetVehicleModel(vehicleid), "TransMissionData_nEngineType") == 'D')
  1621.             vehicleType = FUEL_TYPE_DIESEL;
  1622.  
  1623.         else vehicleType = FUEL_TYPE_ELECTRIC;
  1624.  
  1625.         if(IsPlayerNearFuelStation(playerid) != -1)
  1626.         {
  1627.             format(string, sizeof(string), "Your vehicle uses %s. You're about to start refilling. Price: $10 per 30units.\nWould you like to refill it?", GetFuelTypeAsString(vehicleType));
  1628.             ConfirmDialog(playerid, "Potvrda", string, "OnConfirmFuel", vehicleType);
  1629.         }
  1630.         else return SendClientMessage(playerid, COLOR_ADM, "SERVER: You aren't near a gas station.");
  1631.     }
  1632.     else if(!strcmp(a_string, "lights")) return cmd_lights(playerid, "");
  1633.     else if(!strcmp(a_string, "lock"))
  1634.     {
  1635.         new nearVehicle;
  1636.         for(new i = 0; i < MAX_VEHICLES; i++)
  1637.         {
  1638.             new Float: currPos[3];
  1639.             GetVehiclePos(i, currPos[0], currPos[1], currPos[2]);
  1640.  
  1641.             if(IsPlayerInRangeOfPoint(playerid, 5.0, currPos[0], currPos[1], currPos[2])){
  1642.  
  1643.                 nearVehicle++;
  1644.                 if(IsValidPlayerCar(i)){
  1645.  
  1646.                     if(CarData[i][carOwnerID] != PlayerData[playerid][pSQLID] && !PlayerData[playerid][pAdminDuty])return GameTextForPlayer(playerid, "You don't have the keys to this", 2000, 6);
  1647.  
  1648.                     if(!CarData[i][carLocked]){
  1649.                         ToggleVehicleLock(i, true);
  1650.                         CarData[i][carLocked] = true;
  1651.                         SaveSQLInt(CarData[i][carID], "ownedcars", "Locked", 1);
  1652.  
  1653.                         format(string, sizeof(string), "%s locked", ReturnName(playerid));
  1654.                         LogVehicleAction(i, string);
  1655.  
  1656.                         format(string, sizeof(string), "~r~%s LOCKED", ReturnVehicleName(i));
  1657.                         GameTextForPlayer(playerid, string, 3000, 4);
  1658.  
  1659.                         PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
  1660.                     }
  1661.                     else{
  1662.                         CarData[i][carLocked] = false;
  1663.                         ToggleVehicleLock(i, false);
  1664.                         SaveSQLInt(CarData[i][carID], "ownedcars", "Locked", 0);
  1665.  
  1666.                         format(string, sizeof(string), "%s unlocked", ReturnName(playerid));
  1667.                         LogVehicleAction(i, string);
  1668.  
  1669.                         format(string, sizeof(string), "~g~%s UNLOCKED", ReturnVehicleName(i));
  1670.                         GameTextForPlayer(playerid, string, 3000, 4);
  1671.  
  1672.                         PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
  1673.                     }
  1674.                 }
  1675.                 else if(IsValidRentalCar(i)){
  1676.                     if(!RentalData[i][rentalcarRented])return GameTextForPlayer(playerid, "~r~This vehicle doesn't have a lock", 3000, 4);
  1677.                     if(RentalData[i][rentalcarRentedBy] != PlayerData[playerid][pSQLID] && !PlayerData[playerid][pAdminDuty])return GameTextForPlayer(playerid, "You don't have the keys to this", 2000, 6);
  1678.  
  1679.                     if(!RentalData[i][rentalcarLocked]){
  1680.                         ToggleVehicleLock(i, true);
  1681.                         RentalData[i][rentalcarLocked] = true;
  1682.  
  1683.                         format(string, sizeof(string), "~r~%s LOCKED", ReturnVehicleName(i));
  1684.                         GameTextForPlayer(playerid, string, 3000, 4);
  1685.  
  1686.                         PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
  1687.                     }
  1688.                     else{
  1689.                         ToggleVehicleLock(i, false);
  1690.                         RentalData[i][rentalcarLocked] = false;
  1691.  
  1692.                         format(string, sizeof(string), "~g~%s UNLOCKED", ReturnVehicleName(i));
  1693.                         GameTextForPlayer(playerid, string, 3000, 4);
  1694.  
  1695.                         PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
  1696.                     }
  1697.                 }
  1698.                 else return GameTextForPlayer(playerid, "~r~This vehicle doesn't have a lock", 3000, 4);
  1699.             }
  1700.         }
  1701.         if(!nearVehicle)return SendClientMessage(playerid, COLOR_ADM, "SERVER: You aren't near a vehicle or it isn't synced.");
  1702.     }
  1703.     else if(!strcmp(a_string, "duplicatekey"))
  1704.     {
  1705.         new playerb;
  1706.  
  1707.         if(sscanf(b_string, "i", playerb))
  1708.             return SendClientMessage(playerid, COLOR_ADM, "USAGE: /v duplicatekey [playerid/DioImena]");
  1709.  
  1710.         if(!IsPlayerConnected(playerb))
  1711.             return SendClientMessage(playerid, COLOR_ADM, "Taj igrac nije konektovan.");
  1712.  
  1713.         if(!_has_vehicle_spawned[playerid])
  1714.             return SendClientMessage(playerid, COLOR_ADM, "ERROR: You don't have a car spawned.");
  1715.  
  1716.         if(!GetDistanceBetweenPlayers(playerid, playerb, 5.0))
  1717.             return SendClientMessage(playerid, COLOR_ADM, "You aren't near that player.");
  1718.  
  1719.         if(GetPVarInt(playerb, "DuplicateKey") != 0)
  1720.             return SendClientMessage(playerid, COLOR_ADM, "That player already has a duplicated key.");
  1721.  
  1722.         if(GetPVarInt(playerb, "DuplicateKey") == CarData[_has_spawned_vehicleid[playerid]][carID])
  1723.             return SendClientMessage(playerid, COLOR_ADM, "That player already has your cars key.");
  1724.  
  1725.         GiveMoney(playerid, -50);
  1726.  
  1727.         Message(playerid, COLOR_WHITE, "You gave %s a key to your %s. This will expire when you park the car or they log out.", ReturnName(playerb), ReturnVehicleName(_has_spawned_vehicleid[playerid]));
  1728.         Message(playerb, COLOR_WHITE, "%s gave you a key to their %s. This will expire when they park it or you log out.", ReturnName(playerid), ReturnVehicleName(_has_spawned_vehicleid[playerid]));
  1729.  
  1730.         format(string, sizeof(string), "* %s gives %s a duplicate key of their vehicle.", ReturnName(playerid, 0), ReturnName(playerb, 0));
  1731.         SetPlayerChatBubble(playerid, string, COLOR_ACTION, 20.0, 3000);
  1732.  
  1733.         SetPVarInt(playerb, "DuplicateKey", CarData[_has_spawned_vehicleid[playerid]][carID]);
  1734.     }
  1735.     else return SendClientMessage(playerid, COLOR_ADM, "SERVER: Nevazeca opcija.");
  1736.     return true;
  1737. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top