Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CMD:pvlock(playerid, params[])
- {
- new Float: x, Float: y, Float: z;
- if(PlayerInfo[playerid][pVehicleKeysFrom] != INVALID_PLAYER_ID)
- {
- new ownerid = PlayerInfo[playerid][pVehicleKeysFrom];
- if(IsPlayerConnected(ownerid))
- {
- new d = PlayerInfo[playerid][pVehicleKeys];
- if(PlayerVehicleInfo[ownerid][d][pvId] != INVALID_PLAYER_VEHICLE_ID) GetVehiclePos(PlayerVehicleInfo[ownerid][d][pvId], x, y, z);
- if(IsPlayerInRangeOfPoint(playerid, 3.0, x, y, z))
- {
- if(PlayerVehicleInfo[ownerid][d][pvLock] > 0)
- {
- if(PlayerVehicleInfo[ownerid][d][pvLocked] == 0)
- {
- GameTextForPlayer(playerid,"~r~Vehicle Locked!",5000,6);
- PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
- PlayerVehicleInfo[ownerid][d][pvLocked] = 1;
- LockPlayerVehicle(ownerid, PlayerVehicleInfo[ownerid][d][pvId], PlayerVehicleInfo[ownerid][d][pvLock]);
- return 1;
- }
- else
- {
- GameTextForPlayer(playerid,"~g~Vehicle Unlocked!",5000,6);
- PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
- PlayerVehicleInfo[ownerid][d][pvLocked] = 0;
- UnLockPlayerVehicle(ownerid, PlayerVehicleInfo[ownerid][d][pvId], PlayerVehicleInfo[ownerid][d][pvLock]);
- return 1;
- }
- }
- else
- {
- SendClientMessage(playerid, COLOR_GREY, " You don't have a lock system installed on this vehicle.");
- return 1;
- }
- }
- }
- }
- for(new d = 0 ; d < MAX_PLAYERVEHICLES; d++)
- {
- if(PlayerVehicleInfo[playerid][d][pvId] != INVALID_PLAYER_VEHICLE_ID) GetVehiclePos(PlayerVehicleInfo[playerid][d][pvId], x, y, z);
- if(IsPlayerInRangeOfPoint(playerid, 3.0, x, y, z))
- {
- if(PlayerVehicleInfo[playerid][d][pvLock] > 0 && PlayerVehicleInfo[playerid][d][pvLocked] == 0)
- {
- GameTextForPlayer(playerid,"~r~Vehicle Locked!",5000,6);
- PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
- PlayerVehicleInfo[playerid][d][pvLocked] = 1;
- LockPlayerVehicle(playerid, PlayerVehicleInfo[playerid][d][pvId], PlayerVehicleInfo[playerid][d][pvLock]);
- return 1;
- }
- else if(PlayerVehicleInfo[playerid][d][pvLock] > 0 && PlayerVehicleInfo[playerid][d][pvLocked] == 1)
- {
- GameTextForPlayer(playerid,"~g~Vehicle Unlocked!",5000,6);
- PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
- PlayerVehicleInfo[playerid][d][pvLocked] = 0;
- UnLockPlayerVehicle(playerid, PlayerVehicleInfo[playerid][d][pvId], PlayerVehicleInfo[playerid][d][pvLock]);
- return 1;
- }
- SendClientMessage(playerid, COLOR_GREY, " You don't have a lock system installed on this vehicle.");
- return 1;
- }
- }
- SendClientMessage(playerid, COLOR_GREY, "You're not near any vehicle that you own.");
- return 1;
- }
- //-------------------------------------------------------------------------------------------------//
- else if(dialogid == DIALOG_CDLOCKBUY)
- {
- if(response)
- {
- if(listitem == 0)
- {
- if(GetPlayerVehicleCount(playerid) != 0)
- {
- if(PlayerInfo[playerid][pCash] < BizInfo[PlayerInfo[playerid][InBusiness]][bProductsPrice11])
- {
- SendClientMessage(playerid, COLOR_GRAD2, " Not enough money!");
- return 1;
- }
- SetPVarInt(playerid, "lockmenu", 1);
- for(new i=0; i<MAX_PLAYERVEHICLES; i++)
- {
- if(PlayerVehicleInfo[playerid][i][pvId] != INVALID_PLAYER_VEHICLE_ID)
- {
- format(string, sizeof(string), "Vehicle %d| Name: %s.",i+1,GetVehicleName(PlayerVehicleInfo[playerid][i][pvId]));
- SendClientMessage(playerid, COLOR_WHITE, string);
- }
- }
- ShowPlayerDialogEx(playerid, DIALOG_CDLOCKMENU, DIALOG_STYLE_INPUT, "24-7;"," Select a vehicle you wish to install this on:", "Select", "Cancel");
- }
- else
- {
- SendClientMessage(playerid, COLOR_WHITE, "You don't have any cars - where we can install this item?");
- return 1;
- }
- }
- if(listitem == 1)
- {
- if(GetPlayerVehicleCount(playerid) != 0)
- {
- if(PlayerInfo[playerid][pCash] < BizInfo[PlayerInfo[playerid][InBusiness]][bProductsPrice12])
- {
- SendClientMessage(playerid, COLOR_GRAD2, " Not enough money!");
- return 1;
- }
- SetPVarInt(playerid, "lockmenu", 2);
- for(new i=0; i<MAX_PLAYERVEHICLES; i++)
- {
- if(PlayerVehicleInfo[playerid][i][pvId] != INVALID_PLAYER_VEHICLE_ID)
- {
- format(string, sizeof(string), "Vehicle %d | Name: %s.",i+1,GetVehicleName(PlayerVehicleInfo[playerid][i][pvId]));
- SendClientMessage(playerid, COLOR_WHITE, string);
- }
- }
- ShowPlayerDialogEx(playerid, DIALOG_CDLOCKMENU, DIALOG_STYLE_INPUT, "24-7;"," Select a vehicle you wish to install this on:", "Select", "Cancel");
- }
- else
- {
- SendClientMessage(playerid, COLOR_WHITE, "You don't have any cars - where we can install this item?");
- return 1;
- }
- }
- }
- }
- if(dialogid == DIALOG_CDLOCKMENU)
- {
- new idx = PlayerInfo[playerid][InBusiness];
- if(response) {
- if(GetPVarInt(playerid, "lockmenu") == 1) {
- new pvid;
- if(IsNumeric(inputtext)) {
- pvid = strval(inputtext)-1;
- if(PlayerVehicleInfo[playerid][pvid][pvId] == INVALID_PLAYER_VEHICLE_ID)
- {
- SendClientMessage(playerid, COLOR_GRAD4, "ERROR: You don't have a vehicle in this slot.");
- SetPVarInt(playerid, "lockmenu", 0);
- return 1;
- }
- if(PlayerVehicleInfo[playerid][pvid][pvLock] == 1)
- {
- SendClientMessage(playerid, COLOR_GRAD4, "ERROR: You already have this item installed on this vehicle.");
- SetPVarInt(playerid, "lockmenu", 0);
- return 1;
- }
- format(string, sizeof(string), " You have purchased an alarm lock!");
- SendClientMessage(playerid, COLOR_GRAD4, string);
- SendClientMessage(playerid, COLOR_YELLOW, "HINT: You can now use /pvlock to lock your car.");
- PlayerInfo[playerid][pCash] -= BizInfo[PlayerInfo[playerid][InBusiness]][bProductsPrice11];
- BizInfo[idx][bMoney] += BizInfo[PlayerInfo[playerid][InBusiness]][bProductsPrice11];
- BizInfo[idx][bSupplies] --;
- PlayerVehicleInfo[playerid][pvid][pvLock] = 1;
- SetPVarInt(playerid, "lockmenu", 0);
- }
- }
- else if(GetPVarInt(playerid, "lockmenu") == 2)
- {
- new pvid;
- if(IsNumeric(inputtext))
- {
- pvid = strval(inputtext)-1;
- if(PlayerVehicleInfo[playerid][pvid][pvId] == INVALID_PLAYER_VEHICLE_ID)
- {
- SendClientMessage(playerid, COLOR_GRAD4, "ERROR: You don't have a vehicle in this slot.");
- SetPVarInt(playerid, "lockmenu", 0);
- return 1;
- }
- if(PlayerVehicleInfo[playerid][pvid][pvLock] == 2)
- {
- SendClientMessage(playerid, COLOR_GRAD4, "ERROR: You already have this item installed on this vehicle.");
- SetPVarInt(playerid, "lockmenu", 0);
- return 1;
- }
- format(string, sizeof(string), " You have Purchased an industrial lock!");
- SendClientMessage(playerid, COLOR_GRAD4, string);
- SendClientMessage(playerid, COLOR_YELLOW, "HINT: You can now use /pvlock to lock your car.");
- PlayerInfo[playerid][pCash] -= BizInfo[PlayerInfo[playerid][InBusiness]][bProductsPrice12];
- BizInfo[idx][bMoney] += BizInfo[PlayerInfo[playerid][InBusiness]][bProductsPrice12];
- BizInfo[idx][bSupplies] --;
- PlayerVehicleInfo[playerid][pvid][pvLock] = 2;
- SetPVarInt(playerid, "lockmenu", 0);
- }
- }
- }
- }
- //----------------------------------------------------------------------//
- LockPlayerVehicle(ownerid, carid, type)
- {
- new v = GetPlayerVehicle(ownerid, carid);
- if(PlayerVehicleInfo[ownerid][v][pvId] == carid && type == 2)
- {
- LockStatus[carid] = 1;
- vehicle_lock_doors(carid);
- }
- }
- UnLockPlayerVehicle(ownerid, carid, type)
- {
- new v = GetPlayerVehicle(ownerid, carid);
- if(PlayerVehicleInfo[ownerid][v][pvId] == carid && type == 2)
- {
- LockStatus[carid] = 0;
- vehicle_unlock_doors(carid);
- }
- }
- forward DisableVehicleAlarm(vehicleid);
- public DisableVehicleAlarm(vehicleid)
- {
- GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
- SetVehicleParamsEx(vehicleid,engine,lights,VEHICLE_PARAMS_OFF,doors,bonnet,boot,objective);
- return 1;
- }
- forward ReleasePlayer(playerid);
- public ReleasePlayer(playerid)
- {
- SetPVarInt(playerid, "IsFrozen", 0);
- TogglePlayerControllable(playerid,1);
- }
Advertisement
Add Comment
Please, Sign In to add comment