if (strcmp("/lock", cmdtext, true, 5) == 0) { GetPlayerName(playerid, sendername, sizeof(sendername)); new carid=GetPlayerVehicleID(playerid); new carid1=GetClosestCar(playerid); if(IsPlayerInAnyVehicle(playerid)) { if(VehicleLocked[carid] == 0) { format(string, sizeof(string), "* %s presses a button inside his/her vehicle and locks their vehicle.", sendername); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); VehicleLocked[carid] = 1; VehicleLockedPlayer[playerid] = carid; new i; for (i=0;i<MAX_PLAYERS;i++) { SetVehicleParamsForPlayer(carid,i,0,1); } } else { format(string, sizeof(string), "* %s presses a button inside his/her vehicle and unlocks their vehicle.", sendername); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); VehicleLocked[VehicleLockedPlayer[playerid]] = 0; VehicleLockedPlayer[playerid] = 999; new i; for (i=0;i<MAX_PLAYERS;i++) { SetVehicleParamsForPlayer(carid,i,0,0); } } } else if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT) { new Float:x2,Float:y2,Float:z2; GetVehiclePos(VehicleLockedPlayer[playerid], x2, y2, z2); if(VehicleLocked[carid] == 0) { if(PlayerToPoint(5.0,playerid,x2,y2,z2)) { format(string, sizeof(string), "* %s uses his/her key to lock their vehicle.", sendername); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); VehicleLocked[carid] = 1; VehicleLockedPlayer[playerid] = carid; new i; for (i=0;i<MAX_PLAYERS;i++) { SetVehicleParamsForPlayer(carid,i,0,1); } } } else if(VehicleLocked[carid1] == 0) { if(PlayerToPoint(5.0,playerid,x2,y2,z2)) { format(string, sizeof(string), "* %s uses his/her key to unlock their vehicle.", sendername); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); VehicleLocked[VehicleLockedPlayer[playerid]] = 0; VehicleLockedPlayer[playerid] = 999; new i; for (i=0;i<MAX_PLAYERS;i++) { SetVehicleParamsForPlayer(carid,i,0,0); } } } } return 1; }
if (strcmp(cmdtext, "/lock", true)==0) { new State; new Float:X; new Float:Y; new Float:Z; if(IsPlayerInAnyVehicle(playerid)) { State=GetPlayerState(playerid); if(State!=PLAYER_STATE_DRIVER) { SendClientMessage(playerid,COLOR_RED,"You can only lock when driving!"); return 1; } new i; for(i=0;i<MAX_PLAYERS;i++) { if(i != playerid) { SetVehicleParamsForPlayer(GetPlayerVehicleID(playe rid),i, 0, 1); } } SendClientMessage(playerid, COLOR_COP_ELITE, "Vehicle Locked!"); GetPlayerPos(playerid,X,Y,Z); PlayerPlaySound(playerid,1056,X,Y,Z); return 1; } else { SendClientMessage(playerid, COLOR_RED, "You are not in a vehicle."); return 1; } } if (strcmp(cmdtext, "/destrancar", true)==0) { new State; new Float:X; new Float:Y; new Float:Z; if(IsPlayerInAnyVehicle(playerid)) { State=GetPlayerState(playerid); if(State!=PLAYER_STATE_DRIVER) { SendClientMessage(playerid,COLOR_RED,"You are not driving."); return 1; } new i; for(i=0;i<MAX_PLAYERS;i++) { SetVehicleParamsForPlayer(GetPlayerVehicleID(playe rid),i, 0, 0); } SendClientMessage(playerid, COLOR_COP_ELITE, "Vehicle Unlocked"); GetPlayerPos(playerid,X,Y,Z); PlayerPlaySound(playerid,1057,X,Y,Z); return 1; } else { SendClientMessage(playerid, COLOR_RED, "You are not in any vehicle"); return 1; } } |