How to disable commands while on Deathmatch Area?
#1

Hey another help
I want when i'm on deathmatch area i cant use any command except /leavedm
Also i need help i want when i use /home it will say "You must use /leavedm to teleport"
Please Help

Here is the code of my /dm:

pawn Код:
if(strcmp("/dm1", cmdtext, true, 10) == 0)
 {
    if(InSpawn[playerid] == true) return SendClientMessage(playerid, COLOR_RED, "You can't use this command while on class selection");
    new pName[MAX_PLAYER_NAME];
    new string[128];
    GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
    format(string, sizeof(string), "{FFFFFF}[SERVER]:{FF002B}%s has teleported to {FFFFFF}Deathmatch Area 1 - DM Area 1(/dm1)",pName);
    SendClientMessageToAll(COLOR_RED, string);
    SendClientMessage(playerid, COLOR_GREEN,"Welcome To DM Area");
    GameTextForPlayer(playerid,"~w~Welcome To ~r~Death ~g~Match ~y~Area 1",3000,3);
    SetPlayerPos(playerid,1050.6841,938.1620,18.5841);
    SetPlayerFacingAngle(playerid,143);
    return 1;
 }
i hope you answer fast
Reply
#2

You need to create something new.
Like

pawn Код:
if(Player[playerid][Event] == 1)
    {
        // Here you'r actions.
        Player[playerid][Event] = 1;
    }
Then you can check at every teleport:
pawn Код:
if(Player[playerid][Event] > 0) return SendClientMessage(playerid, 0xFF6347AA ,"You are already in a event, type /leavedm to leave.");
Reply
#3

in that /dm code add
SetPVarInt(playerid, "InDm", 1);
then in all your commands (yeah,, a long procedure) add
pawn Код:
if(GetPVarInt(playerid, "InDm") == 1) return SendClientMessage(playerid, (YOURCOLOR), "You are in DM, you cant use that command!");
else {
//your command here
}
and under home add
pawn Код:
if(GetPVarInt(playerid, "InDm") == 1) return SendClientMessage(playerid, (YOURCOLOR), "You must use /leavedm to teleport");
report any errors here, so i can fix them for you..

P.S. i am using PVar's as they are easy to understand

EDIT: ^ what kingunit said will also work ^
Reply
#4

Can you give me example?
Reply
#5

pawn Код:
if(strcmp("/dm1", cmdtext, true, 10) == 0)
 {
    if(InSpawn[playerid] == true) return SendClientMessage(playerid, COLOR_RED, "You can't use this command while on class selection");
    new pName[MAX_PLAYER_NAME];
    new string[128];
    GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
    format(string, sizeof(string), "{FFFFFF}[SERVER]:{FF002B}%s has teleported to {FFFFFF}Deathmatch Area 1 - DM Area 1(/dm1)",pName);
    SendClientMessageToAll(COLOR_RED, string);
    SendClientMessage(playerid, COLOR_GREEN,"Welcome To DM Area");
    GameTextForPlayer(playerid,"~w~Welcome To ~r~Death ~g~Match ~y~Area 1",3000,3);
    SetPlayerPos(playerid,1050.6841,938.1620,18.5841);
    SetPlayerFacingAngle(playerid,143);
    SetPVarInt(playerid, "InDm", 1);
    return 1;
 }
pawn Код:
if(strcmp("/home", cmdtext, true, 10) == 0)
{
if(GetPVarInt(plaeyrid, "InDm") == 1) return SendClientMessage(playerid, red, "You cant do that while in DM!");
else
{
//your code
}
hope this helps

EDIT: i think else will not be theree.. hmm.. just try this and tell me
Reply
#6

https://sampforum.blast.hk/showthread.php?tid=176688

Have a read of this thread mate, it may help you, it may not. You have to search around the forums to find your answer prefebly in Tutorial section
Reply
#7

But wheres The /leavedm command?
Reply
#8

i thought you have it -,-... now,,, dont trouble me,, work yourself.. i already gave you enough info.
Reply
#9

I think mine is the best one since you can create easy more.
And since it's > 0 means you can use it for every minigame/DM map. Check my example.
Reply
#10

IF you want a command that leaves that area, it will be similar to a teleportation command right?
pawn Код:
if(strcmp("/leavedm", cmdtext, true, 10) == 0)
{
    SetPlayerPos(playerid, X, Y, Z); // Place the X Y Z of the position where they player will be when they type this command
    SendClientMessage(playerid, COLOR_CODEHERE, "You have left the Deathmatch Area");
    return 1;
}
Reply
#11

Sorry for bump - Why do you not use ZCMD?
Reply
#12

I will need to transform all my command
so i dont use ZCMD
Reply
#13

Last more question how to make return message on /leavedm error saying "You already leave dm or You didnt join the dm yet"?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)