send a zcmd command that equal to a string text? (+REP)
#1

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.
Reply
#2

I don't think that is possible, or maybe it is.. idk
Reply
#3

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;

Reply
#4

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.
Reply
#5

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!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)