lock car and unlock help -
Kar - 21.06.2010
Код:
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); } }
SendClientMessage(playerid,LIME, ".::[VEHICLE]::. Vehicle is Locked!");
new Float:X, Float:Y, Float:Z; GetPlayerPos(playerid,X,Y,Z);
PlayerPlaySound(playerid,1057,X,Y,Z); Vehicle[GetPlayerVehicleID(playerid)][IsLocked] = 1;
} }
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); }
SendClientMessage(playerid,LIME, ".::[VEHICLE]::. Vehicle is Unlocked!");
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;
}
I don't want you to be in the car to lock the car i need it if like if you are in the car it returns error then if you are out your car is locked then when u reenter vehicle gets unlocked
Re: lock car and unlock help -
Antonio [G-RP] - 21.06.2010
if(GetPlayerState(playerid) == 2) {
?
Re: lock car and unlock help -
Kar - 21.06.2010
if(GetPlayerState(playerid) == ON_FOOT) {
?
Re: lock car and unlock help -
Antonio [G-RP] - 21.06.2010
put in there somewhere
Код:
if(GetPlayerState(playerid) = PLAYER_STATE_ONFOOT) {
Re: lock car and unlock help -
Faith - 21.06.2010
How do you expect the command to work (as it is currently coded) without having to be in the car?
Quote:
if(IsPlayerConnected(playerid) && Vehicle[GetPlayerVehicleID(playerid)][IsLocked] == 0){
|
You get the vehicleid to lock by getting the player's current vehicle ID. If he's not inside, this command won't work as it is currently coded.
Re: lock car and unlock help -
Kar - 21.06.2010
no no no.
if i enter a vehicle then exit then lock it work thats what i mean so like if i enter another vehicle and exit it would lock that one instead
Re: lock car and unlock help -
Kar - 22.06.2010
does anyone understand what im trying to say<.<
Re: lock car and unlock help -
Mike Garber - 22.06.2010
I guess I know, but I wont help you with It, but to explain for others;
1. You enter a vehicle
2. You exit the vehicle, that vehicle will be locked for everybody else but yourself.
3. When you enter another vehicle your previous vehicle will be unlocked and the one you're in will be locked once you exit It.
Re: lock car and unlock help -
Kar - 22.06.2010
yupp
Re: lock car and unlock help -
Faith - 22.06.2010
Under public OnPlayerExitVehicle add the following
pawn Код:
for(new i=0; i<MAX_PLAYERS; i++){
if(IsPlayerConnected(i)) {
if(i != playerid){
SetVehicleParamsForPlayer(vehicleid, i, 0, 1);
}
}
}
Im not sure if it'll work, but I think it will... Sorry for the bad identation, done with space lol.