SA-MP Forums Archive
How to call? - 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: How to call? (/showthread.php?tid=652202)



How to call? - Osamakurdi - 05.04.2018

How to call a command using pawncmd?


Re: How to call ? - ForCop - 05.04.2018

Quote:
Originally Posted by Osamakurdi
Посмотреть сообщение
How to call a command using pawncmd?
https://sampforum.blast.hk/showthread.php?tid=608474


Re: How to call ? - Osamakurdi - 05.04.2018

Quote:
Originally Posted by ForCop
Посмотреть сообщение
I didn't understand .
CODE:
Код:
CMD:engine(playerid, params[])
{
    if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_RED, "ERROR:You must be in a car.");
    new vehicleid, engine, lights, alarm, doors, bonnet, boot, objective;
    vehicleid = GetPlayerVehicleID(playerid);
    GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
    if(engineo[vehicleid] == true)
    {
        return SetVehicleParamsEx(vehicleid, VEHICLE_PARAMS_OFF, lights, alarm, doors, bonnet, boot, objective),
        engineo[vehicleid] = false,
		GameTextForPlayer(playerid, "~n~~n~Engine~r~~h~Off", 2000, 4);
        //SendClientMessage(playerid, COLOR_RED, "Engine succesfully stoped.");
    }
    if(engineo[vehicleid] == false)
    {
        return SetVehicleParamsEx(vehicleid, VEHICLE_PARAMS_ON, lights, alarm, doors, bonnet, boot, objective),
        engineo[vehicleid] = true,
		GameTextForPlayer(playerid, "~n~~n~Engine~g~~h~On", 2000, 4);
        //SendClientMessage(playerid, COLOR_YELLOW, "Engine succesfully starts.");
    }
    return 1;
}
something like this ?
Код:
if (GetPlayerVehicleSeat(playerid) == 0)
    {
        if (newkeys & KEY_SUBMISSION) 
        {
               return CallLocalFunction( "cmd_engine", "i", playerid);
       	}

    }



Re: How to call ? - Osamakurdi - 05.04.2018

Fixed with these changings:
Код:
    if (GetPlayerVehicleSeat(playerid) == 0)
    {
        if (newkeys & KEY_SUBMISSION) 
        {
               return  PC_EmulateCommand(playerid, "/engine");
       	}

    }



Re: How to call? - rfr - 05.04.2018

call the command
PHP код:
callcmd::engine(playeridparams[]); 
or you can emulate the command
PHP код:
PC_EmulateCommand(playerid"/engine"); 



Re: How to call? - Osamakurdi - 05.04.2018

Quote:
Originally Posted by rfr
Посмотреть сообщение
call the command
PHP код:
callcmd::engine(playeridparams[]); 
or you can emulate the command
PHP код:
PC_EmulateCommand(playerid"/engine"); 
Thanks