SA-MP Forums Archive
Why isn't this working ? - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Why isn't this working ? (/showthread.php?tid=264475)



Why isn't this working ? - Jay. - 26.06.2011

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


Re: Why isn't this working ? - PrawkC - 26.06.2011

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.


Re: Why isn't this working ? - Jay. - 26.06.2011

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


Re: Why isn't this working ? - Vince - 26.06.2011

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