07.06.2009, 18:39
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;
}
Please don't just copy and paste this code. LEARN from it. I will check this thread to answer any questions you have.