[B]Help Me[/B]
#1

Help Me i uses This Dm Code
Код:
/* DM FilterScript by MiGu3X */

#include <a_samp>
#include <zcmd>

new InDM[MAX_PLAYERS];
new Dead[MAX_PLAYERS];
new DmID[MAX_PLAYERS];

public OnPlayerConnect(playerid)
{
        InDM[playerid] = 0;
        DmID[playerid] = 0;
}

public OnPlayerDeath(playerid, killerid)
{
        SetPlayerHealth(killerid, 100);
        SetPlayerArmour(killerid, 100);

        Dead[playerid] = 1;
        return 1;
}

public OnPlayerSpawn(playerid)
{
    if(Dead[playerid] == 1 && DmID[playerid] == 1)
    {
        SetPlayerInterior(playerid, 1);
                SetPlayerPos(playerid, 1412.639892, -1.787510, 1000.924377);
                SetPlayerVirtualWorld(playerid, 1);
        Dead[playerid] = 0;
    }
    else if(Dead[playerid] == 1 && DmID[playerid] == 2)
    {
        SetPlayerInterior(playerid, 10);
                SetPlayerPos(playerid, -975.975708,1060.983032,1345.671875);
                SetPlayerVirtualWorld(playerid, 1);
                Dead[playerid] = 0;
        }
        else if(Dead[playerid] == 1 && DmID[playerid] == 3)
        {
                SetPlayerInterior(playerid, 3);
                SetPlayerPos(playerid, 288.745971, 169.350997, 1007.171875);
                SetPlayerVirtualWorld(playerid, 1);
                Dead[playerid] = 0;
        }
        else if(Dead[playerid] == 1 && DmID[playerid] == 4)
        {
                SetPlayerInterior(playerid, 3);
                SetPlayerPos(playerid, -2640.762939, 1406.682006, 906.460937);
                SetPlayerVirtualWorld(playerid, 1);
                Dead[playerid] = 0;
        }
    return 1;
}

CMD:dm1(playerid, params[])
{
        InDM[playerid] = 1;
        DmID[playerid] = 1;

        SendClientMessage(playerid, -1, "{66FF66}Welcome to Running Weapons DM 1 {BABABA}(SawnOff)");
        SetPlayerInterior(playerid, 1);
        SetPlayerPos(playerid, 1412.639892, -1.787510, 1000.924377);
        SetPlayerVirtualWorld(playerid, 1);

        ResetPlayerWeapons(playerid);
        SetPlayerHealth(playerid, 100);
        SetPlayerArmour(playerid, 100);
        GivePlayerWeapon(playerid, 26, 100000);

        new str[36+MAX_PLAYER_NAME], name[MAX_PLAYER_NAME];
        GetPlayerName(playerid, name, sizeof(name));
        format(str, sizeof(str), "[WG-DM]: {FFFFFF}%s {BABABA}(ID: %d) has gone to /dm1", name, playerid);
        SendClientMessageToAll(-1, str);
        return 1;
}

CMD:dm2(playerid, params[])
{
        InDM[playerid] = 1;
        DmID[playerid] = 2;

        SendClientMessage(playerid, -1, "{66FF66}Welcome to Running Weapons DM 2 {BABABA}(SawnOff - Tec-9)");
        SetPlayerInterior(playerid, 10);
        SetPlayerPos(playerid, -975.975708,1060.983032,1345.671875);
        SetPlayerVirtualWorld(playerid, 1);

        ResetPlayerWeapons(playerid);
        SetPlayerHealth(playerid, 100);
        SetPlayerArmour(playerid, 100);
        GivePlayerWeapon(playerid, 26, 100000);
        GivePlayerWeapon(playerid, 32, 100000);

        new str[36+MAX_PLAYER_NAME], name[MAX_PLAYER_NAME];
        GetPlayerName(playerid, name, sizeof(name));
        format(str, sizeof(str), "[WG-DM]: {FFFFFF}%s {BABABA}(ID: %d) has gone to /dm2", name, playerid);
        SendClientMessageToAll(-1, str);
        return 1;
}

CMD:leavedm(playerid, params[])
{
        if (InDM[playerid] == 1) return SendClientMessage(playerid, -1, "{FFFFFF}You are not in a DM");

        {
        SetPlayerVirtualWorld(playerid, 0);
        SetPlayerInterior(playerid,0);
        SpawnPlayer(playerid);
        InDM[playerid] = 0;
        DmID[playerid] = 0;
    }

    return 1;
}
anyone please give me the code to type after any teleport command to dont do it example:
if InDM SendClientMessage(playerid, -1, "you must leave dm before using this command");
Reply
#2

In the leave command you wrote this:

Код:
if (InDM[playerid] == 1) return SendClientMessage(playerid, -1, "{FFFFFF}You are not in a DM");
But that is wrong!

Write it like this:

Код:
if (!InDM[playerid]) return SendClientMessage(playerid, -1, "{FFFFFF}You are not in a DM");
and to your question, write this at the top-line:

Код:
if(InDM[playerid]) return SendClientMessage(playerid, -1, "you must leave dm before using this command");
Greekz
Reply
#3

Thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)