SA-MP Forums Archive
Is it possible? - 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: Is it possible? (/showthread.php?tid=251855)



Is it possible? - The_J0ker - 28.04.2011

Ok so i was watching a tv series where they had a bait car where they can kill the engine and lock the doors with a press of a botton so i remembered that the server controls those features now so is it possible to have a command for police such as /killengine VIN or something along those lines where the police officer is able to turn the engine off and trap the suspect in the car.


Re: Is it possible? - Tommy_Mandaz - 29.04.2011

Yeah it probably is.


Re: Is it possible? - The_J0ker - 29.04.2011

how would i start it off could you show a bit of code so i can start on it


Re: Is it possible? - Tommy_Mandaz - 29.04.2011

Sure something like:

pawn Код:
CMD:killengine(playerid, params[])
{
    new Player;
    if (sscanf(params, "u", Player))
    {
        SendClientMessage(playerid, 0xFF0000AA, "[USAGE]/killengine [PlayerName/PlayerID]");
    }
    else if(Player == INVALID_PLAYER_ID)
    {
        SendClientMessage(playerid, 0xFF0000AA, "Invalid PlayerName/PlayerID");
    }
    else if(Player == playerid)
    {
        SendClientMessage(playerid, 0xFF0000AA, "Invalid PlayerName/PlayerID");
    }
    else if(!IsPlayerInAnyVehicle(Player))
    {
        SendClientMessage(playerid, 0xFF0000AA, "Player Must Be In A Car");
    }
    else
    {
        new enginekill = GetPlayerVehicleID(Player);
        GetVehicleParamsEx(enginekill, engine, lights, alarm, doors, bonnet, boot, objective);
        if(engine == 1)
        {
            SetVehicleParamsEx(enginekill, 0, lights, alarm, doors, bonnet, boot, objective);
        }
        else
        {
            SendClientMessage(playerid, YOURCOLOR, "Error: Engine already turned off");
        }
    }
    return 1;
}
But I use zcmd and sscanf, which I recommand so try it

If you wanna start using zcmd and sscanf heres a tutorial:
http://forum.sa-mp.com/showthread.ph...76#post1142276