07.07.2010, 16:07
hi, I want to do in the administrator commands to punish players that the text is not displayed on the screen as the gf has a text only draw
I command dcmd_ban:
On the other maps I cut out the command '/ kick' because there is just such TextDraw (I think)
Well how do each of the controller command, the command that the punishment a player:
I cut it for these features:
and
I command dcmd_ban:
Код:
dcmd_ban(playerid, cmdtext[]) { if(IsPlayerConnected(playerid)) { if(PlayerInfo[playerid][pAdmin] < 1) { ShowPlayerDialog(playerid, 9, 0, "Info", "Nie możesz używać tej komendy", "Ok", ""); return 1; } new string[128]; new giveplayerid; new reason[128]; new sendername[MAX_PLAYER_NAME]; new giveplayer[MAX_PLAYER_NAME]; GetPlayerName(playerid, sendername, sizeof(sendername)); UnderscoreToSpace(sendername); if (sscanf(cmdtext, "us", giveplayerid, reason)) return CRP(playerid, "UŻYJ: /ban [id/ImięLubNazwisko] [powуd]"), 1; GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer)); UnderscoreToSpace(giveplayer); format(string, sizeof(string), "%s został zbanowany przez administratora %s, powуd: %s", giveplayer, sendername, (reason)); CRPInfo(playerid, string); Ban(giveplayerid); } return 1; }
Код:
if(strcmp(cmd, "/kick", true) == 0) { if(IsPlayerConnected(playerid)) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_GRAD2, "WPISZ: /kick [ID/NICK] [POWOD]"); return 1; } giveplayerid = ReturnUser(tmp); if (PlayerInfo[playerid][pAdmin] >= 1) { if(IsPlayerConnected(giveplayerid)) { if(giveplayerid != INVALID_PLAYER_ID) { GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));UnderscoreToSpace(giveplayer); GetPlayerName(playerid, sendername, sizeof(sendername));UnderscoreToSpace(sendername); new length = strlen(cmdtext); while ((idx < length) && (cmdtext[idx] <= ' ')) { idx++; } new offset = idx; new result[64]; while ((idx < length) && ((idx - offset) < (sizeof(result) - 1))) { result[idx - offset] = cmdtext[idx]; idx++; } result[idx - offset] = EOS; if(!strlen(result)) { SendClientMessage(playerid, COLOR_GRAD2, "WPISZ: /kick [ID/NICK] [POWOD]"); return 1; } OnPlayerUpdate(giveplayerid); new year, month,day; getdate(year, month, day); format(string, sizeof(string), "~r~Kick~n~~w~Ukarany: %s~n~Nadal: %s~n~Powod: ~r~%s", giveplayer, sendername, (result)); TextDrawSetString(Textdraw3, string); SetTimerEx("textkara", 10000, 0, "d", playerid); TextDrawShowForAll(Textdraw3); KickLog(string); Kick(giveplayerid); return 1; } } else { SendClientMessage(playerid, COLOR_GRAD1, "Nie ma takiego gracza!"); } } else { SendClientMessage(playerid, COLOR_GRAD1, "Nie jestes adminem!"); } } return 1; }
Код:
format(string, sizeof(string), "~r~Kick~n~~w~Ukarany: %s~n~Nadal: %s~n~Powod: ~r~%s", giveplayer, sendername, (result));
Код:
forward textkara(idplayer);
Код:
public textkara(idplayer) { TextDrawHideForAll(Textdraw3); return 1; }