ZCMD double..
#1

Hello

I have a command:

Код:
CMD:engine(playerid, params[])
{
     if(Engine[vehid] == 1)
     {
          SendClientMessage(playerid, -1, "Engine off");
          Engine[vehid] = 0;
      }
     else
     {
          SendClientMessage(playerid, -1, "Engine on");
          Engine[vehid] = 1;
     }
     return 1;
}
And now i want to activate "engine" command while i press SUBMISSION button. So...
Код:
public OnplayerKeyStateChange(...)
{
     if(newkeys == KEY_SUBMISSION)
     {
           Question here!
           How can i make things shorter, i don`t want to write engine code again, what was the function for zcmd?
          it was like..
           cmd_engine(playerid); or something? What was the right code?
     }
}
Reply
#2

CMD:engine(playerid)

and

cmd_engine(playerid);
Reply
#3

cmd_engine(playerid, "");
Reply
#4

Actually it's:

return cmd_engine(playerid,params[]);
Reply
#5

Quote:
Originally Posted by gtakillerIV
Посмотреть сообщение
Actually it's:

return cmd_engine(playerid,params[]);
pawn Код:
OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
There is no "params" parameter in this callback
Reply
#6

Quote:
Originally Posted by RedFusion
Посмотреть сообщение
cmd_engine(playerid, "");
As there is no params in the function, nor is it declared in OnKeyStateChange, this is the correct answer.
Reply
#7

What about that? : D
PHP код:
forward public EngineEx(playerid);
public 
EngineEx(playerid)
{
     if(
Engine[vehid] == 1)
     {
          
SendClientMessage(playerid, -1"Engine off");
          
Engine[vehid] = 0;
      }
     else
     {
          
SendClientMessage(playerid, -1"Engine on");
          
Engine[vehid] = 1;
     }
     return 
1;

PHP код:
CMD:engine(playeridparams[])
{
    
#pragram unused params
    
EngineEx(playerid);
    return 
1;

PHP код:
public OnplayerKeyStateChange(...)
{
    if(
newkeys == KEY_SUBMISSION)
    {
        
EngineEx(playerid);
    }
    return 
1;

Reply
#8

Thanks, i made it with thanks to RedFusion
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)