a lil help her
#1

I Made this DM Minigame

Код:
CMD:dm1(playerid,params[])
        {
        SetPlayerPos(playerid, 1133.1377,-1558.7405,22.7509);
        SetPlayerVirtualWorld(playerid, 5);
	SendClientMessage(playerid, COLOR_LIGHTBLUE, "Welcom to DM 1");
        PlayerPlaySound(playerid ,3200,0,0,0);
        SetPlayerHealth(playerid, 100);
        SetPlayerArmour(playerid, 100);
        GivePlayerWeapon(playerid, 27, 1500);
        GivePlayerWeapon(playerid, 29, 1500);
        GivePlayerWeapon(playerid, 31, 2000);
        GivePlayerWeapon(playerid, 16, 5);
return 1;
}
How can i Disable commands when hes inside the DM

and how can i make player Respawn in DM
Reply
#2

you need if statements
Reply
#3

pawn Код:
new bool:isinDM[MAX_PLAYERS] = false;

//If the player enters the location, 'isinDM[playerid]=true;'
//If the player exits the location, 'isinDM[playerid]=false;'

CMD:dm1(playerid,params[])
{
        if (!isinDM[playerid]) return SendClientMessage(playerid, -1, "You are not in the DM location.");
        SetPlayerPos(playerid, 1133.1377,-1558.7405,22.7509);
        SetPlayerVirtualWorld(playerid, 5);
    SendClientMessage(playerid, COLOR_LIGHTBLUE, "Welcom to DM 1");
        PlayerPlaySound(playerid ,3200,0,0,0);
        SetPlayerHealth(playerid, 100);
        SetPlayerArmour(playerid, 100);
        GivePlayerWeapon(playerid, 27, 1500);
        GivePlayerWeapon(playerid, 29, 1500);
        GivePlayerWeapon(playerid, 31, 2000);
        GivePlayerWeapon(playerid, 16, 5);
        return 1;
}
Reply
#4

Quote:
Originally Posted by BuuGhost
Посмотреть сообщение
pawn Код:
new bool:isinDM[MAX_PLAYERS] = false;

//If the player enters the location, 'isinDM[playerid]=true;'
//If the player exits the location, 'isinDM[playerid]=false;'

CMD:dm1(playerid,params[])
{
        if (!isinDM[playerid]) return SendClientMessage(playerid, -1, "You are not in the DM location.");
        SetPlayerPos(playerid, 1133.1377,-1558.7405,22.7509);
        SetPlayerVirtualWorld(playerid, 5);
    SendClientMessage(playerid, COLOR_LIGHTBLUE, "Welcom to DM 1");
        PlayerPlaySound(playerid ,3200,0,0,0);
        SetPlayerHealth(playerid, 100);
        SetPlayerArmour(playerid, 100);
        GivePlayerWeapon(playerid, 27, 1500);
        GivePlayerWeapon(playerid, 29, 1500);
        GivePlayerWeapon(playerid, 31, 2000);
        GivePlayerWeapon(playerid, 16, 5);
        return 1;
}
whats this ?
Reply
#5

Well, easily create a per-player global variable, set it to 1 when a player in a dm and to 0 if not in dm. Then you can check if it's set to 1 and if true do not execute your cmd. Example:

pawn Код:
// top of script
new Dming[MAX_PLAYERS]; // here's the per-player global variable
// if the value of this variable is 0 then the player isn't in a dm
// else he is in a dm
// ---------------------------------------------------------------
// In your dm command set that variable to 1 (To tell the script that this player is in a dm)
// by putting the following code inside the cmd
Dming[playerid] = 1;
// ---------------------------------------------------------------
// Now you can check as I said above if it's 1
// Example:
if(Dming[playerid] == 1) // checking if it's equal to 1 (In a deathmatch)
{
    SendClientMessage(playerid, -1, "You cannot do that while in a dm!");
    return 1;
}
// ---------------------------------------------------------------
// And to reset it when a player leaves a dm
// The following code should be added in a .. /leavedm command
Dming[playerid] = 0; // 0 = not in a dm
Reply
#6

pawn Код:
#include <a_samp>
#include <zcmd>

new IsPlayerInDm[MAX_PLAYERS];

public OnPlayerConnect(playerid)
{
    IsPlayerInDm[playerid] = 0; //This will remove u from the DM match when u Rejoin/Relog..
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    IsPlayerInDm[playerid] = 0; //this will automatically remove you from DM after exiting the Match..
    return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    IsPlayerInDm[playerid] = 0; //remove this if u dont want that player remove from the DM after death..
    return 1;
}

CMD:dm1(playerid,params[])
{
    GameTextForPlayer(playerid, "~r~] ~y~Welcome to DM1 ~r~]", 5000, 3);
    SetPlayerVirtualWorld(playerid, 5); //virtual world ,
    SetPlayerPos(playerid, 1133.1377,-1558.7405,22.7509);
    PlayerPlaySound(playerid ,3200,0,0,0);
    SetPlayerHealth(playerid, 100); //health
    SetPlayerArmour(playerid, 100); //armour
    GivePlayerWeapon(playerid, 27, 1500); //give weapon
    GivePlayerWeapon(playerid, 29, 1500);
    GivePlayerWeapon(playerid, 31, 2000);
    GivePlayerWeapon(playerid, 16, 5);
    IsPlayerInDm[playerid] = 1;
    return 1;
}

CMD:leavedm(playerid, params[])
{
    if(IsPlayerInDm[playerid] == 0) //Check
    {
        SendClientMessage(playerid,-1,"You are not in Deathmatch Minigames to do that"); // Checked if u are not in DM
    }
    else
    {
        SetPlayerPos(playerid, x, y, z); //where will u spawn when u connected to the server ?
        //i means after u select the skin where will u spawn ? give me the x,y,z
        SetPlayerVirtualWorld(playerid, 0); // normal virtual world
        ResetPlayerWeapons(playerid); //Remove the player weapon
        SetPlayerInterior(playerid, 0); //Set the interior to 0 / Normal interior
        IsPlayerInDm[playerid] = 0; // 0 = remove player from DM
    }
    return 1;
}
Reply
#7

Hay thanks i will Test it
Reply
#8

Hay But when i die I get out of DM
How to Respawn in DM

Like i want player to respawn her
Quote:

1121.2030,-1558.7004,22.7422

then her
Quote:

1128.4347,-1559.3549,13.7180

then
....

When I Die i get out of DM but i stay in the same V-World

Can you show me what to do ?
Reply
#9

remove
pawn Код:
IsPlayerInDm[playerid] = 0;
onplayerdeath
Reply
#10

Quote:
Originally Posted by Devilxz97
Посмотреть сообщение
remove
pawn Код:
IsPlayerInDm[playerid] = 0;
onplayerdeath
Change it to


IsPlayerInDm[playerid] = 1;

Remember shall be in onplayerdeath
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)