28.07.2009, 00:37
At the top:
OnPlayerConnect:
You can edit that however you like, but it will work.
Код:
new PlayerCuffed[MAX_PLAYERS]; new giveplayerid;
Код:
PlayerCuffed[playerid] = 0;
Код:
if(strcmp(cmd, "/cuff", true) == 0) { new sendername[MAX_PLAYERS]; new giveplayer[MAX_PLAYERS]; tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[USAGE:] /cuff [playerid]"); return 1; } giveplayerid = ReturnUser(tmp); if(IsPlayerConnected(giveplayerid)) { if(giveplayerid != INVALID_PLAYER_ID) { if(PlayerCuffed[giveplayerid] == 1) { SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[ERROR:] That person is already cuffed."); return 1; } if (GetDistanceBetweenPlayers(playerid,suspect) < 5)) { if(giveplayerid == playerid) { SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[ERROR:] You can't cuff yourself!"); return 1; } GetPlayerName(playerid, sendername, sizeof(sendername); GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer); format(string, sizeof(string), "Cuffed by %s.", sendername); SendClientMessage(giveplayerid, COLOR_RED, string); format(string, sizeof(string), "%s successfully cuffed.", giveplayer); SendClientMessage(playerid, COLOR_WHITE, string); PlayerPlayerActionMessage(playerid,giveplayerid,15.0,"has just handcuffed"); TogglePlayerControllable(giveplayerid, 0); PlayerCuffed[giveplayerid] = 1; } else { SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[ERROR:] That player is not near you!"); return 1; } } else { SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[ERROR:] Invalid ID."); return 1; } } return 1; }