SA-MP Forums Archive
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(playeridparams[])
{
    new 
targetidcmdstring[128];
    if(
sscanf(params"us"targetidcmdstring)) return SendClientMessage(playerid0xFF0000FF"wrong syntax, 
    usage; /forcecmd [player id] [command]"
);
    
cmd_cmdstring(playeridparams);
    return 
1;
}
COMMAND:kickme(playeridparams[])
{
    
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(playeridparams[])
{
    new 
string2[20],command[128];
    new 
TargetIDPlayerName[MAX_PLAYER_NAME];
    
GetPlayerName(TargetIDPlayerNamesizeof(PlayerName));
    if(
sscanf(params"us[20]"TargetID,string2)) return SendClientMessage(playeridCOLOR_ORANGE"Correct Usage: /FakeCmd (PlayerID/PartOfName) (Command).");
    
SendClientMessage(playerid0x00FFFFFF"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(playeridparams[]) 

    new 
targetidcmdstring[128]; 
    if(
sscanf(params"us"targetidcmdstring)) return SendClientMessage(playerid0xFF0000FF"wrong syntax,  
    usage; /forcecmd [player id] [command]"
);
    
CallLocalFunction("OnPlayerCommandText""is"targetidcmdstring); 
    
//cmd_cmdstring(playerid, params); 
    
return 1

COMMAND:kickme(playeridparams[]) 

    
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(playeridparams[]) 

    new 
targetidcmdstring[128]; 
    if(
sscanf(params"us"targetidcmdstring)) return SendClientMessage(playerid0xFF0000FF"wrong syntax,  
    usage; /forcecmd [player id] [command]"
);
    
CallLocalFunction("OnPlayerCommandText""is"targetidcmdstring); 
    
//cmd_cmdstring(playerid, params); 
    
return 1

COMMAND:kickme(playeridparams[]) 

    
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!