/dmzone?
#1

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?

Reply
#2

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;
Reply
#3

Thank you sir. apricciate it.
Reply
#4

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;
}
Reply
#5

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


Reply
#6

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


Forum Jump:


Users browsing this thread: 2 Guest(s)