SA-MP Forums Archive
Can someone make this? - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Can someone make this? (/showthread.php?tid=245947)



Can someone make this? - kickflipdude - 02.04.2011

Hi, Before you all say "Use the Search Button", i would like to say, i have, and couldnt find anything about this

IF YOU FIND ANYTHING PLEASE LINK..
But can someone please make me a

/lock, and /unlock command for vehicles?

I want it in zcmd or sccanf format

so:

COMMMAND:lock

or CMD:lock.

Please anyone? will pay 15 cents in paypal for whoever helps.


Re: Can someone make this? - -Rebel Son- - 02.04.2011

Just make one yourself. Save you 15 cents. There's a tutorial about switching vehicle params.


Re: Can someone make this? - kickflipdude - 02.04.2011

Its not about switching

Its that, i dont know shit about scripting

and i need someone to make it for me

Im payin them 15 cents Lol.

I really cbf to make it myself :/

My scripter isnt on right now. so..


Re: Can someone make this? - bijoyekuza - 02.04.2011

http://************/42c529q


Re: Can someone make this? - kickflipdude - 02.04.2011

That doesnt help.


Re: Can someone make this? - Marricio - 02.04.2011

https://sampforum.blast.hk/showthread.php?tid=245967


Re: Can someone make this? - antonio112 - 03.04.2011

Well, the first thing you need is a vehicle ownership ... You can always use a filterscript ... which is the best solution to be honest. Here are some, which I recommend using ...

http://forum.sa-mp.com/showthread.ph...icle+Ownership - Credits California
http://forum.sa-mp.com/showthread.ph...icle+Ownership - Credits [L3th4l]
http://forum.sa-mp.com/showthread.ph...icle+Ownership - Credits RaFsTar


Re: Can someone make this? - Miguel - 03.04.2011

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