DM Area Help
#1

I have on mini problem when i tele to dm area and type th same command again it teleport again to same place, i was thinking to add when player type same command again server will say: "you are already in dm area" can someone help me?
Reply
#2

Use a function like
Код:
new IsAtDMArea[MAX_PLAYERS];
To OnPlayerConnect
Код:
IsAtDMArea[playerid] = 0;
At command
Код:
if(IsAtDMArea[playerid] == 1) return SendClientMessage(playerid, -1, "You already are at dm area");
And
Код:
IsAtDMArea[playerid] = 1;
And when he leaves or die set it to 0
Reply
#3

but when i join dm area it says you are already in dm area and teleport me everytime i type that command
Reply
#4

Post the command here.
Reply
#5

Код:
if (strcmp(cmdtext,"/area51dm", true, 9) ==0)
	{
	SetPlayerPos(playerid,203.5948, 1929.7161, 22.8286);
	new str[128],name[24];
        GetPlayerName(playerid,name,24);
        format(str,sizeof(str),"~r~%s ~w~has teleported to /area51dm",name);
        TextDrawSetString(teleporttext,str);
	GivePlayerWeapon(playerid,24,100);//------Deagle
	GivePlayerWeapon(playerid,27,100);//------Combat Shotgun
	GivePlayerWeapon(playerid,34,100);//------Sniper Rifle
	TextDrawShowForPlayer(playerid, teleporttext);
	SendClientMessage(playerid,yellow,"Welcome To The Area51 Death match! to Exit use /exitdm!!!");
        dm1[playerid] = 1;
        IsAtDMArea[playerid] = 1;
        if(IsAtDMArea[playerid] == 1) return SendClientMessage(playerid, red, "You already are at dm area");
	return 1;
    }
Reply
#6

Код:
if (strcmp(cmdtext,"/area51dm", true, 9) ==0)
{
	if(IsAtDMArea[playerid] == 1) return SendClientMessage(playerid, red, "You already are at dm area");
	SetPlayerPos(playerid,203.5948, 1929.7161, 22.8286);
	new str[128],name[24];
    GetPlayerName(playerid,name,24);
    format(str,sizeof(str),"~r~%s ~w~has teleported to /area51dm",name);
    TextDrawSetString(teleporttext,str);
	GivePlayerWeapon(playerid,24,100);//------Deagle
	GivePlayerWeapon(playerid,27,100);//------Combat Shotgun
	GivePlayerWeapon(playerid,34,100);//------Sniper Rifle
	TextDrawShowForPlayer(playerid, teleporttext);
	SendClientMessage(playerid,yellow,"Welcome To The Area51 Death match! to Exit use /exitdm!!!");
    dm1[playerid] = 1;
    IsAtDMArea[playerid] = 1;
	return 1;
}
Reply
#7

and one more thing i want when player enter dm area and type command for another dm area or stunt,skydive blabla
in chat will show: Use /exitdm to exit
Reply
#8

Do same thing with another function..like IsAtDM,set it to 1 when he type the command and to 0 when he exit..
Reply
#9

Код:
new IsAtDM[MAX_PLAYERS];
To OnPlayerConnect
Код:
IsAtDM[playerid] = 0;
At command
Код:
if(IsAtDM[playerid] == 1) return SendClientMessage(playerid, -1, "You need to exit from dm area first");
And
Код:
IsAtDM[playerid] = 1;
At exitdm
Код:
IsAtDM[playerid] = 0;
Reply
#10

no when i am in dm area and teleport to another dm wont block just teleport and dont say anything
Код:
	if (strcmp(cmdtext,"/area51dm", true, 9) ==0)
	{
	if(IsAtDMArea[playerid] == 1) return SendClientMessage(playerid, red, "You already are at dm area");
	if(IsAtDM[playerid] == 1) return GameTextForPlayer(playerid, "~r~/~w~exitdm", 2000, 0);
	SetPlayerPos(playerid,203.5948, 1929.7161, 22.8286);
	new str[128],name[24];
    GetPlayerName(playerid,name,24);
    format(str,sizeof(str),"~r~%s ~w~has teleported to /area51dm",name);
    TextDrawSetString(teleporttext,str);
	GivePlayerWeapon(playerid,24,100);//------Deagle
	GivePlayerWeapon(playerid,27,100);//------Combat Shotgun
	GivePlayerWeapon(playerid,34,100);//------Sniper Rifle
	TextDrawShowForPlayer(playerid, teleporttext);
	SendClientMessage(playerid,yellow,"Welcome To The Area51 Death match! to Exit use /exitdm!!!");
    dm1[playerid] = 1;
    IsAtDMArea[playerid] = 1;
    IsAtDM[playerid] = 1;
	return 1;
}
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)