Command Help
#1

For some reason I can only put one command in my GM without getting errors

I had a /help command which had to errors, I then implemented a PickGun Filterscript into my GM, which obviously had commands with it.
So I put the commands ontop of the /help command, looking like this:

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])


{
    new cmd[256];
    new idx;
    cmd = strtok(cmdtext, idx);
    if(strcmp(cmd, "/dropgun", true) == 0 || strcmp(cmd, "/dgun", true) == 0)
    {
        new gunID = GetPlayerWeapon(playerid);
        new gunAmmo = GetPlayerAmmo(playerid);
        if(gunID != 0 && gunAmmo != 0)
        {
            new f = maxobj+1;
            for(new a = 0; a < sizeof(ObjCoords); a++)
            {
                if(ObjCoords[a][0] == 0.0) f = a;
            }

            if(f == maxobj+1) return SendClientMessage(playerid, 0x33AA3300, "You can not throw weapons at the moment, try back later!!");
            else
            {
              new gunname[100];
              new buffer[512];
                GetWeaponNameEx(gunID, gunname, sizeof(gunname));
                format(buffer, sizeof(buffer), "You threw %s", gunname);
                SendClientMessage(playerid, 0x33AA3300, buffer);
                RemovePlayerWeapon(playerid, gunID);
                ObjectID[f][0] = gunID;
                ObjectID[f][1] = gunAmmo;

            GetPlayerPos(playerid, ObjCoords[f][0], ObjCoords[f][1], ObjCoords[f][2]);
            object[f] = CreateObject(GunObjects[gunID][0],ObjCoords[f][0],ObjCoords[f][1],ObjCoords[f][2]-1,93.7,120.0,120.0);
            }
            return 1;
        }
    }
    if(strcmp(cmd, "/pickupgun", true) == 0 || strcmp(cmd, "/pgun", true) == 0)
    {
        new f = maxobj+1;
        for(new a=0;a<sizeof(ObjCoords);a++)
        {
            if(IsPlayerInRangeOfPoint(playerid, 5.0, ObjCoords[a][0], ObjCoords[a][1], ObjCoords[a][2]))
                f = a;
        }
        if(f == maxobj+1 || Dropped[f] == 1) return SendClientMessage(playerid, 0x33AA3300, "You are not near the weapon which you can pick up!");
        else
        {
          new gunname[100];
          new buffer[512];

          ObjCoords[f][0] = 0.0;
            ObjCoords[f][1] = 0.0;
            ObjCoords[f][2] = 0.0;

            DestroyObject(object[f]);
            GivePlayerWeapon(playerid, ObjectID[f][0], ObjectID[f][1]);
            GetWeaponNameEx(ObjectID[f][0], gunname, sizeof(gunname));
            format(buffer, sizeof(buffer), "You picked up %s", gunname);
            SendClientMessage(playerid, 0x33AA3300, buffer);
        }
        return 1;
    }
    return 0;
}



    if (strcmp("/help", cmdtext, true, 10) == 0)
    {
      if(IsPlayerConnected(playerid))
      {
            SendClientMessage(playerid,COLOR_GREY,"[GENERAL]: /register, /login, /admins, /stats, /shop");
            SendClientMessage(playerid,COLOR_GREY,"[C4]: /c4 buy, /c4 plant, /c4 detonate, /c4 quantity");
            SendClientMessage(playerid,COLOR_GREY,"[GUN]: /dropgun, /pickupgun");
            SendClientMessage(playerid,COLOR_GREY,"[TELE]: /cc (Caddy Carnage)");
            }
        }
    return 1;
    }
But I get these errors:

Quote:

(332) : error 010: invalid function or declaration
(334) : error 010: invalid function or declaration
(342) : error 010: invalid function or declaration

Line 332 =
pawn Код:
if (strcmp("/help", cmdtext, true, 10) == 0)
Line 334 =
pawn Код:
if(IsPlayerConnected(playerid))
Line 342 =
pawn Код:
return 1;
Can anyone help?
Reply
#2

Replace that in line 332:

pawn Код:
if (strcmp(cmd, "/help", cmdtext, true, 10) == 0)
Reply
#3

Quote:
Originally Posted by Flashy
Replace that in line 332:

pawn Код:
if (strcmp(cmd, "/help", cmdtext, true, 10) == 0)
Still getting the same result.
Reply
#4

Quote:
Originally Posted by Flashy
Replace that in line 332:

pawn Код:
if (strcmp(cmd, "/help", cmdtext, true, 10) == 0)
That will fix you one error, about that both do this

return 0;
}



if (strcmp("/help", cmdtext, true, 10) == 0)

Above if (strcmp("/help", cmdtext, true, 10) == 0) you used } .. and returned 0;
Delete it;
So


if (strcmp("/help", cmdtext, true, 10) == 0)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)