Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CMD:unrentvehicle(playerid, params[])
- {
- if(!pLoggedIn[playerid])return true;
- if(!IsPlayerInAnyVehicle(playerid))return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} Niste u vozilu.");
- new vehicleid = GetPlayerVehicleID(playerid), string[128];
- if(!IsValidRentalCar(vehicleid))return SendClientMessage(playerid, COLOR_ADM, "SERVER: This isn't a rental vehicle.");
- if(!RentalData[vehicleid][rentalcarRented])return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} This vehicle isn't rented by anyone.");
- if(RentalData[vehicleid][rentalcarRentedBy] != PlayerData[playerid][pSQLID])return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} This isn't your rental vehicle.");
- if(!IsPlayerInRangeOfPoint(playerid, 9.0, RentalData[vehicleid][rentalcarPos][0], RentalData[vehicleid][rentalcarPos][1], RentalData[vehicleid][rentalcarPos][2])){
- SendClientMessage(playerid, COLOR_ADM, "You aren't near your rental vehicles park spot.");
- SendClientMessage(playerid, COLOR_PINK, "Hint: Follow the red marker to the park spot if you want your money back.");
- SetPlayerCheckpoint(playerid, RentalData[vehicleid][rentalcarPos][0], RentalData[vehicleid][rentalcarPos][1], RentalData[vehicleid][rentalcarPos][2], 3.0);
- return true;
- }
- RentalData[vehicleid][rentalcarRented] = false;
- RentalData[vehicleid][rentalcarRentedBy] = 0;
- format(string, sizeof(string), "You unrented the %s and got your money back.", ReturnVehicleName(vehicleid));
- SendClientMessage(playerid, COLOR_DARKGREEN, string);
- format(string, sizeof(string), "Unrented Rental Vehicle DBID %i", RentalData[vehicleid][rentalcarSQLID]);
- LogPlayerAction(playerid, string);
- GiveMoney(playerid, 300);
- SetVehicleToRespawn(vehicleid);
- return true;
- }
- CMD:note(playerid, params[])
- {
- if(!pLoggedIn[playerid])return true;
- new sub_param[128], sub_z_param[128], string[400], query[177];
- if(sscanf(params, "s[128]S()[128]", sub_param, sub_z_param)){
- SendClientMessage(playerid, COLOR_ACTION, "____________________________________________________");
- SendClientMessage(playerid, COLOR_ACTION, "USAGE: /note [action]");
- SendClientMessage(playerid, COLOR_ACTION, "/note create [text] - Create a new note.");
- SendClientMessage(playerid, COLOR_ACTION, "/note display - See all your existing notes.");
- SendClientMessage(playerid, COLOR_ACTION, "/note show [noteid] [playerid] - Show another player your note.");
- SendClientMessage(playerid, COLOR_ACTION, "/note add [noteid] - Add text to existing note ID.");
- SendClientMessage(playerid, COLOR_ACTION, "/note delete [noteid] - Delete an existing note ID.");
- SendClientMessage(playerid, COLOR_ACTION, "____________________________________________________");
- return true;
- }
- if(!strcmp(sub_param, "create")){
- new note_id;
- if(isnull(sub_z_param))return SendClientMessage(playerid, COLOR_ACTION, "USAGE: /note create [text]");
- for(new i = 1; i < MAX_PLAYER_NOTES; i++)
- {
- if(!NoteData[playerid][i][NoteID]){
- note_id = i;
- break;
- }
- }
- if(note_id == 0)return SendClientMessage(playerid, COLOR_ACTION, "You can't make anymore notes!");
- format(NoteData[playerid][note_id][NoteDetail], 128, "%s", sub_z_param);
- NoteData[playerid][note_id][NoteID] = note_id;
- note_save_id[playerid] = note_id;
- mysql_format(m_Handle, query, sizeof(query), "INSERT INTO `player_notes` (playersqlid, slotid, details) VALUES(%i, %i, '%e')",
- PlayerData[playerid][pSQLID], note_id, sub_z_param);
- mysql_pquery(m_Handle, query, "SQL_AddPlayerNote", "i", playerid);
- SendNearbyMessage(playerid, 20.0, COLOR_EMOTE, "* %s takes out a paper sheet and writes something.", ReturnName(playerid, 0));
- format(string, sizeof(string), "[Notes] You've created a note with text: %s", sub_z_param);
- SendClientMessage(playerid, COLOR_ACTION, string);
- }
- else if(!strcmp(sub_param, "display")){
- new hasNotes;
- for(new i = 1; i < MAX_PLAYER_NOTES; i++){
- if(NoteData[playerid][i][NoteID] != 0) {
- if(!isnull(NoteData[playerid][i][NoteDetail])){
- format(string, sizeof(string), "[Notes] Note(%d) says: %s", i, NoteData[playerid][i][NoteDetail]);
- SendClientMessage(playerid, COLOR_ACTION, string);
- hasNotes++;
- }
- }
- }
- if(!hasNotes)return SendClientMessage(playerid, COLOR_ACTION, "You don't have any notes ( /note create )!");
- //SendClientMessage(playerid, COLOR_ACTION, string);
- }
- else if(!strcmp(sub_param, "show")){
- new playerb, noteid;
- if(sscanf(sub_z_param, "du", noteid, playerb))
- return SendClientMessage(playerid, COLOR_ACTION, "USAGE: /note show [note_id] [playerid ILI ime]");
- if(!IsPlayerConnected(playerb))return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} Taj igrac nije konektovan.");
- if(!GetDistanceBetweenPlayers(playerid, playerb, 4.5)) return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} Morate biti blize tom igracu.");
- if(!NoteData[playerid][noteid][NoteID])return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} There isn't a note there.");
- format(string, sizeof(string), "[Notes] Note(%d) says: %s", noteid, NoteData[playerid][noteid][NoteDetail]);
- SendClientMessage(playerb, COLOR_ACTION, string);
- SendNearbyMessage(playerid, 20.0, COLOR_EMOTE, "* %s shows %s a piece of paper.", ReturnName(playerid, 0), ReturnName(playerb, 0));
- }
- else if(!strcmp(sub_param, "add")){
- new addtext[128], noteid;
- if(sscanf(sub_z_param, "ds[128]", noteid, addtext))
- return SendClientMessage(playerid, COLOR_ACTION, "USAGE: /note add [note_id] [text]");
- if(!NoteData[playerid][noteid][NoteID])return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} There isn't a note there.");
- format(string, sizeof(string), "[Notes] Note(%d) now says: %s", noteid, addtext);
- SendClientMessage(playerid, COLOR_ACTION, string);
- format(NoteData[playerid][noteid][NoteDetail], 128, "%s", addtext);
- mysql_format(m_Handle, query, sizeof(query), "UPDATE player_notes SET details = '%e' WHERE id = %i",
- NoteData[playerid][noteid][NoteDetail], NoteData[playerid][noteid][NoteSQLID]);
- mysql_tquery(m_Handle, query);
- }
- else if(!strcmp(sub_param, "delete")){
- new noteid;
- if(sscanf(sub_z_param, "d", noteid))
- return SendClientMessage(playerid, COLOR_ACTION, "USAGE: /note delete [note_id]");
- if(!NoteData[playerid][noteid][NoteID])return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} There isn't a note there.");
- format(string, sizeof(string), "You deleted Note(%d): %s", noteid, NoteData[playerid][noteid][NoteDetail]);
- SendClientMessage(playerid, COLOR_ACTION, string);
- mysql_format(m_Handle, query, sizeof(query), "DELETE FROM player_notes WHERE id = %i", NoteData[playerid][noteid][NoteSQLID]);
- mysql_tquery(m_Handle, query);
- NoteData[playerid][noteid][NoteID] = 0;
- NoteData[playerid][noteid][NoteSQLID] = 0;
- }
- return true;
- }
- CMD:colorlist(playerid, params[])
- {
- if(!pLoggedIn[playerid])return true;
- new color_list[4000];
- color_list[0] = EOS;
- for(new colorid = 0; colorid != sizeof(VehicleColoursTableRGBA); colorid++)
- {
- format(color_list, sizeof(color_list), "%s{%06x}Color %03d%s", color_list, VehicleColoursTableRGBA[colorid] >>> 8, colorid, !((colorid + 1) % 21) ? ("\n") : (" "));
- }
- ShowPlayerDialog(playerid, DIALOG_USE, DIALOG_STYLE_MSGBOX, "Color List", color_list, "<<", "");
- return true;
- }
- CMD:contacts(playerid, params[])
- {
- if(!pLoggedIn[playerid])return true;
- if(PlayerData[playerid][pPhoneOff])return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} Your cellphone has to be on to use this.");
- new a_string[128], b_string[128], string[128], query[177];
- if(sscanf(params, "s[128]S()[128]", a_string, b_string))
- {
- SendClientMessage(playerid, COLOR_ACTION, "USAGE: /contacts [action]");
- SendClientMessage(playerid, COLOR_ACTION, "/contacts create [name] [number] - Create a contact.");
- SendClientMessage(playerid, COLOR_ACTION, "/contacts delete [contact id] - Delete a contact.");
- SendClientMessage(playerid, COLOR_ACTION, "/contacts show [playerid ILI ime] [contact id] - Show to another player.");
- SendClientMessage(playerid, COLOR_ACTION, "/contacts display - Display all contacts.");
- SendClientMessage(playerid, COLOR_ACTION, "/contacts edit [contact id] [name] [phone] - Edit a contact.");
- return true;
- }
- if(!strcmp(a_string, "create")){
- new c_name[128], c_num, c_id;
- if(sscanf(b_string, "s[128]d", c_name, c_num))
- return SendClientMessage(playerid, COLOR_ACTION, "USAGE: /contacts create [name of contact] [number of contact]");
- if(c_num == 911 || c_num == WEAPON_ORDER_NUMBER || c_num == MECHANIC_NUMBER || c_num == TAXI_NUMBER)
- return SendClientMessage(playerid, COLOR_ADM, "ERROR: We don't allow those numbers as contacts.");
- for(new i = 1; i < MAX_PLAYER_CONTACTS; i++){
- if(!ContactsData[playerid][i][contactID]){
- c_id = i;
- break;
- }
- }
- format(string, sizeof(string), "* %s takes out their cellphone.", ReturnName(playerid, 0));
- SetPlayerChatBubble(playerid, string, COLOR_EMOTE, 20.0, 3000);
- SendClientMessage(playerid, COLOR_EMOTE, string);
- format(string, sizeof(string), "You created a contact ( %d )!", c_id);
- SendClientMessage(playerid, COLOR_ACTION, string);
- contact_save_id[playerid] = c_id;
- mysql_format(m_Handle, query, sizeof(query), "INSERT INTO player_contacts (`playersqlid`, `contactid`, `contact_name`, `contact_num`) VALUES(%i, %i, '%e', %i)",
- PlayerData[playerid][pSQLID], c_id, c_name, c_num);
- mysql_pquery(m_Handle, query, "SQL_AddPlayerContact", "i", playerid);
- ContactsData[playerid][c_id][contactID] = c_id;
- format(ContactsData[playerid][c_id][contactName], 128, "%s", c_name);
- ContactsData[playerid][c_id][contactNumber] = c_num;
- }
- else if(!strcmp(a_string, "delete")){
- new c_id;
- if(sscanf(b_string, "d", c_id))return SendClientMessage(playerid, COLOR_ACTION, "USAGE: /contacts delete [contact id]");
- if(c_id < 1 || c_id > MAX_PLAYER_NOTES)return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} That contact doesn't exist.");
- if(!ContactsData[playerid][c_id][contactID])return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} That contact doesn't exist.");
- mysql_format(m_Handle, query, sizeof(query), "DELETE FROM player_contacts WHERE id = %i", ContactsData[playerid][c_id][contactSQLID]);
- mysql_pquery(m_Handle, query);
- ContactsData[playerid][c_id][contactID] = 0;
- ContactsData[playerid][c_id][contactSQLID] = 0;
- format(string, sizeof(string), "* %s takes out their cellphone.", ReturnName(playerid, 0));
- SetPlayerChatBubble(playerid, string, COLOR_EMOTE, 20.0, 3000);
- SendClientMessage(playerid, COLOR_EMOTE, string);
- }
- else if(!strcmp(a_string, "show")){
- new c_id, playerb;
- if(sscanf(b_string, "ud", playerb, c_id))
- return SendClientMessage(playerid, COLOR_ACTION, "USAGE: /contacts show [playerid ILI ime] [contact id]");
- if(!IsPlayerConnected(playerb))return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You specified an invalid playerid ILI ime.");
- if(!pLoggedIn[playerb])return SendClientMessage(playerid, COLOR_ADM, "That player hasn't logged in yet.");
- if(!GetDistanceBetweenPlayers(playerid, playerb, 4.5)) return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} Morate biti blize tom igracu.");
- if(c_id < 1 || c_id > MAX_PLAYER_NOTES)return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} That contact doesn't exist.");
- if(!ContactsData[playerid][c_id][contactID])return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} That contact doesn't exist.");
- format(string, sizeof(string), "* %s shows %s their cellphone.", ReturnName(playerid, 0), ReturnName(playerb, 0));
- SetPlayerChatBubble(playerid, string, COLOR_EMOTE, 20.0, 3000);
- SendClientMessage(playerid, COLOR_EMOTE, string);
- format(string, sizeof(string), "Contact(%d): Name: %s : Number: %d", c_id, ContactsData[playerid][c_id][contactName], ContactsData[playerid][c_id][contactNumber]);
- SendClientMessage(playerb, COLOR_ACTION, string);
- }
- else if(!strcmp(a_string, "display"))
- {
- new found = 0;
- for(new i = 1; i < MAX_PLAYER_CONTACTS; i++)
- {
- if(ContactsData[playerid][i][contactID] != 0)
- {
- if(!isnull(ContactsData[playerid][i][contactName]))
- {
- format(string, sizeof(string), "Contact(%d): Name: %s : Number: %d", i, ContactsData[playerid][i][contactName], ContactsData[playerid][i][contactNumber]);
- SendClientMessage(playerid, COLOR_ACTION, string);
- found = 1;
- }
- }
- }
- if(found == 0)SendClientMessage(playerid, COLOR_ACTION, "You don't have any contacts ( /contacts create )!");
- }
- else if(!strcmp(a_string, "edit")){
- new c_id, c_name[128], c_num;
- if(sscanf(b_string, "ds[128]d", c_id, c_name, c_num))
- return SendClientMessage(playerid, COLOR_ACTION, "USAGE: /contacts edit [contact id] [contact name] [contact number]");
- if(!ContactsData[playerid][c_id][contactID])return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} That contact doesn't exist.");
- mysql_format(m_Handle, query, sizeof(query), "UPDATE player_contacts SET contact_name = '%e', contact_num = %i WHERE id = %i",
- c_name, c_num, ContactsData[playerid][c_id][contactSQLID]);
- mysql_pquery(m_Handle, query);
- format(ContactsData[playerid][c_id][contactName], 128, "%s", c_name);
- ContactsData[playerid][c_id][contactNumber] = c_num;
- format(string, sizeof(string), "* %s takes out their cellphone.", ReturnName(playerid, 0));
- SetPlayerChatBubble(playerid, string, COLOR_EMOTE, 20.0, 3000);
- SendClientMessage(playerid, COLOR_EMOTE, string);
- SendClientMessage(playerid, COLOR_ADM, "You edited your contact page.");
- }
- return true;
- }
- CMD:weapon(playerid, params[])
- {
- new string[128], specifier[40], specifierex[40];
- if (sscanf(params, "s[40]S()[40]", specifier, specifierex))
- {
- SendClientMessage(playerid, COLOR_ADM, "USAGE:{FFFFFF} /weapon [adjust, bone, hide, reset] [weapon id]");
- SendClientMessage(playerid, COLOR_ADM, "TIP:{FFFFFF} Use /weapon hide [id] to hide smaller weapons from being seen.");
- return true;
- }
- if (!strcmp(specifier, "hide"))
- {
- new id, query[450];
- if (sscanf(specifierex, "d", id))
- return SendClientMessage(playerid, COLOR_ADM, "USAGE:{FFFFFF} /weapon hide [weapon id]");
- if (!IsValidDisplayWeapon(id))
- return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You specified a weapon ID that can't be edited.");
- if (NotHideableWeapon(id))
- return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} This is a weapon you can't hide.");
- if (WeaponDisplay[playerid][id][weaponHidden])
- {
- WeaponDisplay[playerid][id][weaponHidden] = false;
- format (string, sizeof(string), "You've shown your %s.", ReturnWeaponName(id));
- SendClientMessage(playerid, COLOR_ADM, string);
- }
- else
- {
- WeaponDisplay[playerid][id][weaponHidden] = true;
- if (IsPlayerAttachedObjectSlotUsed(playerid, ReturnWeaponsSlot(id))) RemovePlayerAttachedObject(playerid, ReturnWeaponsSlot(id));
- format (string, sizeof(string), "You've hidden your %s.", ReturnWeaponName(id));
- SendClientMessage(playerid, COLOR_ADM, string);
- }
- 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",
- 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]);
- mysql_tquery(m_Handle, query);
- }
- else if (!strcmp(specifier, "adjust"))
- {
- new id;
- new WEAPON_INDEX;
- if (EditingDisplay[playerid])
- return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You're already editing a weapon.");
- if (sscanf(specifierex, "d", id))
- return SendClientMessage(playerid, COLOR_ADM, "USAGE:{FFFFFF} /weapon adjust [weapon id]");
- if(Weapon[playerid][WEAPON_INDEX][eWeaponID] < 0)
- return SendClientMessage(playerid, COLOR_ADM, "You cannot adjust the position of a weapon you do not have");
- if (!IsValidDisplayWeapon(id))
- return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You specified a weapon ID that can't be edited.");
- EditingDisplay[playerid] = id;
- if (IsPlayerAttachedObjectSlotUsed(playerid, ReturnWeaponsSlot(id))) RemovePlayerAttachedObject(playerid, ReturnWeaponsSlot(id));
- SetPlayerArmedWeapon(playerid, 0);
- 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],
- WeaponDisplay[playerid][id][weaponRot][0], WeaponDisplay[playerid][id][weaponRot][1], WeaponDisplay[playerid][id][weaponRot][2]);
- EditAttachedObject(playerid, ReturnWeaponsSlot(id));
- }
- else if(!strcmp(specifier, "bone"))
- {
- new
- id, bone, query[350];
- if (EditingDisplay[playerid])
- return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} Stop editing your weapon first.");
- if (sscanf(specifierex, "ii", id, bone))
- {
- SendClientMessage(playerid, COLOR_ADM, "USAGE: /weapon bone [weapon id] [bone]");
- SendClientMessage(playerid, COLOR_WHITE, "Bone: 1 - Spine, 2 - Head, 3 - Upper L Arm, 4 - Upper R Arm, 5 - Left Hand");
- SendClientMessage(playerid, COLOR_WHITE, "Bone: 6 - Right Hand, 7 - Left Thigh, 8 - Right Thigh, 9 - Left Foot, 10 - Right Foot");
- return 1;
- }
- if (!IsValidDisplayWeapon(id))
- return SendClientMessage(playerid, COLOR_ADM, "ERROR: You specified a weapon ID that can't be edited.");
- if(bone < 1 || bone > 10)
- return SendClientMessage(playerid, COLOR_ADM, "ERROR: You specified an invalid bone.");
- 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",
- 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]);
- mysql_tquery(m_Handle, query);
- if(IsPlayerAttachedObjectSlotUsed(playerid, ReturnWeaponsSlot(id)))
- {
- RemovePlayerAttachedObject(playerid, ReturnWeaponsSlot(id));
- 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],
- WeaponDisplay[playerid][id][weaponRot][0], WeaponDisplay[playerid][id][weaponRot][1], WeaponDisplay[playerid][id][weaponRot][2]);
- WeaponDisplay[playerid][id][weaponBone] = bone;
- }
- else WeaponDisplay[playerid][id][weaponBone] = bone;
- SendClientMessage(playerid, COLOR_ADM, "Your weapons bone was updated.");
- }
- else if(!strcmp(specifier, "reset"))
- {
- new
- id,
- query[350];
- if (EditingDisplay[playerid])
- return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} Stop editing your weapon first.");
- if(sscanf(specifierex, "i", id))
- return SendClientMessage(playerid, COLOR_ADM, "USAGE: /weapon reset [weapon id]");
- if (!IsValidDisplayWeapon(id))
- return SendClientMessage(playerid, COLOR_ADM, "ERROR: You specified a weapon ID that can't be edited.");
- WeaponDisplay[playerid][id][weaponBone] = 1;
- WeaponDisplay[playerid][id][weaponPos][0] = -0.055998;
- WeaponDisplay[playerid][id][weaponPos][1] = 0.188999;
- WeaponDisplay[playerid][id][weaponPos][2] = 0.053998;
- WeaponDisplay[playerid][id][weaponRot][0] = 0.000000;
- WeaponDisplay[playerid][id][weaponRot][1] = 44.500007;
- WeaponDisplay[playerid][id][weaponRot][2] = 0.000000;
- 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",
- 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]);
- mysql_tquery(m_Handle, query);
- if(IsPlayerAttachedObjectSlotUsed(playerid, ReturnWeaponsSlot(id)))
- {
- RemovePlayerAttachedObject(playerid, ReturnWeaponsSlot(id));
- 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],
- WeaponDisplay[playerid][id][weaponRot][0], WeaponDisplay[playerid][id][weaponRot][1], WeaponDisplay[playerid][id][weaponRot][2]);
- }
- Message(playerid, COLOR_ADM, "Your %s was reset to a default position.", ReturnWeaponName(id));
- }
- else return SendClientMessage(playerid, COLOR_ADM, "SERVER: Nevazeca opcija.");
- return true;
- }
- CMD:boombox(playerid, params[])
- {
- new string[128], specifier[40], specifier_ex[40];
- if (sscanf(params, "s[40]S()[40]", specifier, specifier_ex))
- {
- SendClientMessage(playerid, COLOR_ADM, "USAGE:{FFFFFF} /boombox [action]");
- SendClientMessage(playerid, COLOR_ADM, "[Action] place, adjust, destroy, pickup, giveto");
- SendClientMessage(playerid, COLOR_ADM, "** Use /setstation to set the station. **");
- return true;
- }
- if (!PlayerData[playerid][pHasBoombox])
- return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You don't have a Boombox.");
- if (!strcmp(specifier, "place"))
- {
- new bool:alreadyPlaced = false, bool:nearbyBoombox = false, id = FreeBoomboxID();
- if (id == -1)
- return SendClientMessage(playerid, COLOR_ADM, "SERVER: You can't place Boombox's right now. Try again later. (Max 30)");
- for (new i = 1; i < MAX_BOOMBOXS; i++)
- {
- if (BoomboxData[i][boomboxExists])
- {
- if (BoomboxData[i][boomboxPlayerID] == PlayerData[playerid][pSQLID])
- {
- alreadyPlaced = true;
- }
- }
- }
- if(alreadyPlaced == true)
- return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You already have a boombox placed.");
- for (new i = 1; i < MAX_BOOMBOXS; i++)
- {
- if (BoomboxData[i][boomboxExists])
- {
- if (IsPlayerInRangeOfPoint(playerid, 20.0, BoomboxData[i][boomboxPos][0], BoomboxData[i][boomboxPos][1], BoomboxData[i][boomboxPos][2]))
- {
- nearbyBoombox = true;
- }
- }
- }
- if (nearbyBoombox == true)
- return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} There's already a boombox placed near you. You need to get away from it.");
- GetPlayerPos(playerid, PlayerData[playerid][pPos][0], PlayerData[playerid][pPos][1], PlayerData[playerid][pPos][2]);
- BoomboxData[id][boomboxArea] = CreateDynamicCircle(PlayerData[playerid][pPos][0], PlayerData[playerid][pPos][1], 30.0, GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid));
- BoomboxData[id][boomboxObject] = CreateDynamicObject(2226, PlayerData[playerid][pPos][0], PlayerData[playerid][pPos][1], PlayerData[playerid][pPos][2] - 1, 0.0, 0.0, 0.0,
- GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid));
- BoomboxData[id][boomboxExists] = true;
- BoomboxData[id][boomboxPlayerID] = PlayerData[playerid][pSQLID];
- BoomboxData[id][boomboxPos][0] = PlayerData[playerid][pPos][0];
- BoomboxData[id][boomboxPos][1] = PlayerData[playerid][pPos][1];
- BoomboxData[id][boomboxPos][2] = PlayerData[playerid][pPos][2];
- SendClientMessage(playerid, COLOR_DARKGREEN, "You put down a Boombox. To move it, use /boombox adjust while near it. /setstation");
- }
- else if (!strcmp(specifier, "adjust"))
- {
- new bool:nearBoombox, id;
- for (new i = 1; i < MAX_BOOMBOXS; i++)
- {
- if (BoomboxData[i][boomboxExists])
- {
- if (IsPlayerInRangeOfPoint(playerid, 4.0, BoomboxData[i][boomboxPos][0], BoomboxData[i][boomboxPos][1], BoomboxData[i][boomboxPos][2]))
- {
- if (BoomboxData[i][boomboxPlayerID] != PlayerData[playerid][pSQLID])
- return SendClientMessage(playerid, COLOR_ADM, "You don't own this boombox.");
- nearBoombox = true;
- id = i;
- }
- }
- }
- if(nearBoombox == false)
- return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You aren't near a boombox.");
- EditDynamicObject(playerid, BoomboxData[id][boomboxObject]);
- EditingBoombox[playerid] = id;
- }
- else if (!strcmp(specifier, "destroy"))
- {
- new bool:nearBoombox, id;
- for (new i = 1; i < MAX_BOOMBOXS; i++)
- {
- if (BoomboxData[i][boomboxExists])
- {
- if (IsPlayerInRangeOfPoint(playerid, 4.0, BoomboxData[i][boomboxPos][0], BoomboxData[i][boomboxPos][1], BoomboxData[i][boomboxPos][2]))
- {
- if (BoomboxData[i][boomboxPlayerID] != PlayerData[playerid][pSQLID])
- return SendClientMessage(playerid, COLOR_ADM, "You don't own this boombox.");
- nearBoombox = true;
- id = i;
- }
- }
- }
- if(nearBoombox == false)
- return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You aren't near a boombox.");
- SendClientMessage(playerid, COLOR_ADM, "You destroyed your Boombox.");
- foreach (new i : Player)
- {
- if(pLoggedIn[i])
- {
- if (IsPlayerInRangeOfPoint(i, 10.0, BoomboxData[id][boomboxPos][0], BoomboxData[id][boomboxPos][1], BoomboxData[id][boomboxPos][2]))
- {
- StopAudioStreamForPlayer(i);
- }
- }
- }
- RemoveBoombox(id);
- DestroyDynamicObject(BoomboxData[id][boomboxObject]);
- PlayerData[playerid][pHasBoombox] = false;
- }
- else if (!strcmp(specifier, "pickup"))
- {
- new bool:nearBoombox, id;
- for (new i = 1; i < MAX_BOOMBOXS; i++)
- {
- if (BoomboxData[i][boomboxExists])
- {
- if (IsPlayerInRangeOfPoint(playerid, 4.0, BoomboxData[i][boomboxPos][0], BoomboxData[i][boomboxPos][1], BoomboxData[i][boomboxPos][2]))
- {
- if (BoomboxData[i][boomboxPlayerID] != PlayerData[playerid][pSQLID])
- return SendClientMessage(playerid, COLOR_ADM, "You don't own this boombox.");
- nearBoombox = true;
- id = i;
- }
- }
- }
- if(nearBoombox == false)
- return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You aren't near a boombox.");
- SendClientMessage(playerid, COLOR_ADM, "You picked up your Boombox. Use /boombox place later");
- foreach (new i : Player)
- {
- if(pLoggedIn[i])
- {
- if (IsPlayerInRangeOfPoint(i, 10.0, BoomboxData[id][boomboxPos][0], BoomboxData[id][boomboxPos][1], BoomboxData[id][boomboxPos][2]))
- {
- StopAudioStreamForPlayer(i);
- }
- }
- }
- RemoveBoombox(id);
- DestroyDynamicObject(BoomboxData[id][boomboxObject]);
- }
- else if (!strcmp(specifier, "giveto"))
- {
- new bool:nearBoombox, id, playerb;
- for (new i = 1; i < MAX_BOOMBOXS; i++)
- {
- if (BoomboxData[i][boomboxExists])
- {
- if (IsPlayerInRangeOfPoint(playerid, 4.0, BoomboxData[i][boomboxPos][0], BoomboxData[i][boomboxPos][1], BoomboxData[i][boomboxPos][2]))
- {
- if (BoomboxData[i][boomboxPlayerID] != PlayerData[playerid][pSQLID])
- return SendClientMessage(playerid, COLOR_ADM, "You don't own this boombox.");
- nearBoombox = true;
- id = i;
- }
- }
- }
- if(nearBoombox == false)
- return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You aren't near a boombox.");
- if (sscanf(specifier_ex, "u", playerb))
- return SendClientMessage(playerid, COLOR_ADM, "USAGE:{FFFFFF} /boombox giveto [playerid/DioImena]");
- if (!IsPlayerConnected(playerb))
- return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You specified a player that isn't connected.");
- if (!pLoggedIn[playerb])
- return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} Taj igrac nije ulogovan.");
- if (PlayerData[playerb][pHasBoombox])
- return SendClientMessage(playerid, COLOR_ADM, "That player already owns a boombox.");
- BoomboxData[id][boomboxPlayerID] = PlayerData[playerb][pSQLID];
- format (string, sizeof(string), "* %s gave %s their Boombox.", ReturnName(playerid, 0), ReturnName(playerb, 0));
- SetPlayerChatBubble(playerid, string, COLOR_EMOTE, 20.0, 3000);
- format (string, sizeof(string), "** You gave %s your Boombox.", ReturnName(playerb, 0));
- SendClientMessage(playerid, COLOR_DARKGREEN, string);
- PlayerData[playerid][pHasBoombox] = false;
- }
- else return SendClientMessage(playerid, COLOR_ADM, "SERVER: Nevazeca opcija.");
- return true;
- }
- CMD:eat(playerid, params[])
- {
- new id = IsPlayerInBusiness(playerid) ;
- if (!id)
- return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You aren't in an establishment.");
- if (BusinessData[id][businessType] != BIZ_RESTAURANT)
- return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You aren't in a restaurant.");
- if (MealMenu[playerid][mealExists] == true)
- return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You already have a meal.");
- ShowMealMenu(playerid);
- return true;
- }
- CMD:meal(playerid, params[])
- {
- new stringb[90];
- if (sscanf(params, "s[90]", stringb))
- return SendClientMessage(playerid, COLOR_ADM, "USAGE:{FFFFFF} /meal [order / place / pickup / throw]");
- if (!strcmp(stringb, "order"))
- {
- return cmd_eat(playerid, "");
- }
- else if (!strcmp(stringb, "throw"))
- {
- if (!MealMenu[playerid][mealExists])
- return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You don't have a meal.");
- if (MealMenu[playerid][mealPlaced] == true)
- {
- if (!IsPlayerInRangeOfPoint(playerid, 4.0, MealMenu[playerid][mealPos][0], MealMenu[playerid][mealPos][1], MealMenu[playerid][mealPos][2]))
- return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You aren't near your meal tray.");
- DestroyDynamicObject(MealMenu[playerid][mealObject]);
- SendNearbyMessage(playerid, 20.0, COLOR_EMOTE, "* %s throws their meal away.", ReturnName(playerid, 0));
- MealMenu[playerid][mealExists] = false;
- MealMenu[playerid][mealPlaced] = false;
- return true;
- }
- SendNearbyMessage(playerid, 20.0, COLOR_EMOTE, "* %s throws their meal away.", ReturnName(playerid, 0));
- MealMenu[playerid][mealExists] = false;
- PlayerData[playerid][pCarryingMeal] = false;
- RemovePlayerAttachedObject(playerid, 9);
- SetPlayerSpecialAction(playerid, SPECIAL_ACTION_NONE);
- }
- else if (!strcmp(stringb, "place"))
- {
- if (!MealMenu[playerid][mealExists])
- return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You don't have a meal.");
- if (MealMenu[playerid][mealPlaced])
- return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You already have a meal placed.");
- SendNearbyMessage(playerid, 20.0, COLOR_EMOTE, "* %s places their meal down.", ReturnName(playerid, 0));
- RemovePlayerAttachedObject(playerid, 9);
- SetPlayerSpecialAction(playerid, SPECIAL_ACTION_NONE);
- new modelid = MealMenu[playerid][mealModel];
- new Float:playersPos[3];
- GetPlayerPos(playerid, playersPos[0], playersPos[1], playersPos[2]);
- PlayerData[playerid][pPlacingMeal] = true;
- MealMenu[playerid][mealObject] =
- CreateDynamicObject(modelid, playersPos[0] - 1, playersPos[1], playersPos[2], -22.500001, 22.199998, 162.999984, GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid));
- EditDynamicObject(playerid, MealMenu[playerid][mealObject]);
- }
- else if (!strcmp(stringb, "pickup"))
- {
- if (!MealMenu[playerid][mealExists])
- return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You don't have a meal.");
- if (!MealMenu[playerid][mealPlaced])
- return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You don't have a meal placed.");
- if (!IsPlayerInRangeOfPoint(playerid, 4.0, MealMenu[playerid][mealPos][0], MealMenu[playerid][mealPos][1], MealMenu[playerid][mealPos][2]))
- return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You aren't near your meal tray.");
- DestroyDynamicObject(MealMenu[playerid][mealObject]);
- SendNearbyMessage(playerid, 20.0, COLOR_EMOTE, "* %s picks up their meal down.", ReturnName(playerid, 0));
- SetPlayerSpecialAction(playerid, SPECIAL_ACTION_CARRY);
- SetPlayerAttachedObject(playerid, 9, MealMenu[playerid][mealModel], 1, 0.027000, 0.426000, -0.268000, 127.699913, 119.700027, -66.799972);
- MealMenu[playerid][mealPlaced] = false;
- PlayerData[playerid][pCarryingMeal] = true;
- }
- else return SendClientMessage(playerid, COLOR_ADM, "SERVER: Nevazeca opcija.");
- return true;
- }
- //Vehicle Commands
- CMD:v(playerid, params[])return cmd_vehicle(playerid, params);
- CMD:vehicle(playerid, params[])
- {
- if(!pLoggedIn[playerid])return true;
- new a_string[60], b_string[128], string[128];
- if(sscanf(params, "s[60]S()[128]", a_string, b_string)){
- SendClientMessage(playerid, COLOR_ACTION, "____________________________________________________");
- SendClientMessage(playerid, COLOR_ACTION, "USAGE: /v(ehicle) [action]");
- SendClientMessage(playerid, COLOR_ACTION, "[Actions] get, park, buypark, stats, list");
- SendClientMessage(playerid, COLOR_ACTION, "[Actions] find, tow, faction, buy, trunk, hood");
- SendClientMessage(playerid, COLOR_ACTION, "[Actions] payfines, sell, accept, refill, lights");
- SendClientMessage(playerid, COLOR_ACTION, "[Actions] lock, duplicatekey, (un)register");
- SendClientMessage(playerid, COLOR_ACTION, "[Actions] scrap (warning: permanently deletes your vehicle)");
- SendClientMessage(playerid, COLOR_ACTION, "____________________________________________________");
- return true;
- }
- if(!strcmp(a_string, "get") || !strcmp(a_string, "g", true)){
- if(_has_vehicle_spawned[playerid])
- return SendClientMessage(playerid, COLOR_ADM, "SERVER: Vec imate vozilo koje je spawnovano.");
- if(gettime() - PlayerListShow[playerid] < 3)
- return SendClientMessage(playerid, COLOR_ADM, "You need to wait 3 seconds before using this again.");
- if(GetPVarInt(playerid, "Viewing_OwnedCarList") > 0)
- return SendClientMessage(playerid, COLOR_ADM, "You're already looking at it.");
- ShowPlayerVehicleList(playerid);
- PlayerListShow[playerid] = gettime();
- return 1;
- /*new slotid;
- if(sscanf(b_string, "d", slotid))
- return SendClientMessage(playerid, COLOR_ADM, "USAGE:{FFFFFF} /v(ehicle) get [vehicle slot ID]");
- if(slotid > MAX_OWNED_CARS || slotid < 1)
- return SendClientMessage(playerid, COLOR_ADM, "SERVER: Invalid Slot.");
- if(!PlayerData[playerid][pOwnedCar][slotid])
- return SendClientMessage(playerid, COLOR_ADM, "ERROR: You don't have a vehicle in that slot.");
- if(_has_vehicle_spawned[playerid])
- return SendClientMessage(playerid, COLOR_ADM, "SERVER: Vec imate vozilo koje je spawnovano.");
- LoadOwnedCars(playerid, slotid);*/
- }
- else if(!strcmp(a_string, "park") || !strcmp(a_string, "p", true)) {
- if(!IsPlayerInAnyVehicle(playerid))return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} Niste u vozilu.");
- if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You aren't in the driver's seat.");
- new vehicleid = GetPlayerVehicleID(playerid);
- if(!IsValidPlayerCar(vehicleid))
- return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You can't park this type of vehicle.");
- if(PlayerData[playerid][pSQLID] != CarData[vehicleid][carOwnerID])
- return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You don't own this vehicle.");
- if(!IsPlayerInRangeOfPoint(playerid, 5.0, CarData[vehicleid][carPos][0], CarData[vehicleid][carPos][1], CarData[vehicleid][carPos][2])){
- SetPlayerCheckpoint(playerid, CarData[vehicleid][carPos][0], CarData[vehicleid][carPos][1], CarData[vehicleid][carPos][2], 3.0);
- SendClientMessage(playerid, COLOR_ADM, "You have to be at your vehicle's parking place.");
- SendClientMessage(playerid, COLOR_PINK, "Follow the marker.");
- return true;
- }
- for(new i = 1; i < 5; i++)
- {
- if(CarData[vehicleid][carWeapons][i])
- {
- if(IsValidDynamicObject(CarData[vehicleid][carWeaponObject][i]))
- DestroyDynamicObject(CarData[vehicleid][carWeaponObject][i]);
- }
- }
- foreach(new i : Player)
- {
- if(PlayerPlacingWeapon[i] && PlayerPlacingInVehicle[i] == vehicleid)
- {
- CancelEdit(i);
- if(IsValidDynamicObject(CarData[ PlayerPlacingInVehicle[i] ][carWeaponObject][PlayerPlacingWeaponSlot[i]]))
- DestroyDynamicObject(CarData[ PlayerPlacingInVehicle[i] ][carWeaponObject][PlayerPlacingWeaponSlot[i]]);
- }
- }
- foreach(new i : Player)
- {
- if(GetPVarInt(i, "DuplicateKey") == CarData[vehicleid][carID])
- {
- DeletePVar(i, "DuplicateKey");
- Message(i, COLOR_WHITE, "Your duplicate key to %s's vehicle expired.", ReturnSQLName(CarData[vehicleid][carOwnerID]));
- }
- }
- CarData[vehicleid][carExists] = false;
- SaveCar(vehicleid);
- _has_vehicle_spawned[playerid] = false;
- _has_spawned_vehicleid[playerid] = 0;
- format(string, sizeof(string), "Parked by %s", ReturnName(playerid));
- LogVehicleAction(vehicleid, string);
- format(string, sizeof(string), "Your %s was parked.", ReturnVehicleName(vehicleid));
- SendClientMessage(playerid, COLOR_DARKGREEN, string);
- SetVehicleHealth(vehicleid, 300);
- DefaultVehicleValues(vehicleid);
- DestroyVehicle(vehicleid);
- }
- else if(!strcmp(a_string, "unregister")) {
- new pcar = GetPlayerVehicleID(playerid);
- new Float:x, Float:y, Float:z;
- new engine, lights, alarm, doors, bonnet, boot, objective;
- GetVehicleParamsEx(pcar, engine, lights, alarm, doors, bonnet, boot, objective);
- if(IsValidFactionCar(pcar)) return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You can't perform this action on faction vehicles.");
- if(!IsPlayerInAnyVehicle(playerid))return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You aren't in a vehicle.");
- if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You aren't in the driver's seat.");
- if(!IsPlayerInRangeOfPoint(playerid, 5.0, 2520.11, -1485.05, 24.00))
- {
- SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You aren't at the illegal vehicle operations site.");
- SetPlayerCheckpoint(playerid, 2520.11, -1485.05, 24.00, 3.0);
- SendClientMessage(playerid, COLOR_ADM, "SERVER:{FFFFFF} A checkpoint has been placed on your minimap.");
- return 1;
- }
- format(CarData[pcar][carPlates], 32, " ");
- SetVehicleNumberPlate(pcar, " ");
- SaveCar(pcar);
- SetVehicleToRespawn(pcar);
- GetPlayerPos(playerid, x, y, z);
- SetVehiclePos(pcar, x, y, z);
- PutPlayerInVehicle(playerid, pcar, 0);
- SetVehicleParamsEx(pcar, VEHICLE_PARAMS_ON, lights, alarm, doors, bonnet, boot, objective);
- ToggleVehicleLock(pcar, false);
- CarData[pcar][carLocked] = false;
- GiveMoney(playerid, -500);
- SendClientMessage(playerid, COLOR_ADM, "SERVER:{FFFFFF} Your vehicle is now unregistered at the cost of $500.");
- SendClientMessage(playerid, COLOR_ADM, "SERVER:{FFFFFF} Note that this is illegal and you are breaking the law.");
- }
- else if(!strcmp(a_string, "register")){
- new pcar = GetPlayerVehicleID(playerid);
- new Float:x, Float:y, Float:z;
- new rand[3];
- new outcome = 100;
- new engine, lights, alarm, doors, bonnet, boot, objective;
- GetVehicleParamsEx(pcar, engine, lights, alarm, doors, bonnet, boot, objective);
- if (!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You aren't in an vehicle.");
- if(PlayerData[playerid][pSQLID] != CarData[pcar][carOwnerID]) return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You don't own this vehicle.");
- if(!IsPlayerInRangeOfPoint(playerid, 5.0, 2520.11, -1485.05, 24.00))
- {
- SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You aren't at the illegal vehicle operations site.");
- SetPlayerCheckpoint(playerid, 2520.11, -1485.05, 24.00, 3.0);
- SendClientMessage(playerid, COLOR_ADM, "SERVER:{FFFFFF} A checkpoint has been placed on your minimap.");
- return 1;
- }
- rand[0] = random(sizeof(PlatePossible));
- rand[1] = random(sizeof(PlatePossible));
- rand[2] = random(sizeof(PlatePossible));
- 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));
- SetVehicleNumberPlate(pcar, CarData[pcar][carPlates]);
- SaveCar(pcar);
- SetVehicleToRespawn(pcar);
- GetPlayerPos(playerid, x, y, z);
- SetVehiclePos(pcar, x, y, z);
- PutPlayerInVehicle(playerid, pcar, 0);
- ToggleVehicleLock(pcar, false);
- CarData[pcar][carLocked] = false;
- SetVehicleParamsEx(pcar, VEHICLE_PARAMS_ON, lights, alarm, doors, bonnet, boot, objective);
- format(string, sizeof(string), "%s registered their vehicle (Vehicle ID %d - new plate: %s).", ReturnName(playerid, 1), pcar, CarData[pcar][carPlates]);
- SendClientMessage(playerid, COLOR_ADM, "This vehicle has been registered to the DMV and is now legal.");
- switch(outcome)
- {
- case 1 .. 49:
- {
- SendClientMessage(playerid, COLOR_ADM, "The process was plain sailing, you manage to register your vehicle for $1750");
- GiveMoney(playerid, -1750);
- }
- case 50 .. 100:
- {
- SendClientMessage(playerid, COLOR_ADM, "It wasn't easy - passing official paperwork without repercussions cost you $2500.");
- GiveMoney(playerid, -2500);
- }
- default:
- {
- SendClientMessage(playerid, COLOR_ADM, "You managed to submit the paperwork off yourself for a free registration!");
- }
- }
- adminWarn(3, string);
- }
- else if(!strcmp(a_string, "buypark") || !strcmp(a_string, "bp")) {
- if(!IsPlayerInAnyVehicle(playerid))return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You aren't in any vehicle to park.");
- if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You aren't in the driver's seat.");
- new ownedHouse, freePark = 0, vehicleid = GetPlayerVehicleID(playerid);
- if(IsValidPlayerCar(vehicleid)){
- if(CarData[vehicleid][carOwnerID] != PlayerData[playerid][pSQLID])return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You don't own this vehicle.");
- GetPlayerPos(playerid, CarData[vehicleid][carPos][0], CarData[vehicleid][carPos][1], CarData[vehicleid][carPos][2]);
- GetVehicleZAngle(vehicleid, CarData[vehicleid][carPos][3]);
- CarData[vehicleid][carInterior] = GetPlayerInterior(playerid);
- CarData[vehicleid][carWorld] = GetPlayerVirtualWorld(playerid);
- for(new i = 0; i < MAX_PROPERTY; i++){
- if(PropertyData[i][propertyid] != 0){
- if(PropertyData[i][propertyOwnerSQL] == PlayerData[playerid][pSQLID]){
- ownedHouse = i;
- }
- }
- }
- if(PlayerData[playerid][pInsideGarage]){
- if(GarageData[playerid][garagePropertyID] == ownedHouse){
- freePark = 1;
- }
- }
- else {
- for(new i = 0; i < MAX_PROPERTY; i++){
- if(PropertyData[i][propertyid] != 0){
- if(IsPlayerInRangeOfPoint(playerid, 15.0, PropertyData[i][propertyExterior][0], PropertyData[i][propertyExterior][1], PropertyData[i][propertyExterior][2])){
- if(PropertyData[i][propertyOwnerSQL] == PlayerData[playerid][pSQLID]){
- freePark = 1;
- }
- }
- }
- }
- }
- if(!freePark) {
- if(150 > PlayerData[playerid][pMoney])
- return SendClientMessage(playerid, COLOR_ADM, "You can't afford this parking. ($150)");
- GiveMoney(playerid, -150);
- SendClientMessage(playerid, COLOR_DARKGREEN, "Parking place purchased for $150 (Area change).");
- }
- else {
- SendClientMessage(playerid, COLOR_DARKGREEN, "Parking place changed for free of charge!");
- }
- }
- else if(IsValidFactionCar(vehicleid)){
- if(PlayerData[playerid][pAdmin] < 3)return SendClientMessage(playerid, COLOR_ADM, "PRISTUP ODBIJEN:{FFFFFF} You can't park this vehicle.");
- GetVehiclePos(vehicleid, FactionCar[vehicleid][carPos][0], FactionCar[vehicleid][carPos][1], FactionCar[vehicleid][carPos][2]);
- GetVehicleZAngle(vehicleid, FactionCar[vehicleid][carPos][3]);
- FactionCar[vehicleid][carInterior] = GetPlayerInterior(playerid);
- FactionCar[vehicleid][carWorld] = GetPlayerVirtualWorld(playerid);
- SaveFactionCar(vehicleid);
- RefreshFactionCar(vehicleid);
- GiveMoney(playerid, -150);
- SendClientMessage(playerid, COLOR_DARKGREEN, "Parking place purchased for $150.");
- }
- else return SendClientMessage(playerid, COLOR_ADM, "SERVER: This command can only be used for private vehicles. You are in a public static vehicle.");
- }
- else if(!strcmp(a_string, "stats")){
- if (!IsPlayerInAnyVehicle(playerid))return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} Niste u vozilu.");
- new pcar = GetPlayerVehicleID(playerid);
- if (CarData[pcar][carOwnerID] != PlayerData[playerid][pSQLID])return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You don't own this vehicle");
- format(string, sizeof(string), "Life Span: Engine Life[%.2f], Battery Life[%.2f], Times Destroyed[%d]", CarData[pcar][carEngine], CarData[pcar][carBattery], CarData[pcar][carTimeDestroyed]);
- SendClientMessage(playerid, COLOR_WHITE, string);
- 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]);
- SendClientMessage(playerid, COLOR_WHITE, string);
- 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]);
- SendClientMessage(playerid, COLOR_WHITE, string);
- }
- else if(!strcmp(a_string, "list"))
- {
- if (CountPlayerCars(playerid) == 0)
- return SendClientMessage(playerid, COLOR_ADM, "SERVER: You don't own any vehicles.");
- ShowVehicleList(playerid);
- }
- else if(!strcmp(a_string, "find")){
- if(!_has_vehicle_spawned[playerid])return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You don't have a vehicle spawned.");
- if(!IsVehicleOccupied(_has_spawned_vehicleid[playerid])){
- new
- Float: car_pos[3]
- ;
- GetVehiclePos(_has_spawned_vehicleid[playerid], car_pos[0], car_pos[1], car_pos[2]);
- SetPlayerCheckpoint(playerid, car_pos[0], car_pos[1], car_pos[2], 4.0);
- }
- else return SendClientMessage(playerid, COLOR_ADM, "Your vehicle is in use / stolen right now!");
- }
- else if(!strcmp(a_string, "tow")){
- if(!_has_vehicle_spawned[playerid])return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You don't have a vehicle spawned.");
- if(playerTowingVehicle[playerid])
- return SendClientMessage(playerid, COLOR_ADM, "You're already towing a vehicle. ");
- if(!IsVehicleOccupied(_has_spawned_vehicleid[playerid]))
- {
- SendClientMessage(playerid, COLOR_DARKGREEN, "Tow Request Sent");
- vehicleTowSign[_has_spawned_vehicleid[playerid]] =
- Create3DTextLabel("(( | ))\nTOWING VEHICLE", COLOR_DARKGREEN, 0.0, 0.0, 0.0, 25.0, 0, 1);
- Attach3DTextLabelToVehicle(vehicleTowSign[_has_spawned_vehicleid[playerid]], _has_spawned_vehicleid[playerid], -0.0, -0.0, -0.0);
- playerTowingVehicle[playerid] = true;
- playerTowTimer[playerid] = SetTimerEx("OnVehicleTow", 4500, true, "i", playerid);
- }
- else return SendClientMessage(playerid, COLOR_ADM, "Your vehicle is in use / stolen right now!");
- }
- else if(!strcmp(a_string, "faction")){
- if(PlayerData[playerid][pAdmin] < 3 && PlayerData[playerid][pFactionRank] != 1)
- return SendClientMessage(playerid, COLOR_ADM, "PRISTUP ODBIJEN:{FFFFFF} You don't have permission to do this.");
- if(!IsPlayerInAnyVehicle(playerid))return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} Niste u vozilu.");
- new vehicleid = GetPlayerVehicleID(playerid);
- new query[256];
- new Float:currPos[4];
- GetPlayerPos(playerid, currPos[0], currPos[1], currPos[2]);
- GetVehicleZAngle(vehicleid, currPos[3]);
- if(IsValidPlayerCar(vehicleid)) {
- if(CarData[vehicleid][carOwnerID] != PlayerData[playerid][pSQLID])return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You don't own this vehicle.");
- Resources[playerid][v_Model] = CarData[vehicleid][carModel];
- Resources[playerid][v_Faction] = PlayerData[playerid][pFaction];
- Resources[playerid][v_Color1] = CarData[vehicleid][carColor1];
- Resources[playerid][v_Color2] = CarData[vehicleid][carColor2];
- Resources[playerid][v_Pos][0] = currPos[0];
- Resources[playerid][v_Pos][1] = currPos[1];
- Resources[playerid][v_Pos][2] = currPos[2];
- Resources[playerid][v_Pos][3] = currPos[3];
- mysql_format(m_Handle, query, sizeof(query), "DELETE FROM `ownedcars` WHERE id = %i", CarData[vehicleid][carID]);
- mysql_query(m_Handle, query);
- 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)",
- PlayerData[playerid][pFaction], CarData[vehicleid][carModel], currPos[0], currPos[1], currPos[2], currPos[3], GetPlayerInterior(playerid), GetPlayerVirtualWorld(playerid), CarData[vehicleid][carColor1],
- CarData[vehicleid][carColor2]);
- mysql_pquery(m_Handle, query, "SQL_AddFactionVehicle", "i", playerid);
- for(new i = 1; i < MAX_OWNED_CARS; i++){
- if(PlayerData[playerid][pOwnedCar][i] == CarData[vehicleid][carID]){
- PlayerData[playerid][pOwnedCar][i] = 0;
- }
- }
- DefaultVehicleValues(vehicleid);
- _has_spawned_vehicleid[playerid] = 0;
- _has_vehicle_spawned[playerid] = 0;
- format(string, sizeof(string), "%s made their %s a faction vehicle", ReturnName(playerid, 1), ReturnVehicleName(vehicleid));
- adminWarn(3, string);
- format(string, sizeof(string), "Your %s now belongs to the %s. You will no longer own it.", ReturnVehicleName(vehicleid), ReturnFactionName(PlayerData[playerid][pFaction]));
- SendClientMessage(playerid, COLOR_YELLOW, string);
- WriteLog("vehicle_logs/factionize_log.txt", "[%s] %s factionized their vehicle to factionid %d", ReturnDate(), ReturnName(playerid, 1), PlayerData[playerid][pFaction]);
- return true;
- }
- else if(AdminCar[vehicleid]) {
- if(PlayerData[playerid][pAdmin] < 4)return SendClientMessage(playerid, COLOR_ADM, "PRISTUP ODBIJEN:{FFFFFF} You don't have permission to factionize this vehicle.");
- new factionid;
- if(sscanf(b_string, "d", factionid))
- return SendClientMessage(playerid, COLOR_ADM, "USAGE:{FFFFFF} /v(ehicle) faction [faction_id] - {FF6346}THIS IS AN ADMIN VEHICLE.");
- new color1 = AdminCarColor1[vehicleid];
- new color2 = AdminCarColor2[vehicleid];
- format(string, sizeof(string), "This %s now belongs to the %s.", ReturnVehicleName(vehicleid), ReturnFactionName(factionid));
- SendClientMessage(playerid, COLOR_YELLOW, string);
- AdminCar[vehicleid] = false;
- Resources[playerid][v_Model] = GetVehicleModel(vehicleid);
- Resources[playerid][v_Faction] = factionid;
- Resources[playerid][v_Color1] = color1;
- Resources[playerid][v_Color2] = color2;
- Resources[playerid][v_Pos][0] = currPos[0];
- Resources[playerid][v_Pos][1] = currPos[1];
- Resources[playerid][v_Pos][2] = currPos[2];
- Resources[playerid][v_Pos][3] = currPos[3];
- 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)",
- factionid, GetVehicleModel(vehicleid), currPos[0], currPos[1], currPos[2], currPos[3], GetPlayerInterior(playerid), GetPlayerVirtualWorld(playerid), color1, color2);
- mysql_pquery(m_Handle, query, "SQL_AddFactionVehicle", "i", playerid);
- WriteLog("admin_logs/factions/carfactionize_log.txt", "[%s] %s factionized their vehicle to factionid %d", ReturnDate(), ReturnName(playerid, 1), factionid);
- return true;
- }
- else return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You can't factionize this vehicle.");
- }
- else if(!strcmp(a_string, "buy")){
- if(_has_vehicle_spawned[playerid])return SendClientMessage(playerid, COLOR_ADM, "SERVER: You need to despawn your vehicle before buying a new one.");
- for(new i = 0; i < MAX_BUSINESS; i++)
- {
- if(BusinessData[i][businessID] != 0){
- if(IsPlayerInRangeOfPoint(playerid, 6.0, BusinessData[i][businessExt][0], BusinessData[i][businessExt][1], BusinessData[i][businessExt][2])){
- if(BusinessData[i][businessType] >= 9){
- new newString[300];
- string[0] = EOS;
- for(new v = 0; v < sizeof(g_aDealershipCategory); v++){
- format(newString, sizeof(newString), "%s%s\n", newString, g_aDealershipCategory[v]);
- }
- ShowPlayerDialog(playerid, DIALOG_DEALERSHIP, DIALOG_STYLE_LIST, "Categories:", newString, "Odaberi", "<<");
- PlayerData[playerid][pAtDealership] = i;
- ClearDealershipVar(playerid);
- return true;
- }
- }
- }
- }
- SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You aren't at a dealership OR aren't near one.");
- }
- else if(!strcmp(a_string, "scrap")){
- new confirm[60], query[60], str[128], vehicleid = GetPlayerVehicleID(playerid);
- if(!IsPlayerInAnyVehicle(playerid))
- return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} Niste u vozilu.");
- if(!IsValidPlayerCar(vehicleid))
- return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You can't scrap this vehicle.");
- if(PlayerData[playerid][pSQLID] != CarData[vehicleid][carOwnerID])
- return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You don't own this vehicle.");
- if(sscanf(b_string, "s[60]", confirm)){
- SendClientMessage(playerid, COLOR_ACTION, "You're about to scrap your vehicle. Type /v scrap confirm to do it.");
- SendClientMessage(playerid, COLOR_RED, "This action is permanent and cannot be undone.");
- return true;
- }
- if(!strcmp(b_string, "confirm")){
- WriteLog("vehicle_logs/scrap_log.txt", "[%s] %s scrapped their %s (DBID: %i)", ReturnDate(), ReturnName(playerid), ReturnVehicleName(vehicleid), CarData[vehicleid][carID]);
- format(str, sizeof(str), "You scrapped your %s.", ReturnVehicleName(vehicleid));
- SendClientMessage(playerid, COLOR_ACTION, str);
- _has_vehicle_spawned[playerid] = false;
- _has_spawned_vehicleid[playerid] = 0;
- for(new i = 1; i < MAX_OWNED_CARS; i++)
- {
- if(PlayerData[playerid][pOwnedCar][i] == CarData[vehicleid][carID])
- {
- PlayerData[playerid][pOwnedCar][i] = 0;
- }
- }
- mysql_format(m_Handle, query, sizeof(query), "DELETE FROM ownedcars WHERE id = %i", CarData[vehicleid][carID]);
- mysql_pquery(m_Handle, query);
- DefaultVehicleValues(vehicleid);
- DestroyVehicle(vehicleid);
- RefreshPlayerCarSlots(playerid);
- }
- else return SendClientMessage(playerid, COLOR_ADM, "SERVER: Nevazeca opcija.");
- }
- else if(!strcmp(a_string, "hood"))
- {
- new
- Float:x,
- Float:y,
- Float:z
- ;
- new engine, lights, alarm, doors, bonnet, boot, objective;
- if(!IsPlayerInAnyVehicle(playerid) && GetNearestVehicle(playerid) != INVALID_VEHICLE_ID)
- {
- GetVehicleHood(GetNearestVehicle(playerid), x, y, z);
- new
- vehicleid = GetNearestVehicle(playerid)
- ;
- if(IsValidFactionCar(vehicleid) && PlayerData[playerid][pFaction] != FactionCar[vehicleid][carFaction])
- return SendClientMessage(playerid, COLOR_YELLOW, "SERVER: You don't have access to this vehicle.");
- if(!IsValidFactionCar(vehicleid) && CarData[vehicleid][carLocked])
- return SendClientMessage(playerid, COLOR_YELLOW, "This vehicle is locked.");
- if(!IsPlayerInRangeOfPoint(playerid, 2.5, x, y, z))
- return SendClientMessage(playerid, COLOR_YELLOW, "You aren't near the vehicles hood.");
- GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
- if(!bonnet)
- {
- SetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, 1, boot, objective);
- SendClientMessage(playerid, COLOR_YELLOW, "You have opened the hood.");
- }
- else
- {
- SetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, 0, boot, objective);
- SendClientMessage(playerid, COLOR_YELLOW, "You have closed the hood.");
- }
- }
- else if(IsPlayerInAnyVehicle(playerid))
- {
- new
- vehicleid = GetPlayerVehicleID(playerid)
- ;
- if(IsValidFactionCar(vehicleid) && PlayerData[playerid][pFaction] != FactionCar[vehicleid][carFaction])
- return SendClientMessage(playerid, COLOR_YELLOW, "SERVER: You don't have access to this vehicle.");
- if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER)
- return SendClientMessage(playerid, COLOR_YELLOW, "SERVER: You aren't in the driver's seat.");
- GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
- if(!bonnet)
- {
- SetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, 1, boot, objective);
- SendClientMessage(playerid, COLOR_YELLOW, "You have opened the hood.");
- }
- else
- {
- SetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, 0, boot, objective);
- SendClientMessage(playerid, COLOR_YELLOW, "You have closed the hood.");
- }
- }
- else return SendClientMessage(playerid, COLOR_YELLOW, "SERVER: You aren't in or near a vehicle.");
- }
- else if(!strcmp(a_string, "trunk"))
- {
- new
- Float:x,
- Float:y,
- Float:z
- ;
- new engine, lights, alarm, doors, bonnet, boot, objective;
- if(!IsPlayerInAnyVehicle(playerid) && GetNearestVehicle(playerid) != INVALID_VEHICLE_ID)
- {
- GetVehicleBoot(GetNearestVehicle(playerid), x, y, z);
- new
- vehicleid = GetNearestVehicle(playerid)
- ;
- if(IsValidFactionCar(vehicleid) && PlayerData[playerid][pFaction] != FactionCar[vehicleid][carFaction])
- return SendClientMessage(playerid, COLOR_YELLOW, "SERVER: You don't have access to this vehicle.");
- if(!IsValidFactionCar(vehicleid) && CarData[vehicleid][carLocked])
- return SendClientMessage(playerid, COLOR_YELLOW, "This vehicle is locked.");
- if(!IsPlayerInRangeOfPoint(playerid, 2.5, x, y, z))
- return SendClientMessage(playerid, COLOR_YELLOW, "You aren't near the vehicles trunk.");
- GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
- if(!boot)
- {
- SetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, 1, objective);
- SendClientMessage(playerid, COLOR_YELLOW, "You have opened the trunk.");
- SendClientMessage(playerid, COLOR_WHITE, "You can use /check to take a gun or /place to put one in.");
- }
- else
- {
- SetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, 0, objective);
- SendClientMessage(playerid, COLOR_YELLOW, "You have closed the trunk.");
- }
- }
- else if(IsPlayerInAnyVehicle(playerid))
- {
- new
- vehicleid = GetPlayerVehicleID(playerid)
- ;
- if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER)
- return SendClientMessage(playerid, COLOR_YELLOW, "You aren't in the driver's seat.");
- if(IsValidFactionCar(vehicleid) && PlayerData[playerid][pFaction] != FactionCar[vehicleid][carFaction])
- return SendClientMessage(playerid, COLOR_YELLOW, "SERVER: You don't have access to this vehicle.");
- GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
- if(!boot)
- {
- SetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, 1, objective);
- SendClientMessage(playerid, COLOR_YELLOW, "You have opened the trunk.");
- SendClientMessage(playerid, COLOR_WHITE, "You can use /check, /takegun and /place.");
- }
- else
- {
- SetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, 0, objective);
- SendClientMessage(playerid, COLOR_YELLOW, "You have closed the trunk.");
- }
- }
- else return SendClientMessage(playerid, COLOR_YELLOW, "SERVER: You aren't near or in a vehicle.");
- }
- else if(!strcmp(a_string, "payfines"))
- {
- new
- vehicleid = GetPlayerVehicleID(playerid);
- if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER)
- return SendClientMessage(playerid, COLOR_YELLOW, "You aren't in the driver's seat.");
- if(CarData[vehicleid][carOwnerID] != PlayerData[playerid][pSQLID])
- return SendClientMessage(playerid, COLOR_ADM, "SERVER: You don't own this vehicle.");
- if(!CountVehicleFines(vehicleid))
- return SendClientMessage(playerid, COLOR_ADM, "SERVER: This vehicle doesn't have any fines.");
- if(PlayerData[playerid][pMoney] < CountVehicleFinesTotal(vehicleid))
- return SendClientMessage(playerid, COLOR_ADM, "SERVER: You don't have enough money to pay all the fines.");
- if(!IsPlayerNearBusiness(playerid) || IsPlayerNearBusiness(playerid) && BusinessData[IsPlayerNearBusiness(playerid)][businessType] != 9)
- return SendClientMessage(playerid, COLOR_ADM, "SERVER: You aren't at a dealership.");
- format(string, sizeof(string), "[-] You paid fines accumulating up to $%s.", MoneyFormat(CountVehicleFinesTotal(vehicleid)));
- SendClientMessage(playerid, COLOR_YELLOW, string);
- GiveMoney(playerid, -CountVehicleFinesTotal(vehicleid));
- ClearVehicleFines(vehicleid);
- }
- else if(!strcmp(a_string, "sell"))
- {
- new playerb, price, hasSpace = -1;
- new vehicleid = GetPlayerVehicleID(playerid);
- if(!isnull(b_string) && !strcmp(b_string, "cancel", true))
- {
- if(VehicleOfferedTo[playerid] == INVALID_PLAYER_ID)
- return SendClientMessage(playerid, COLOR_ADM, "ERROR: You haven't offered to sell a vehicle.");
- Message(playerid, COLOR_ACTION, "SERVER: You cancelled your offer. %s was notified.", ReturnName(VehicleOfferedTo[playerid]));
- Message(VehicleOfferedTo[playerid], COLOR_ACTION, "SERVER: %s cancelled their vehicle offer.", ReturnName(playerid));
- VehicleOfferedTo[VehicleOfferBy[playerid]] = INVALID_PLAYER_ID;
- VehicleOfferBy[playerid] = INVALID_PLAYER_ID;
- VehiclePrice[playerid] = 0;
- VehicleDBIDOffered[VehicleOfferedTo[playerid]] = 0;
- return 1;
- }
- if(playerid == playerb) return SendClientMessage(playerid, COLOR_ADM, "ERROR: You can't sell a vehicle to yourself.");
- if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER)
- return SendClientMessage(playerid, COLOR_ADM, "ERROR: You aren't in a vehicle.");
- if(CarData[vehicleid][carOwnerID] != PlayerData[playerid][pSQLID])
- return SendClientMessage(playerid, COLOR_ADM, "ERROR: You don't own this vehicle.");
- if(VehicleOfferedTo[playerid] != INVALID_PLAYER_ID)
- return SendClientMessage(playerid, COLOR_ADM, "ERROR: You already offered your vehicle. Wait for their reply.");
- if(sscanf(b_string, "ui", playerb, price))
- return SendClientMessage(playerid, COLOR_ACTION, "USAGE: /v sell [playerid/DioImena] [price]");
- if(!IsPlayerConnected(playerb))
- return SendClientMessage(playerid, COLOR_ADM, "ERROR: You specified an invalid player.");
- if(!GetDistanceBetweenPlayers(playerid, playerb, 4.5))
- return SendClientMessage(playerid, COLOR_ADM, "ERROR: Niste u blizini te osobe.");
- if(price < 1)
- return SendClientMessage(playerid, COLOR_ADM, "SERVER: Invalid Price.");
- if(VehicleOfferBy[playerb] != INVALID_PLAYER_ID)
- return SendClientMessage(playerid, COLOR_ADM, "ERROR: That player has already been offered a vehicle.");
- hasSpace = FreePlayerCarID(playerb);
- if(hasSpace == -1) return SendClientMessage(playerid, COLOR_ADM, "SERVER: That player can't own anymore vehicles.");
- format(string, sizeof(string), "Are you sure you want to offer %s your %s for $%s?", ReturnName(playerb, 1), ReturnVehicleName(vehicleid), MoneyFormat(price));
- ConfirmDialog(playerid, "Potvrda", string, "OnVehicleOffer", playerb, price);
- return 1;
- }
- else if(!strcmp(a_string, "accept"))
- {
- if(VehicleOfferBy[playerid] == INVALID_PLAYER_ID)
- return SendClientMessage(playerid, COLOR_ADM, "ERROR: You haven't been offered a vehicle.");
- if(!strcmp(b_string, "yes", true))
- {
- if(!GetDistanceBetweenPlayers(playerid, VehicleOfferBy[playerid], 4.5))
- {
- Message(playerid, COLOR_ACTION, "You're no longer near your offerer (%s). The sale was cancelled.", ReturnName(VehicleOfferBy[playerid]));
- VehicleOfferedTo[VehicleOfferBy[playerid]] = INVALID_PLAYER_ID;
- VehicleOfferBy[playerid] = INVALID_PLAYER_ID;
- VehiclePrice[playerid] = 0;
- VehicleDBIDOffered[playerid] = 0;
- return 1;
- }
- if(VehiclePrice[playerid] > PlayerData[playerid][pMoney])
- {
- Message(playerid, COLOR_ACTION, "You can't afford this price. The sale was cancelled.", ReturnName(VehicleOfferBy[playerid]));
- Message(VehicleOfferBy[playerid], COLOR_ACTION, "%s can't afford your sale.", ReturnName(playerid));
- VehicleOfferedTo[VehicleOfferBy[playerid]] = INVALID_PLAYER_ID;
- VehicleOfferBy[playerid] = INVALID_PLAYER_ID;
- VehiclePrice[playerid] = 0;
- VehicleDBIDOffered[playerid] = 0;
- return 1;
- }
- new slot, foundCar = -1;
- for(new i = 1, j = GetVehiclePoolSize(); i <= j; i++)
- {
- if(CarData[i][carID] == VehicleDBIDOffered[playerid])
- {
- foundCar = i;
- }
- }
- if(foundCar == -1)
- {
- Message(playerid, COLOR_ACTION, "An error occurred. %s's vehicle is no longer spawned.", ReturnName(VehicleOfferBy[playerid]));
- Message(VehicleOfferBy[playerid], COLOR_ACTION, "An error occurred. Your vehicle is no longer spawned.", ReturnName(playerid));
- VehicleOfferedTo[VehicleOfferBy[playerid]] = INVALID_PLAYER_ID;
- VehicleOfferBy[playerid] = INVALID_PLAYER_ID;
- VehiclePrice[playerid] = 0;
- VehicleDBIDOffered[playerid] = 0;
- return 1;
- }
- format(string, sizeof(string), "%s sold their %s to %s for $%d", ReturnName(VehicleOfferBy[playerid]), ReturnVehicleModelName(CarData[foundCar][carModel]), ReturnName(playerid), VehiclePrice[VehicleOfferBy[playerid]]);
- adminWarn(1, string);
- _has_vehicle_spawned[VehicleOfferBy[playerid]] = false;
- _has_spawned_vehicleid[VehicleOfferBy[playerid]] = INVALID_VEHICLE_ID;
- Message(VehicleOfferBy[playerid], COLOR_ACTION, "SERVER: %s accepted your vehicle offer! (%s)", ReturnName(playerid), ReturnDateEx());
- Message(playerid, COLOR_ACTION, "SERVER: You accepted %s's vehicle offer! (%s)", ReturnName(VehicleOfferBy[playerid]), ReturnDateEx());
- 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]));
- slot = FreePlayerCarID(playerid);
- PlayerData[playerid][pOwnedCar][slot] = VehicleDBIDOffered[playerid];
- for(new i = 1; i < MAX_OWNED_CARS; i++)
- {
- if(PlayerData[VehicleOfferBy[playerid]][pOwnedCar][i] == VehicleDBIDOffered[playerid])
- {
- PlayerData[VehicleOfferBy[playerid]][pOwnedCar][i] = 0;
- }
- }
- CarData[foundCar][carOwnerID] = PlayerData[playerid][pSQLID];
- SaveCar(foundCar);
- GiveMoney(playerid, -VehiclePrice[VehicleOfferBy[playerid]]);
- GiveMoney(VehicleOfferBy[playerid], VehiclePrice[VehicleOfferBy[playerid]]);
- SavePlayer(playerid); SavePlayer(VehicleOfferBy[playerid]);
- RefreshPlayerCarSlots(VehicleOfferBy[playerid]);
- VehiclePrice[playerid] = 0;
- VehicleDBIDOffered[playerid] = 0;
- VehiclePrice[VehicleOfferBy[playerid]] = 0;
- VehicleDBIDOffered[VehicleOfferBy[playerid]] = 0;
- VehicleOfferedTo[VehicleOfferBy[playerid]] = INVALID_PLAYER_ID;
- VehicleOfferBy[playerid] = INVALID_PLAYER_ID;
- }
- else if(!strcmp(b_string, "no", true))
- {
- Message(VehicleOfferBy[playerid], COLOR_ACTION, "SERVER: %s declined your vehicle offer.", ReturnName(playerid));
- Message(playerid, COLOR_ACTION, "SERVER: You declined %s's offer.", ReturnName(VehicleOfferBy[playerid]));
- VehiclePrice[playerid] = 0;
- VehicleDBIDOffered[playerid] = 0;
- VehiclePrice[VehicleOfferBy[playerid]] = 0;
- VehicleDBIDOffered[VehicleOfferBy[playerid]] = 0;
- VehicleOfferedTo[VehicleOfferBy[playerid]] = INVALID_PLAYER_ID;
- VehicleOfferBy[playerid] = INVALID_PLAYER_ID;
- }
- else return SendClientMessage(playerid, COLOR_ADM, "SERVER: It's either a yes or a no.");
- }
- else if(!strcmp(a_string, "refill"))
- {
- if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER)
- return SendClientMessage(playerid, COLOR_ADM, "ERROR: You aren't driving a vehicle.");
- if(!IsValidPlayerCar(GetPlayerVehicleID(playerid)))
- return SendClientMessage(playerid, COLOR_ADM, "ERROR: This isn't a player vehicle.");
- if(PlayerRefilling[playerid])
- return SendClientMessage(playerid, COLOR_DARKGREEN, "You're in the process of refilling.");
- new
- vehicleid = GetPlayerVehicleID(playerid),
- vehicleType;
- if(GetVehicleModelInfoAsInt(GetVehicleModel(vehicleid), "TransMissionData_nEngineType") == 'P')
- vehicleType = FUEL_TYPE_PETROL;
- else if(GetVehicleModelInfoAsInt(GetVehicleModel(vehicleid), "TransMissionData_nEngineType") == 'D')
- vehicleType = FUEL_TYPE_DIESEL;
- else vehicleType = FUEL_TYPE_ELECTRIC;
- if(IsPlayerNearFuelStation(playerid) != -1)
- {
- 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));
- ConfirmDialog(playerid, "Potvrda", string, "OnConfirmFuel", vehicleType);
- }
- else return SendClientMessage(playerid, COLOR_ADM, "SERVER: You aren't near a gas station.");
- }
- else if(!strcmp(a_string, "lights")) return cmd_lights(playerid, "");
- else if(!strcmp(a_string, "lock"))
- {
- new nearVehicle;
- for(new i = 0; i < MAX_VEHICLES; i++)
- {
- new Float: currPos[3];
- GetVehiclePos(i, currPos[0], currPos[1], currPos[2]);
- if(IsPlayerInRangeOfPoint(playerid, 5.0, currPos[0], currPos[1], currPos[2])){
- nearVehicle++;
- if(IsValidPlayerCar(i)){
- if(CarData[i][carOwnerID] != PlayerData[playerid][pSQLID] && !PlayerData[playerid][pAdminDuty])return GameTextForPlayer(playerid, "You don't have the keys to this", 2000, 6);
- if(!CarData[i][carLocked]){
- ToggleVehicleLock(i, true);
- CarData[i][carLocked] = true;
- SaveSQLInt(CarData[i][carID], "ownedcars", "Locked", 1);
- format(string, sizeof(string), "%s locked", ReturnName(playerid));
- LogVehicleAction(i, string);
- format(string, sizeof(string), "~r~%s LOCKED", ReturnVehicleName(i));
- GameTextForPlayer(playerid, string, 3000, 4);
- PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
- }
- else{
- CarData[i][carLocked] = false;
- ToggleVehicleLock(i, false);
- SaveSQLInt(CarData[i][carID], "ownedcars", "Locked", 0);
- format(string, sizeof(string), "%s unlocked", ReturnName(playerid));
- LogVehicleAction(i, string);
- format(string, sizeof(string), "~g~%s UNLOCKED", ReturnVehicleName(i));
- GameTextForPlayer(playerid, string, 3000, 4);
- PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
- }
- }
- else if(IsValidRentalCar(i)){
- if(!RentalData[i][rentalcarRented])return GameTextForPlayer(playerid, "~r~This vehicle doesn't have a lock", 3000, 4);
- if(RentalData[i][rentalcarRentedBy] != PlayerData[playerid][pSQLID] && !PlayerData[playerid][pAdminDuty])return GameTextForPlayer(playerid, "You don't have the keys to this", 2000, 6);
- if(!RentalData[i][rentalcarLocked]){
- ToggleVehicleLock(i, true);
- RentalData[i][rentalcarLocked] = true;
- format(string, sizeof(string), "~r~%s LOCKED", ReturnVehicleName(i));
- GameTextForPlayer(playerid, string, 3000, 4);
- PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
- }
- else{
- ToggleVehicleLock(i, false);
- RentalData[i][rentalcarLocked] = false;
- format(string, sizeof(string), "~g~%s UNLOCKED", ReturnVehicleName(i));
- GameTextForPlayer(playerid, string, 3000, 4);
- PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
- }
- }
- else return GameTextForPlayer(playerid, "~r~This vehicle doesn't have a lock", 3000, 4);
- }
- }
- if(!nearVehicle)return SendClientMessage(playerid, COLOR_ADM, "SERVER: You aren't near a vehicle or it isn't synced.");
- }
- else if(!strcmp(a_string, "duplicatekey"))
- {
- new playerb;
- if(sscanf(b_string, "i", playerb))
- return SendClientMessage(playerid, COLOR_ADM, "USAGE: /v duplicatekey [playerid/DioImena]");
- if(!IsPlayerConnected(playerb))
- return SendClientMessage(playerid, COLOR_ADM, "Taj igrac nije konektovan.");
- if(!_has_vehicle_spawned[playerid])
- return SendClientMessage(playerid, COLOR_ADM, "ERROR: You don't have a car spawned.");
- if(!GetDistanceBetweenPlayers(playerid, playerb, 5.0))
- return SendClientMessage(playerid, COLOR_ADM, "You aren't near that player.");
- if(GetPVarInt(playerb, "DuplicateKey") != 0)
- return SendClientMessage(playerid, COLOR_ADM, "That player already has a duplicated key.");
- if(GetPVarInt(playerb, "DuplicateKey") == CarData[_has_spawned_vehicleid[playerid]][carID])
- return SendClientMessage(playerid, COLOR_ADM, "That player already has your cars key.");
- GiveMoney(playerid, -50);
- 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]));
- 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]));
- format(string, sizeof(string), "* %s gives %s a duplicate key of their vehicle.", ReturnName(playerid, 0), ReturnName(playerb, 0));
- SetPlayerChatBubble(playerid, string, COLOR_ACTION, 20.0, 3000);
- SetPVarInt(playerb, "DuplicateKey", CarData[_has_spawned_vehicleid[playerid]][carID]);
- }
- else return SendClientMessage(playerid, COLOR_ADM, "SERVER: Nevazeca opcija.");
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement