SA-MP Forums Archive
DM Area Help - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: DM Area Help (/showthread.php?tid=385827)



DM Area Help - Beljulji - 17.10.2012

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?


Re: DM Area Help - TzAkS. - 17.10.2012

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


Re: DM Area Help - Beljulji - 17.10.2012

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


Re: DM Area Help - TzAkS. - 17.10.2012

Post the command here.


Re: DM Area Help - Beljulji - 17.10.2012

Код:
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;
    }



Re: DM Area Help - TzAkS. - 17.10.2012

Код:
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;
}



Re: DM Area Help - Beljulji - 17.10.2012

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


Re: DM Area Help - TzAkS. - 17.10.2012

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


Re: DM Area Help - TzAkS. - 17.10.2012

Код:
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;



Re: DM Area Help - Beljulji - 17.10.2012

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;
}