Double command?
#1

Hey! So, I've been looking for this a long time, been searching and all that, then I randomly found it somewhere, but it was used with strcmp..What I want to do is;
When someone type /fix they fix the car (I know how to script the code) but the same thing happen when they type /repair, the way I've seen it is:
pawn Код:
if(strcmp(cmdtext, "/vr", true) == 0 || strcmp(cmdtext, "/repair", true) == 0)
Ofcourse I can make two commands by them self, but I want it to be like this. The problem is, when I tried doing this with ZCMD (and Sscanf) It gave me these errors;
pawn Код:
C:\Users\Ruby\Dropbox\Pawno\gamemodes\Ruby.pwn(685) : error 029: invalid expression, assumed zero
C:\Users\Ruby\Dropbox\Pawno\gamemodes\Ruby.pwn(685) : warning 215: expression has no effect
C:\Users\Ruby\Dropbox\Pawno\gamemodes\Ruby.pwn(685) : error 001: expected token: ";", but found "forward"
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


2 Errors.
And this is the code I created;
pawn Код:
COMMAND:fix(playerid, params[]) || COMMAND:repair(playerid, params[])
{
    if(IsPlayerInAnyVehicle(playerid))
    {
        new veh=GetPlayerVehicleID(playerid);
        RepairVehicle(veh);
        SendClientMessage(playerid,0x33FF33FF, "Your {00FF7F} Vehicle{33FF33} has been fixed!");
    }else{
    SendClientMessage(playerid, GREEN," You're not in a {33FF33}Vehicle{00FF7F}!");
    }
    return 1;
}
Thanks in advance.
Reply
#2

ZCMD:
pawn Код:
COMMAND:vr(playerid, params[])
{
  return cmd_repair(playerid, params);
}
That's one way to do it.
Reply
#3

Thank you
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)