Deathmatch Zone Help
#1

Hi sa-mp fans.I maked a deathmatch zone with cancel command for leaving the dm,but when I am in the dm and type a teleport command i go to the place.How to make it when I type the command(teleport) It says "You need to exit the deathmatch first".
Reply
#2

Can someone help ?
Reply
#3

EDIT: Did you mean you actually have your own GangZoneCreate type of deathmatch zone, or did you just mean an area they could DM in? as the one below I posted is only if you meant the latter.

You need to set a variable when the player joins the deathmatch zone, something lke
new enterDMZone[MAX_PLAYERS];

Then set the enterDMZone[playerid] = 1; when they enter it.

Then in the command to teleport away
if(enterDMZone[playerid] == 1) {
SendClientMessage(playerid, YOUR_COLOR, "You need to exit the deathmatch zone first");
return 1;
}
when they do finally leave enterDMZone[playerid] = 0;

Alternatively, if you use a streamer, many have functions to detect zones that you personally can create.
Or you can IsPlayerInRangeOfPoint etc

There may even be a standard zone check to see if your in the range of a zone, somewhere on the wiki, have a quick browse. If not try the above.
Reply
#4

Im triyng to make it.Here is the command:

Код:
if (strcmp("/dm1", cmdtext, true, 10) == 0)
    {
      if(isindm1[playerid]==1) return SendClientMessage(playerid, COLOR_YELLOW, "You need to exit the current deathmatch first.");
      isindm1[playerid]=1;
      SetPlayerPos(playerid, 1776.9133, -1801.5455, 52.4688);
      SetPlayerFacingAngle(playerid, 0);
      new string[128],pName[MAX_PLAYER_NAME];
      GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
      format(string,sizeof(string)," %s Joined Dm1",pName);
      SendClientMessageToAll(COLOR_YELLOW,string);
    }
    if (strcmp("/cancel", cmdtext, true, 10) == 0)
    {
        if(isindm1[playerid]==1)isindm1[playerid]=0;
		else return SendClientMessage(playerid, COLOR_YELLOW, "Your Not In a Dm!");
        SetPlayerPos(playerid, -1496.3367, 904.7078, 7.1875);
        new string[128],pName[MAX_PLAYER_NAME];
        GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
        format(string,sizeof(string)," %s exit DM1",pName);
        SendClientMessageToAll(COLOR_YELLOW,string);
    }
    return 1;
}
Reply
#5

U need to add.if(isindm1) to all ur tele commands to check if he is in dm or not.if he is don't allow teleport.
Reply
#6

but i did it.Here is my ls command:

Код:
if (strcmp("/ls", cmdtext, true, 10) == 0)
    {
    if(IsPlayerInAnyVehicle(playerid))
    {
    if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
    {
      SetVehiclePos(GetPlayerVehicleID(playerid), 2497.0798, -1666.4255, 13.3438);
      SetVehicleZAngle(GetPlayerVehicleID(playerid), 0);
    }
    else
    {
        SendClientMessage(playerid, YELLOW, "ERROR: You need to be the driver!");
        return 1;
      }
    }
    else
    {
      SetPlayerPos(playerid, 2497.0798, -1666.4255, 13.3438);
      SetPlayerFacingAngle(playerid, 0);
    }
    if(isindm1[playerid]==1) return SendClientMessage(playerid, YELLOW, "You need to exit the current deathmatch first.");
    new string[128],pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
    format(string,sizeof(string),""RED"[Tp~Info] "GREEN"%s Teleported To Los Santos",pName);
    SendClientMessageToAll(COLOR,string);
    return 1;
    }
Reply
#7

Please Someone ??
Reply
#8

you want do make /gotols for admins?
Reply
#9

No i want when i am in the dm to disable the teleport commands...
Reply
#10

try adding this to your dm teleport command

pawn Код:
isindm1[playerid] = 1;
make sure you have new isindm1[MAX_PLAYERS]; in the top of your script then

try adding this in all of your commands

pawn Код:
if(isindm1[playerid] == 1) return //Your code here
then if player wants to go to other DM Arena even he is in dm1 he must quit first. heres the code for that

pawn Код:
if(isindm1[playerid] == 1) return //Your code here
the same in isindm2, isindm3, isindm4 etc...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)