SA-MP Forums Archive
Grab / Kidnap - 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)
+--- Thread: Grab / Kidnap (/showthread.php?tid=423696)



Grab / Kidnap - NuggaN - 18.03.2013

How can I do a grab command? I tried it but not working ..

I want as a cop set a player in a copcar (ofc if he is only in my range of point) in the back seat and he cant move out.
How can I do this?

And Later when I arrived to the PD, I want to get him out of the car


Re: Grab / Kidnap - Scenario - 19.03.2013

Try this:

pawn Код:
new
    lastVehicle[MAX_PLAYERS]
;

hook OnPlayerExitVehicle(playerid, vehicleid)
{
    lastVehicle[playerid] = vehicleid;
    return 1;
}

CMD:detain(playerid, params[])
{
    if(IsACop(playerid))
        return 1;
    if(sscanf(params, "ud", iID, iSeat))
        return SendClientMessage(playerid, COLOR_WHITE, "SYNTAX: /detain [nick/id] [seat 1-3]");
    if(iID == INVALID_PLAYER_ID)
        return 1;
    if(iSeat < 1 || iSeat > 3) 
        return 1;
   
        TogglePlayerControllable(iID, false);
    PutPlayerInVehicle(iID, lastVehicle[playerid], iSeat);
    return 1;
}

CMD:eject(playerid, params[])
{
    if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER)
        return 1;
    if(sscanf(params, "u", iID))
        return SendClientMessage(playerid, COLOR_WHITE, "SYNTAX: /eject [nick/id]");
    if(iID == INVALID_PLAYER_ID)
        return 1;  
    if(GetPlayerVehicleID(playerid) != GetPlayerVehicleID(iID))
        return 1;
       
        TogglePlayerControllable(iID, true);
    RemovePlayerFromVehicle(iID);
    return 1;
}
You'll need to change the "hook" line and just take the code from inside and put it into OnPlayerExitVehicle().

EDIT: I forgot one thing and changed the two commands, sorry.