Why isn't this working ?
#1

hi , so i made a dm.
pawn Код:
if(strcmp(cmdtext, "/war", true) == 0)
    {   InWar[playerid] = 1;
        SetPlayerWorldBounds(playerid, 443.7593, -93.423, 2160.407, 1599.869);
        GetPlayerName(playerid, pName, sizeof(pName));
        format(string, sizeof(string), "DM: %s has joined The WAR! (/war) to join aswell!", pName);
        SendClientMessageToAll(COLOR_GREEN, string);
        SetPlayerPos(playerid,239.5148, 1813.7039, 500.6836);
        GivePlayerWeapon(playerid, 46, 1);
        GivePlayerWeapon(playerid,29,50000);
        GivePlayerWeapon(playerid,16,50000);
        GivePlayerWeapon(playerid,31,25);
        GivePlayerWeapon(playerid,16,50000);
        GivePlayerWeapon(playerid,34,50);
        return 1;
    }
There and i made a variable to check and put a player in that dm.

pawn Код:
if (strcmp(cmdtext, "/plant", true)==0)
    {
        if(BombArmed[playerid] == false)
        {
            GetPlayerPos(playerid, BombX[playerid], BombY[playerid], BombZ[playerid]);
            GetXYInFrontOfPlayer(playerid, BombX[playerid], BombY[playerid], 0.7);
            SendClientMessage(playerid, 0x0066FFAA, "Bomb Planted (exploding in 10 seconds).");
            ApplyAnimation(playerid, "BOMBER", "BOM_Plant", 4.0, 0, 0, 0, 0, 0);
            BombObject[playerid] = CreateObject(1252, BombX[playerid], BombY[playerid], BombZ[playerid] - 0.8,270,0,0);
            SetTimerEx("BombTimer",10000,0, "d", playerid);
            BombArmed[playerid] = true;
        }
        else
        {
            SendClientMessage(playerid, COLOR_RED, "You can only place a single bomb at a time!");
        }
        return 1;
    }
    if(InWar[playerid] != 0) return SendClientMessage(playerid, COLOR_RED, "You can't use commands in war use /leave to leave.");
    return 0;
}
Thats the last command and the return 0 etc.
You can see I added a check to see whether they are in the war/dm or not.
But I can teleport out of it , I don't see anything wrong. i even put InWar = 0;
On connect. why isn't it working ?

oh I do have more commands but only showed one.
Please help , thanks
Reply
#2

You have to check if the persons in war BEFORE the commands, assuming you want them to have to be in war to use plant.
Reply
#3

Quote:
Originally Posted by PrawkC
Посмотреть сообщение
You have to check if the persons in war BEFORE the commands, assuming you want them to have to be in war to use plant.
Can you maybe give me some small examples? I'm not sure what you mean.
Thanks
Reply
#4

You put the return 0 in the wrong spot. It should come after the closing brace of the last command.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)