CMD:kick(playerid,params[]) { new id,string[128],PlayerName[MAX_PLAYER_NAME],reason[100]; if(PlayerInfo[playerid][pAdmin] < 1) return SCM(playerid, -1,"{FF0000}You are not authorized to use this command."); if(sscanf(params,"us[100]",id,reason)) return SCM(playerid, -1,"{FF0000}/kick [ID]"); GetPlayerName(playerid, PlayerName,sizeof(PlayerName)); if(id == INVALID_PLAYER_ID) return SCM(playerid, -1,"{FF0000}Player is not connected."); if(playerid == id) return SCM(playerid, -1,"{FF0000}You cannot kick yourself,fool"); format(string,sizeof(string),"{FF0000}Player %s has been kicked by Admin %s for %s",PlayerName,PlayerName,reason); SendClientMessageToAll(COL_WHITE,string); Kick(id); return 1; }
pwn(494) : error 035: argument type mismatch (argument 1)
SendClientMessageToAll(COL_WHITE,string);
CMD:admins(playerid,params[]) { new admin = 0; new string[128]; new PlayerName[28]; GetPlayerName(playerid, PlayerName, 28); admin++; for(new i = 0; i < MAX_PLAYERS; i++) { if(PlayerInfo[i][pAdmin] > 0) { format(string,sizeof(string),"The following admin(s) are currently online:\nName: %s Level: %d ID: %i\n",PlayerName,PlayerInfo[i][pAdmin],i); ShowPlayerDialog(playerid,1,DIALOG_STYLE_MSGBOX,"Online Admins",string,"Okay","Close"); return 1; } } }
Did it not compile well?
EDIT:This is also a problem of mine,/admins shows only for my level and when i set the other player's level,it shows for himself and not for both. Код:
CMD:admins(playerid,params[]) { new admin = 0; new string[128]; new PlayerName[28]; GetPlayerName(playerid, PlayerName, 28); admin++; for(new i = 0; i < MAX_PLAYERS; i++) { if(PlayerInfo[i][pAdmin] > 0) { format(string,sizeof(string),"The following admin(s) are currently online:\nName: %s Level: %d ID: %i\n",PlayerName,PlayerInfo[i][pAdmin],i); ShowPlayerDialog(playerid,1,DIALOG_STYLE_MSGBOX,"Online Admins",string,"Okay","Close"); return 1; } } } |
CMD:admins(playerid,params[])
{
new admin = 0;
new string[128];
new PlayerName[24];
GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(PlayerInfo[i][pAdmin] > 0)
{
admin++;
format(string,sizeof(string),"The following admin(s) are currently online:\n%sName: %s Level: %d ID: %i\n",string, PlayerName,PlayerInfo[i][pAdmin],i);
ShowPlayerDialog(playerid,1,DIALOG_STYLE_MSGBOX,"Online Admins",string,"Okay","Close");
return 1;
}
}
}
pawn Код:
|
CMD:admin(playerid, params[])
{
new string[512], admin[126], pName[MAX_PLAYER_NAME]; // Edit this to the size you'll prefer and based on how much you think you need
format(string, sizeof(string), "Administrators Online:\n\n"); // Title of your dialog
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(PlayerInfo[i][pAdmin] > 0) // For each player, check if they're an administrator
{
GetPlayerName(i, pName, sizeof(pName)); // Get the administrators name
format(admin, sizeof(admin), "Name: %s | Level: %d\n", pName, PlayerInfo[i][pAdmin]);
strcat(string, admin); // Attach the formatted text to the string
}
}
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_MSGBOX, "Administrators", string, "Close", "");
return 1;
}
That would attempt to create a dialog for each administrator, wouldn't it? (edit: Noticed you had a return; that will only show the first administrator it finds, yes?)
This might be sloppy written, but I'm in a bit of a hurry so here's something you can try, OP: pawn Код:
|
//Use this to start the timer to kick the player, thus showing the message before kicking them.
forward kickplayer(playerid);
public kickplayer(playerid)
{
Kick(playerid);
return 1;
}
CMD:kick(playerid,params[])
{
new id,string[128],PlayerName[MAX_PLAYER_NAME],TargetName[MAX_PLAYER_NAME],reason[100];//Added TargetName[MAX_PLAYER_NAME] to hold the name of the player (id).
if(PlayerInfo[playerid][pAdmin] < 1) return SCM(playerid, -1,"{FF0000}You are not authorized to use this command.");
if(sscanf(params,"us[100]",id,reason)) return SCM(playerid, -1,"{FF0000}/kick [ID] [reason]");
if(id == INVALID_PLAYER_ID || !IsPlayerConnected(id))) return SCM(playerid, -1,"{FF0000}Player is not connected.");
if(playerid == id) return SCM(playerid, -1,"{FF0000}You cannot kick yourself,fool");
GetPlayerName(playerid, PlayerName,sizeof(PlayerName));
GetPlayerName(id,TargetName,sizeof(TargetName));//Added this to get the name of the player kicked.
format(string,sizeof(string),"{FF0000}Player %s has been kicked by Admin %s for %s",TargetName,PlayerName,reason);
SendClientMessageToAll(COL_WHITE,string);
SetTimerEx("kickplayer", 1000, false, "i", id);//This is the timer used to kick the player so they will see the string above.
return 1;
}
//try this