ZCMD double.. - 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: ZCMD double.. (
/showthread.php?tid=387452)
ZCMD double.. -
Larry123 - 24.10.2012
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?
}
}
Re: ZCMD double.. -
ViniBorn - 24.10.2012
CMD:engine(playerid)
and
cmd_engine(playerid);
Re: ZCMD double.. -
RedFusion - 24.10.2012
cmd_engine(playerid, "");
Re: ZCMD double.. -
gtakillerIV - 24.10.2012
Actually it's:
return cmd_engine(playerid,params[]);
Re: ZCMD double.. -
RedFusion - 24.10.2012
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
Re: ZCMD double.. -
vIBIENNYx - 24.10.2012
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.
Re: ZCMD double.. -
Youice - 24.10.2012
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(playerid, params[])
{
#pragram unused params
EngineEx(playerid);
return 1;
}
PHP код:
public OnplayerKeyStateChange(...)
{
if(newkeys == KEY_SUBMISSION)
{
EngineEx(playerid);
}
return 1;
}
Re: ZCMD double.. -
Larry123 - 25.10.2012
Thanks, i made it with thanks to RedFusion