Can someone make this?
#8

Array at the top of your gamemode:
pawn Код:
new
    PlayerWhoLocked[MAX_VEHICLES] = {INVALID_PLAYER_ID, ...};
Command to lock the vehicle:
pawn Код:
CMD:lock(playerid, params[])
{
    new
        vehicleid = GetPlayerVehicleID(playerid);
       
    if(!vehicleid) return SendClientMessage(playerid, 0xFFFFFFFF, "* You are not in a vehicle!");
    else
    {
        PlayerWhoLocked[vehicleid] = playerid;
        for(new i = 0; i < MAX_PLAYERS; ++ i)
        {
            if(i == playerid) continue;
            else SetVehicleParamsForPlayer(vehicleid, i, 0, 1);
        }
        SendClientMessage(playerid, 0xFFFFFFFF, "* You have locked this car!");
    }
    return 1;
}
Command to unlock the vehicle:
pawn Код:
CMD:unlock(playerid, params[])
{
    new
        vehicleid = GetPlayerVehicleID(playerid);
       
    if(!vehicleid) return SendClientMessage(playerid, RED, "* You are not in a vehicle!");
    else
    {
        PlayerWhoLocked[vehicleid] = INVALID_PLAYER_ID;
        for(new i = 0; i < MAX_PLAYERS; ++ i)
            SetVehicleParamsForPlayer(vehicleid, i, 0, 0);
        SendClientMessage(playerid, 0xFFFFFFFF, "* You have unlocked this car!");
    }
    return 1;
}
Callback needed to re-lock the vehicle when it is streamed:
pawn Код:
public OnVehicleStreamIn(vehicleid, forplayerid)
{
    if((PlayerWhoLocked[vehicleid] != INVALID_PLAYER_ID) &&
    (PlayerWhoLocked[vehicleid] == forplayerid))
        SetVehicleParamsForPlayer(vehicleid, forplayerid, 0, 1);
    return 1;
}
Reply


Messages In This Thread
Can someone make this? - by kickflipdude - 02.04.2011, 15:19
Re: Can someone make this? - by -Rebel Son- - 02.04.2011, 15:29
Re: Can someone make this? - by kickflipdude - 02.04.2011, 15:30
Re: Can someone make this? - by bijoyekuza - 02.04.2011, 15:46
Re: Can someone make this? - by kickflipdude - 02.04.2011, 20:41
Re: Can someone make this? - by Marricio - 02.04.2011, 20:49
Re: Can someone make this? - by antonio112 - 03.04.2011, 00:48
Re: Can someone make this? - by Miguel - 03.04.2011, 02:47

Forum Jump:


Users browsing this thread: 6 Guest(s)