[Help] /cuff problem
#6

pawn Код:
if(!strcmp(cmd,"/cuff",true)) {
  // Declare and initialize variables to hold parameters
  new playerToBeCuffed[256], playerCuffedID, index;
  playerToBeCuffed = strtok(cmdtext, index);

  // Do we have valid parameters? This implementation is much faster than checking the string length of the command.
  if(!playerToBeCuffed[0]) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /cuff [Player ID / Part of name]");

  // Did they specify id, or name?
  if(!IsNumeric(playerToBeCuffed)) {
    playerCuffedID = ReturnPlayerID(playerToBeCuffed);
  } else playerCuffedID = strval(playerToBeCuffed);

  // Inform the player
  GameTextForPlayer(id, "~y~hand cuffs!", 2500, 3);

  // Toggle the player uncontrollable
  TogglePlayerControllable(id, 0);

  return true;
}
I have basically rewritten this command for you, but there are still a few missing pieces. You need to verify the team of the playerid executing the command, otherwise any player has access to your cuff command.

Please don't just copy and paste this code. LEARN from it. I will check this thread to answer any questions you have.
Reply


Messages In This Thread
[Help] /cuff problem - by joeri55 - 07.06.2009, 15:06
Re: [Help] /cuff problem - by Weirdosport - 07.06.2009, 15:10
Re: [Help] /cuff problem - by joeri55 - 07.06.2009, 16:31
Re: [Help] /cuff problem - by member - 07.06.2009, 16:32
Re: [Help] /cuff problem - by joeri55 - 07.06.2009, 16:56
Re: [Help] /cuff problem - by samgreen - 07.06.2009, 18:39
Re: [Help] /cuff problem - by joeri55 - 07.06.2009, 18:48
Re: [Help] /cuff problem - by samgreen - 07.06.2009, 18:54
Re: [Help] /cuff problem - by joeri55 - 07.06.2009, 18:54
Re: [Help] /cuff problem - by joeri55 - 07.06.2009, 18:57

Forum Jump:


Users browsing this thread: 1 Guest(s)