Questions about DCMD
#5

Quote:
Originally Posted by RedJohn
Посмотреть сообщение
Put it like this:

Код:
dcmd_car(playerid, params[])
{
    if(strcmp(params, "engine",true) == 0)
    {
        // Turn on engine       
    }
    return 1;
}
params is an "optional" text that player types with command.

At your case params is engine.

So when he types /car engine we use strcmp to check did he typed engine, if yes then start the engine. You got it?
Alright, thanks.
Is this correct?
Quote:
Код:
dcmd_car(playerid, params[])
{
    #pragma unused params
    if(strcmp(params, "engine",true) == 0)
    {
        new vehicleid, engine,lights,alarm,doors,bonnet,boot,objective;
    vehicleid = GetPlayerVehicleID(playerid);
    GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
    if(!IsPlayerInAnyVehicle(playerid))
        return SendClientMessage(playerid, COLOR_RED, "[ERROR] You must be in a vehicle in order to use this command.");
    if(GetPlayerVehicleSeat(playerid) != 0)
        return SendClientMessage(playerid, COLOR_RED, "[ERROR] You must be in the driver seat in order to use this command.");
      if(engine == 1)
      {
        SetVehicleParamsEx(vehicleid,0,lights,alarm,doors,bonnet,boot,objective);
        SendClientMessage(playerid, COLOR_YELLOW, "[VEHICLE] Engine shut off.");
      }
      else
      {
        SetVehicleParamsEx(vehicleid,1,lights,alarm,doors,bonnet,boot,objective);
        SendClientMessage(playerid, COLOR_YELLOW, "[VEHICLE] Engine started.");
        }
      }
    return 1;
}
Oh and how do I make like '' ** Uberanwar has turned on the vehicle's ignition ** '' (Only the nearest players can see the text)
Reply


Messages In This Thread
Questions about DCMD - by Uberanwar - 14.08.2013, 14:38
Re: Questions about DCMD - by RedJohn - 14.08.2013, 14:53
Re: Questions about DCMD - by Uberanwar - 14.08.2013, 15:01
Re: Questions about DCMD - by RedJohn - 14.08.2013, 15:07
Re: Questions about DCMD - by Uberanwar - 14.08.2013, 15:16
Re: Questions about DCMD - by RedJohn - 14.08.2013, 15:27
Re: Questions about DCMD - by Uberanwar - 14.08.2013, 15:43
Re: Questions about DCMD - by RedJohn - 14.08.2013, 15:46
Re: Questions about DCMD - by Uberanwar - 14.08.2013, 15:48
Re: Questions about DCMD - by RedJohn - 14.08.2013, 15:51

Forum Jump:


Users browsing this thread: 1 Guest(s)