send a zcmd command that equal to a string text? (+REP) - 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: send a zcmd command that equal to a string text? (+REP) (
/showthread.php?tid=647653)
send a zcmd command that equal to a string text? (+REP) -
Lirbo - 08.01.2018
there is any way to do the next thing or something like that?
PHP код:
COMMAND:forcecmd(playerid, params[])
{
new targetid, cmdstring[128];
if(sscanf(params, "us", targetid, cmdstring)) return SendClientMessage(playerid, 0xFF0000FF, "wrong syntax,
usage; /forcecmd [player id] [command]");
cmd_cmdstring(playerid, params);
return 1;
}
COMMAND:kickme(playerid, params[])
{
Kick(playerid);
return 1;
}
so if I'll do "/forcecmd 1 kickme" it would make them send the command to kick themselves.
Re: send a zcmd command that equal to a string text? (+REP) -
solstice_ - 08.01.2018
I don't think that is possible, or maybe it is.. idk
Re: send a zcmd command that equal to a string text? (+REP) -
Ebisu - 08.01.2018
PHP код:
CMD:forcecmd(playerid, params[])
{
new string2[20],command[128];
new TargetID, PlayerName[MAX_PLAYER_NAME];
GetPlayerName(TargetID, PlayerName, sizeof(PlayerName));
if(sscanf(params, "us[20]", TargetID,string2)) return SendClientMessage(playerid, COLOR_ORANGE, "Correct Usage: /FakeCmd (PlayerID/PartOfName) (Command).");
SendClientMessage(playerid, 0x00FFFFFF, "Fake CMD Sent.");
format(command,128,"%s",string2);
OnPlayerCommandText(TargetID,command);
return 1;
}
Re: send a zcmd command that equal to a string text? (+REP) -
jlalt - 08.01.2018
if I am not wrong you gotta use
CallLocalFunction
PHP код:
COMMAND:forcecmd(playerid, params[])
{
new targetid, cmdstring[128];
if(sscanf(params, "us", targetid, cmdstring)) return SendClientMessage(playerid, 0xFF0000FF, "wrong syntax,
usage; /forcecmd [player id] [command]");
CallLocalFunction("OnPlayerCommandText", "is", targetid, cmdstring);
//cmd_cmdstring(playerid, params);
return 1;
}
COMMAND:kickme(playerid, params[])
{
Kick(playerid);
return 1;
}
as if you use OnPlayerCommandText directly it will just call the hooked one which not supposed to do any special thing to the commands.
Re: send a zcmd command that equal to a string text? (+REP) -
Lirbo - 08.01.2018
Quote:
Originally Posted by jlalt
if I am not wrong you gotta use CallLocalFunction
PHP код:
COMMAND:forcecmd(playerid, params[])
{
new targetid, cmdstring[128];
if(sscanf(params, "us", targetid, cmdstring)) return SendClientMessage(playerid, 0xFF0000FF, "wrong syntax,
usage; /forcecmd [player id] [command]");
CallLocalFunction("OnPlayerCommandText", "is", targetid, cmdstring);
//cmd_cmdstring(playerid, params);
return 1;
}
COMMAND:kickme(playerid, params[])
{
Kick(playerid);
return 1;
}
as if you use OnPlayerCommandText directly it will just call the hooked one which not supposed to do any special thing to the commands.
|
Thank you sir!