locking system
#4

Quote:
Originally Posted by dowster
Посмотреть сообщение
have it loop through all the vehicles and getting their x, y, z. then it checks
pawn Код:
IsPlayerInRangeOfPoint( playerid, 2, x, y, z);
That locks the closest vehicle, regardless if it is yours.

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;
}
Reply


Messages In This Thread
locking system - by slymatt - 28.07.2011, 00:11
Re: locking system - by dowster - 28.07.2011, 00:16
Re: locking system - by TheArcher - 28.07.2011, 00:24
Re: locking system - by [HiC]TheKiller - 28.07.2011, 00:24
Re: locking system - by dowster - 28.07.2011, 00:42

Forum Jump:


Users browsing this thread: 1 Guest(s)