how would i do this?
#1

how would i make it so when i type this cmd


/rules

twice it says youve typed it twice...?


thanks do i use like if(count

or somethin ty
Reply
#2

pawn Код:
new twice = 0;
     if(cmdtext == "/rules" && twice == 0) {
          twice++;
     } else {
          twice = 0;
          return SendClientMessage(playerid,red,"You've typed /rules twice!");
     }
}
I don't know.. maybe it works
Reply
#3

im a bit confused could you explane it - thanks
Reply
#4

pawn Код:
new RulesAmount[MAX_PLAYERS];
 
     OnplayerConnect(playerid)
     {
         RulesAmount[playerid] = 0;
     }


     if(strcmp(cmd, "/rules", true) == 0)
     {
        if(RulesAmount[playerid] <= 1) { RulesAmount[playerid] ++;
        else
        {
             RulesAmount[playerid] = 0;
             return SendClientMessage(playerid,red,"You've typed /rules twice!");
        }
     }

}
Reply
#5

k thanks
Reply
#6

corrected:
pawn Код:
new twice = 0; // Creates a variable with the value 0.
     if(cmdtext == "/rules") { //checks we typed /rules
          if(twice == 0) { //if our variable (twice) is still 0, then it adds one (so twice is 1 now.)
          twice++;
          } else { //Now, we've got the twice 1, and typed /rules, so it returns that message:
          twice = 0; //sets twice 0 to repeat the code.
          return SendClientMessage(playerid,red,"You've typed /rules twice!");//sends this message, and it doesnt perform /rules.
     }
}
Reply
#7

Quote:
Originally Posted by Seven_of_Nine
Посмотреть сообщение
corrected:
pawn Код:
new twice = 0; // Creates a variable with the value 0.
     if(cmdtext == "/rules") { //checks we typed /rules
          if(twice == 0) { //if our variable (twice) is still 0, then it adds one (so twice is 1 now.)
          twice++;
          } else { //Now, we've got the twice 1, and typed /rules, so it returns that message:
          twice = 0; //sets twice 0 to repeat the code.
          return SendClientMessage(playerid,red,"You've typed /rules twice!");//sends this message, and it doesnt perform /rules.
     }
}
Yours will not work, you create a global varible 'twice' you need a player varible.
Reply
#8

I've been minderped! Well, I'm practicing
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)