28.07.2011, 00:24
Quote:
have it loop through all the vehicles and getting their x, y, z. then it checks
pawn Код:
|
Do this:
pawn Код:
new MyV[MAX_PLAYERS];
public OnPlayerConnect(playerid)
{
MyV[playerid] = -1;
return 1;
}
public OnPlayerStateChange(playerid,newstate,oldstate)
{
new vehid = GetPlayerVehicleID(playerid);
if(newstate == PLAYER_STATE_DRIVER && vehid != MyV[playerid]) MyV[playerid] = vehid;
return 1;
}
CMD:vlock(playerid,params[])
{
new vid = GetPlayerVehicleID( playerid ), engine, lights, alarm, doors, bonnet, boot, objective;
GetVehicleParamsEx(vid, engine, lights, alarm, doors, bonnet, boot, objective);
if(!IsPlayerInAnyVehicle(playerid) && MyV[playerid] != -1) vid = MyV[playerid];
switch( vDoor[ vid ] )
{
case 0: vDoor[ vid ] = 1, SetVehicleParamsEx( vid, engine, lights, alarm, 1, bonnet, boot, objective ), SendClientMessage( playerid, -1, "Doors Locked." );
default: vDoor[ vid ] = 0, SetVehicleParamsEx( vid, engine, lights, alarm, 0, bonnet, boot, objective ),
SendClientMessage( playerid, -1, "Doors Unlocked." );
}
return 1;
}