Lock&Unlock bug [+REP] - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Lock&Unlock bug [+REP] (
/showthread.php?tid=325822)
Lock&Unlock bug [+REP] -
Jaber_Brown - 14.03.2012
Vehicle doesn't lock, it says "Vehicle Locked" but when i get out, i enter it (Unlocked)
pawn Код:
dcmd_lock(playerid,params[]){
#pragma unused params
if(IsPlayerConnected(playerid) && Vehicle[GetPlayerVehicleID(playerid)][IsLocked] == 0){
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER){
for(new i = 0; i <MAX_PLAYERS; i++) { if (i != playerid) { SetVehicleParamsForPlayer(GetPlayerVehicleID(playerid),i, 0, 1); } }
GameTextForPlayer(playerid,"~G~Vehicle locked",4000,3);
new Float:X, Float:Y, Float:Z; GetPlayerPos(playerid,X,Y,Z);
PlayerPlaySound(playerid,1057,X,Y,Z); Vehicle[GetPlayerVehicleID(playerid)][IsLocked] = 1;
SetTimerEx("UnlockVehicle",600000,false,"i",GetPlayerVehicleID(playerid)); } }
return true;
}
dcmd_unlock(playerid,params[]){
#pragma unused params
if(IsPlayerConnected(playerid) && Vehicle[GetPlayerVehicleID(playerid)][IsLocked] == 1){
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER) {
for(new i = 0; i <MAX_PLAYERS; i++) { SetVehicleParamsForPlayer(GetPlayerVehicleID(playerid),i, 0, 0); }
GameTextForPlayer(playerid,"~G~Vehicle unlocked",4000,3);
new Float:X, Float:Y, Float:Z; GetPlayerPos(playerid,X,Y,Z);
PlayerPlaySound(playerid,1057,X,Y,Z); Vehicle[GetPlayerVehicleID(playerid)][IsLocked] = 0; } }
return true;
}
Re: Lock&Unlock bug [+REP] -
StreetGT - 14.03.2012
Use this for check if car is locked/unlocked.
https://sampwiki.blast.hk/wiki/OnVehicleStreamIn
Re : Lock&Unlock bug [+REP] -
Jaber_Brown - 14.03.2012
Can you give me the Code ready, im new in scripting
Re: Lock&Unlock bug [+REP] -
StreetGT - 14.03.2012
Have fun
pawn Код:
public OnVehicleStreamIn(vehicleid, forplayerid)
{
if (Vehicle[vehicleid][IsLocked] == 1) { SetVehicleParamsForPlayer(vehicleid,forplayerid,0,1); }
else { SetVehicleParamsForPlayer(vehicleid,forplayerid,0,0); }
return 1;
}
Re : Lock&Unlock bug [+REP] -
Jaber_Brown - 15.03.2012
It didn't work, i get out , and i can get in it again without unlocking it
Re : Lock&Unlock bug [+REP] -
Jaber_Brown - 15.03.2012
anyone ?