Help with /fakecmd command +Rep
#1

<remove>
Reply
#2

Try this:
Quote:

CMD:fakecmd(playerid,params[]) {
if(PlayerInfo[playerid][Level] >= 5) {
new tmp[128], tmp2[128], Index; tmp = strtok(params,Index), tmp2 = strtok(params,Index);
if(isnull(tmp) || isnull(tmp2)) return SendClientMessage(playerid, red, "USAGE: /fakecmd [playerid] [command]");
new player1 = strval(tmp);
if(PlayerInfo[player1][Level] == ServerInfo[MaxAdminLevel] && PlayerInfo[playerid][Level] != ServerInfo[MaxAdminLevel]) return SendClientMessage(playerid,red,"ERROR: You cannot use this command on this admin");
if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID) {
CallRemoteFunction("OnPlayerCommandPerformed", "is", player1, tmp2);
return SendClientMessage(playerid,blue,"Fake command sent");
} else return SendClientMessage(playerid,red,"ERROR: Player is not connected");
} else return SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command");
}
#endif

It is from my script but.. Maybe it work!
Reply
#3

pawn Код:
CMD:forcecmd(playerid, params[])
{
    if(PInfo[playerid][Admin] < 1336) return SCM(playerid, grey,AdmError);
    else
    {
        #if !defined isnull
            #define isnull(%1) \
                    ((!(%1[0])) || (((%1[0]) == '\1') && (!(%1[1]))))
        #endif
        new Target;
        new cmdParams[50];
        new cmdToForce[50];
        sscanf(params, "us[50]s[50]", Target, cmdToForce, cmdParams);
        if(isnull(cmdToForce)) SCM(playerid,comandos,"Use < /forcecmd [id/name] [command] [parameters] >");
        else
        {
            if(!IsPlayerConnected(Target)) SCM(playerid,grey,"  Invalid ID/Name!");
            else
            {
                format(cmdToForce, sizeof(cmdToForce), "cmd_%s", cmdToForce);
                if(funcidx(cmdToForce) != -1)
                {
                    if(isnull(cmdParams)) CallLocalFunction(cmdToForce, "i", Target);
                    else CallLocalFunction(cmdToForce, "is", Target, cmdParams);
                    SCM(playerid,greenseco,"# Command forced");
                }
                else SCM(playerid,grey,"  Invalid Command/Parameter!");
            }
        }
    }
    return 1;
}
Just edit...
Reply
#4

You need to explain everything, not just paste a command. Basically, you need to some-how call the command. You can either call OnPlayerCommandText or use the method SuperGT posted. You're basically calling the function, - hence giving the feel the targeted player executed the command.
Reply
#5

<remove>
Reply
#6

By fake command,do you mean, for example a player uses arrest, the target doesn't arrested but it just sends a message saying that the player got arrested?
Reply
#7

<remove>
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)