SA-MP Forums Archive
ZCMD [do command to player] - 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 [do command to player] (/showthread.php?tid=458361)



ZCMD [do command to player] - benel1 - 16.08.2013

Hello
I want to make a command seems not possible ZCMD ..
Look I want to do something like this only ZCMD:
pawn Код:
if(!strcmp(cmd, "/PlayerCommand", true))
    {
        new command[128];
        cmd = strtok(cmdtext, idx);
        if(!strlen(cmd)) return ...
        command = strtok(cmdtext, idx);
        if(!strlen(command)) return ...
        OnPlayerCommandText(strval(cmd), command);
        return true;
    }
I tried to do this and does not work:
pawn Код:
CMD:playercommand(playerid, params[])
{
    if(sscanf(params, "rs[128]", params[0], params[1])) return ...
    cmd_params[1](params[0], params);
    return true;
}
This brings me to the following errors:
pawn Код:
C:\Users\*\Desktop\* 0.3x\gamemodes\*.pwn(1062) : error 029: invalid expression, assumed zero
C:\Users\*\Desktop\* 0.3x\gamemodes\*.pwn(1063) : error 017: undefined symbol "cmd_params"
C:\Users\*\Desktop\* 0.3x\gamemodes\*.pwn(1063) : warning 215: expression has no effect
C:\Users\*\Desktop\* 0.3x\gamemodes\*.pwn(1063) : error 001: expected token: ";", but found "]"
C:\Users\*\Desktop\* 0.3x\gamemodes\*.pwn(1063) : error 029: invalid expression, assumed zero
C:\Users\*\Desktop\* 0.3x\gamemodes\*.pwn(1063) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


5 Errors.



AW: ZCMD [do command to player] - Nero_3D - 16.08.2013

pawn Код:
CMD:playercommand(playerid, params[]) {
    if(sscanf(params, "us[128]", params[0], params[1])) return ...
    CallLocalFunction("OnPlayerCommandText", "is", params[0], params[1]);
    return true;
}



Re: AW: ZCMD [do command to player] - benel1 - 16.08.2013

Quote:
Originally Posted by Nero_3D
Посмотреть сообщение
pawn Код:
CMD:playercommand(playerid, params[]) {
    if(sscanf(params, "us[128]", params[0], params[1])) return ...
    OnPlayerCommandText(params[0], params[1]);
    return true;
}
But it ZCMD this work?


AW: ZCMD [do command to player] - Nero_3D - 16.08.2013

Changed it to CallLocalFunction because their is an als hook in zcmd without any reason...


Re: AW: ZCMD [do command to player] - benel1 - 16.08.2013

Quote:
Originally Posted by Nero_3D
Посмотреть сообщение
Changed it to CallLocalFunction because their is an als hook in zcmd without any reason...
Thanks !