[?] Creating variable, freezer when enter a DM zone, if checkpoint=mycp
#1

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.
Reply
#2

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

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.
Reply
#4

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

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
Reply
#6

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.");
Reply
#7

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)