13.08.2016, 12:29
Bug with command /(un)lock.
Bug: when I lock vehicle and re-connect to server it's still locked and neither I or other players can jump in the car.
What I need is that when player disconnects from the server his locked car becomes unlock.
I read that function needs to be re-apply under "OnVehicleStreamIn", but I don't understand what exactly.
Under "#include <a_samp>"
Under OnPlayerDisconnect:
Command /lock:
Command: /unlock:
Good day.
Bug: when I lock vehicle and re-connect to server it's still locked and neither I or other players can jump in the car.
What I need is that when player disconnects from the server his locked car becomes unlock.
I read that function needs to be re-apply under "OnVehicleStreamIn", but I don't understand what exactly.
Under "#include <a_samp>"
Код:
new playersvehicle[MAX_PLAYERS], locked[MAX_VEHICLES char], one[MAX_PLAYERS];
Код:
one[playerid] = 0; playersvehicle[playerid] = -1; locked[playersvehicle[playerid]] = 0;
Код:
CMD:lock(playerid,params[]) { if(UserStats[playerid][Logged] == false) return SendClientMessage(playerid, COLOR_RED, "Must be logged in!"); if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_RED, "You must be in vehicle!"); if(locked[GetPlayerVehicleID(playerid)] == 1) return SendClientMessage(playerid, COLOR_RED, "This vehicle is already locked!"); if(one[playerid] == 1) return SendClientMessage(playerid, COLOR_RED, "You already have one locked vehicle, use /getcar and /unlock!"); if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, COLOR_RED, "You must be driver to use this command!"); locked[GetPlayerVehicleID(playerid)] = 1; one[playerid] = 1; playersvehicle[playerid] = GetPlayerVehicleID(playerid); SendClientMessage(playerid, COLOR_GREEN, "^ Locked!"); return 1; }
Код:
CMD:unlock(playerid,params[]) { if(UserStats[playerid][Logged] == false) return SendClientMessage(playerid, COLOR_RED, "You must be logged in!"); if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_RED, "You must be in vehicle"); if(aizslegts[GetPlayerVehicleID(playerid)] == 0) return SendClientMessage(playerid, COLOR_RED, "This vehicle is already unlocked!"); if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, COLOR_RED, "You must be driver to use this command!"); locked[GetPlayerVehicleID(playerid)] = 0; one[playerid] = 0; playersvehicle[playerid] = -1; SendClientMessage(playerid, COLOR_GREEN, "^ Unlocked!"); return 1; }