SA-MP Forums Archive
/dmzone? - 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: /dmzone? (/showthread.php?tid=124575)



/dmzone? - -Rebel Son- - 30.01.2010

ok i've looked at some peoples posts, but when i add there codes pawno crashs.

anyone got a dm code that disables commands when they tele there?




Re: /dmzone? - LuxurioN™ - 30.01.2010

Basic exemple for you (Not Tested):

Top of your script:
pawn Код:
new bool: DisableCmds[MAX_PLAYERS];
OnPlayerConnect:
pawn Код:
DisableCmds[playerid] = false;
OnPlayerCommandText(Top):

pawn Код:
if(DisableCmds[playerid] == true) return 0;
And Basic Teleport:
pawn Код:
if(strcmp(cmd, "/dmzone", true) == 0)
{
SetPlayerPos(playerid, X,Y,Z);
DisableCmds[playerid] = true;
return 1;
}
To exit:
pawn Код:
if(strcmp(cmd, "/exitdmzone", true) == 0)
{
SetPlayerPos(playerid, X,Y,Z);
DisableCmds[playerid] = false;
return 1;
}
And, in OnPlayerDisconnect and OnPlayerDeath:
pawn Код:
DisableCmds[playerid] = false;



Re: /dmzone? - -Rebel Son- - 31.01.2010

Thank you sir. apricciate it.


Re: /dmzone? - -Rebel Son- - 31.01.2010

here is how i have it, it still crash's


Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if(DisableCmds[playerid] == true) return 0;
}
if(!strcmp(cmdtext, "/dmzone", true)) {
SetPlayerPos(playerid, 2387.3711,997.1989,10.8203);
DisableCmds[playerid] = true;
return 1;
}
if(!strcmp(cmdtext, "/exitdmzone", true)) {
SetPlayerPos(playerid, 1041.3733,-1039.0649,31.7685);
DisableCmds[playerid] = false;
return 1;
}



Re: /dmzone? - caribe88 - 31.01.2010

Try this

On the top of your script
new DmZone[MAX_PLAYERS];

OnPlayerConect
DmtZone[playerid] = 0;

OnPlayerDisconnect
DmZone[playerid] = 0;

OnPlayerSpawn
DmtZone[playerid] = 0;

OnPlayerDeath
DmtZone[playerid] = 0;

dcmd_put your command here(const playerid,const params[]){
#pragma unused params
if(DmZone[playerid] == 1) return SendClientMessage(playerid,COLOR_RED,"Write /exit");
//Rest of script
return 1;}

Something else if you go to a place for example a dm make sure you put DmtZone[playerid] = 1; in the script that way the commands that have if(DmZone[playerid] == 1) return SendClientMessage(playerid,COLOR_RED,"Write /exit"); will work
Also make sure to have and /exit command that changes DmZone[playerid] = 1; to DmtZone[playerid] = 0;

If you need more help just tell me, this system is what i use and it dosen't make any problem in my script





Re: /dmzone? - CJ101 - 31.01.2010

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if(DisableCmds[playerid] == true) return 0;

if(!strcmp(cmdtext, "/dmzone", true)) {
SetPlayerPos(playerid, 2387.3711,997.1989,10.8203);
DisableCmds[playerid] = true;
return 1;
}
if(!strcmp(cmdtext, "/exitdmzone", true)) {
SetPlayerPos(playerid, 1041.3733,-1039.0649,31.7685);
DisableCmds[playerid] = false;
return 1;
}
return 0;
}