SA-MP Forums Archive
[?] Creating variable, freezer when enter a DM zone, if checkpoint=mycp - 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: [?] Creating variable, freezer when enter a DM zone, if checkpoint=mycp (/showthread.php?tid=99924)



[?] Creating variable, freezer when enter a DM zone, if checkpoint=mycp - AG Adam - 01.10.2009

Hi, you guys. I want to create a gamemode, but don't know how to do some things.

1. I want to create a variable.
Example: InDM[playerid]
And, changing it at every playerid, when enter a DM zone, or exit.
If a player InDM[playerid]=1, he can't use commands. I want this, too.

2. If a player enters a DM zone, freeze the player about 3 seconds, then unfreeze. I finded it at some hungarian forum, but that not works.

3. If a check point ID is = Example : mychkp, do something.


Re: [?] Creating variable, freezer when enter a DM zone, if checkpoint=mycp - SpiderPork - 01.10.2009

1.) Make a new variable on top, outside of all functions; new InDm[MAX_PLAYERS];
Make sure to reset it (InDM[playerid] = 0 under OnPlayerDisconnect and OnPlayerDeath.

2.) Under the DM zone command, put this:
pawn Code:
InDM[playerid] = 1;
Also set a timer and use TogglePlayerControllable to freeze/unfreeze the player.

3.) You should use a checkpoint streamer, use this.


Re: [?] Creating variable, freezer when enter a DM zone, if checkpoint=mycp - AG Adam - 01.10.2009

Quote:
Originally Posted by SpiderPork
1.) Make a new variable on top, outside of all functions; new InDm[MAX_PLAYERS];
Make sure to reset it (InDM[playerid] = 0 under OnPlayerDisconnect and OnPlayerDeath.

2.) Under the DM zone command, put this:
pawn Code:
InDM[playerid] = 1;
Also set a timer and use TogglePlayerControllable to freeze/unfreeze the player.

3.) You should use a checkpoint streamer, use this.
Thx, but i ask in Question 2.:
If somebody type /dm, that player freezes for 3 seconds, and automatically unfreezed 3 seconds later.

And:
Quote:
Originally Posted by AG Adam
Example: InDM[playerid]
And, changing it at every playerid, when enter a DM zone, or exit.
If a player InDM[playerid]=1, he can't use commands. I want this, too.
If a player enters a DM zone, freeze the player about 3 seconds, then unfreeze. I finded it at some hungarian forum, but that not works.



Re: [?] Creating variable, freezer when enter a DM zone, if checkpoint=mycp - SpiderPork - 01.10.2009

As I said, use a timer:

pawn Code:
// Under your DM command
TogglePlayerControllable(playerid, 0);
SetTimerEx("Unfreeze", 3000, 0, "i", playerid);

// Somewhere, outside of other functions.
forward Unfreeze(playerid);
public Unfreeze(playerid)
{
   TogglePlayerControllable(playerid, 1);
}



Re: [?] Creating variable, freezer when enter a DM zone, if checkpoint=mycp - AG Adam - 01.10.2009

Quote:
Originally Posted by SpiderPork
As I said, use a timer:

pawn Code:
// Under your DM command
TogglePlayerControllable(playerid, 0);
SetTimerEx("Unfreeze", 3000, 0, "i", playerid);

// Somewhere, outside of other functions.
forward Unfreeze(playerid);
public Unfreeze(playerid)
{
  TogglePlayerControllable(playerid, 1);
}
Ok, thanx again, see my message, I modified it



Re: [?] Creating variable, freezer when enter a DM zone, if checkpoint=mycp - SpiderPork - 01.10.2009

Then put this under OnPlayerCommandText:

pawn Code:
if(InDM[playerid] == 1) return SendClientMessage(playerid, color, "Error: You can't use commands in a DM zone.");



Re: [?] Creating variable, freezer when enter a DM zone, if checkpoint=mycp - AG Adam - 01.10.2009

Quote:
Originally Posted by SpiderPork
Then put this under OnPlayerCommandText:

pawn Code:
if(InDM[playerid] == 1) return SendClientMessage(playerid, color, "Error: You can't use commands in a DM zone.");
Okay, very, very thanks for you, you helped a lot.