SA-MP Forums Archive
DM 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: DM Help! (/showthread.php?tid=255948)



DM Help! - fiki574 - 18.05.2011

Hello! So, I wanna know how to stop all commands/teleports in DMs except /kill command! Can someone help me with this pls?
Here is my DM teleport:
Код:
if (strcmp("/apb", cmdtext, true, 10) == 0)
	{
			SetPlayerPos(playerid, 1493.9071,-1573.1179,67.2109);
			SetPlayerFacingAngle(playerid, 184.5182);
			SetCameraBehindPlayer(playerid);
			GameTextForPlayer(playerid,"WELCOME TO ALL POINTS BULLETIN",5000,3);
			new string[256], pname[MAX_PLAYER_NAME];
			GetPlayerName(playerid, pname, sizeof(pname));
			format(string, sizeof(string), "%s has teleported to All Points Bulletin (/apb)", pname);
			SendClientMessageToAll(YELLOW, string);
			SendClientMessage(playerid,YELLOW,"Type /apbr for APB rules!");
			SendClientMessage(playerid,YELLOW,"Type /apbc for APB commands!");
			SendClientMessage(playerid,YELLOW,"Type /kill to leave APB!");
			ShowPlayerDialog(playerid, 15, DIALOG_STYLE_LIST,"{FF002B}ALL POINTS BULLETIN","Enforcer\nCriminal","Spawn","Cancel");
			SetPlayerVirtualWorld(playerid, 0);
			return 1;
	}



Re: DM Help! - fiki574 - 18.05.2011

Anyone pls


Re: DM Help! - fiki574 - 18.05.2011

PLS PLS PLS help me!


Re: DM Help! - Wesley221 - 18.05.2011

pawn Код:
new isInDM[MAX_PLAYERS] // Put this under your defines/includes

OnPlayerSpawn:
isInDM[playerid] = 0;

<This needs to be in your teleport command>
isInDM[playerid] = 1;


Put this in the commands you want to prevent if he is in a DM
if(isInDM[playerid] = 1)
{
    SendClientMessage(playerid, color_orange, "Please /kill yourself to teleport.");
    return 1;
}



Re: DM Help! - fiki574 - 18.05.2011

Dont works! When I put that i cant use any cmd!


Re: DM Help! - Wesley221 - 18.05.2011

My bad,
pawn Код:
OnPlayerConnect:
isInDM[playerid] = 0;
Instead of OnPlayerSpawn


Re: DM Help! - fiki574 - 18.05.2011

Still dont works!
Can you give me an example of "disabled" command in DM pls


Re: DM Help! - Wesley221 - 18.05.2011

Yeah sure
pawn Код:
if (!strcmp(cmdtext, "/fix"))
        {
        if(IsInDM[playerid] ==1)
        {
        SendClientMessage(playerid, red, "Please /kill yourself, then you can fix your car");
        return 1;
        }
                //This is the code when your NOT in DM
        RepairVehicle(GetPlayerVehicleID(playerid));
        PlayerPlaySound(playerid, 1133, 0.0, 0.0, 0.0);
        SendClientMessage(playerid, red, "Vehicle repaired");
        return 1;
        }



Re: DM Help! - Cro_Haxor - 18.05.2011

This?

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


Re: DM Help! - fiki574 - 18.05.2011

Quote:
Originally Posted by Wesley221
Посмотреть сообщение
Yeah sure
pawn Код:
if (!strcmp(cmdtext, "/fix"))
        {
        if(IsInDM[playerid] ==1)
        {
        SendClientMessage(playerid, red, "Please /kill yourself, then you can fix your car");
        return 1;
        }
                //This is the code when your NOT in DM
        RepairVehicle(GetPlayerVehicleID(playerid));
        PlayerPlaySound(playerid, 1133, 0.0, 0.0, 0.0);
        SendClientMessage(playerid, red, "Vehicle repaired");
        return 1;
        }
IT WORKS! THANK YOU SO MUCH!! <3 <3 <3 <3