#1

i have a menu:

pawn Код:
if (strcmp(cmd, "/v4", true) == 0)
    {
    ShowMenuForPlayer(ActivitisStadiumcars, playerid);
      TogglePlayerControllable(playerid, 0);
        return 1;
    }
how can i do that if player is choosing something in the 2nd-5th time it will "freeze" him for a 5 second and after that he will be unfrozen

if player is choosing something in the 5th time it will send him a messange and delete what he choose?
tanks for helping
Reply
#2

You can use this after checking that player has used it 2n time or whenever you want
pawn Код:
// Inside where you check that player has choosed it 2nd-5th time
TogglePlayerControllable(playerid,0);
SetTimerEx("UnFreeze",5000,0,"i",playerid);


/// Add this at last of the script

forward UnFreeze(playerid);
public UnFreeze(playerid){
  TogglePlayerControllable(playerid,1);
}
Reply
#3

Quote:
Originally Posted by ۞●•λвнiиаv•●۞
You can use this after checking that player has used it 2n time or whenever you want
pawn Код:
// Inside where you check that player has choosed it 2nd-5th time
TogglePlayerControllable(playerid,0);
SetTimer("UnFreeze",5000,0,"i",playerid);


/// Add this at last of the script

forward UnFreeze(playerid);
public UnFreeze(playerid){
  TogglePlayerControllable(playerid,1);
}
SetTimer will only work for ID 0. Use SetTimerEx...
Reply
#4

Edited .. thanks for telling Spider ...

Thank You
-Abhinav
Reply
#5

i ment of he chose something afther that he chose already is it gonna make him wait 5 second?
Reply
#6

just add a boolean variable for that. Use a boolean veriable inside the timer and set it to false and
before setting the timer, set it to true

Inside you OnMenuSelectRow ...

check if that boolean variable is true, only then the player can perform that fuction.
Reply
#7

Quote:
Originally Posted by ۞●•λвнiиаv•●۞
just add a boolean variable for that. Use a boolean veriable inside the timer and set it to false and
before setting the timer, set it to true

Inside you OnMenuSelectRow ...

check if that boolean variable is true, only then the player can perform that fuction.
huhhhhhhhhhhh/
explain more
Reply
#8

Add this on the top of the script
pawn Код:
new bool:AllowMenu[MAX_PLAYERS]=true;
forward CheckAllow(playerid);
Now add this inside where you select something for the first time ...after where you have selected then add this line
pawn Код:
new bool:AllowMenu[playerid]=false;
SetTimerEx("CheckAllow",5000,0,"i",playerid);
Add at the same place but before everything to check whether is the player accessing the command again.
pawn Код:
if(!AllowMenu[playerid]) return SendClientMessage(playerid,0xFF0000FF,"You are accessing it too fast, slow down !");
and add this at the bottom of the script
pawn Код:
public CheckAllow(playerid){
AllowMenu[playerid]=true;
}
Now add this under OnPlayerConnect
pawn Код:
AllowMenu[playerid]=true;
I am 70% sure that you are confused seeing this...but in real its damn easy :P

Good Luck with this

Thank You
-Abhinav

Reply
#9

Quote:
Originally Posted by ۞●•λвнiиаv•●۞
Add this on the top of the script
pawn Код:
new bool:AllowMenu[MAX_PLAYERS]=true;
forward CheckAllow(playerid);
Now add this inside where you select something for the first time ...after where you have selected then add this line
pawn Код:
new bool:AllowMenu[playerid]=false;
SetTimerEx("CheckAllow",5000,0,"i",playerid);
Add at the same place but before everything to check whether is the player accessing the command again.
pawn Код:
if(!AllowMenu[playerid]) return SendClientMessage(playerid,0xFF0000FF,"You are accessing it too fast, slow down !");
and add this at the bottom of the script
pawn Код:
public CheckAllow(playerid){
AllowMenu[playerid]=true;
}
Now add this under OnPlayerConnect
pawn Код:
AllowMenu[playerid]=true;
I am 70% sure that you are confused seeing this...but in real its damn easy :P

Good Luck with this

Thank You
-Abhinav

ok i will check it later
Reply
#10

but how can i do that if he is choosing thing like 5 times it wont let him?
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)