22.02.2015, 16:45
(
Последний раз редактировалось zork; 22.02.2015 в 18:05.
)
Hey!
I got the following command:
It all works fine but it keeps adding (+1) to the targetid's adminwarnings. Example: /awarn 0 keeps warning him and his pAdminWarns goes up by +1.
As stated in the end, it doesn't demote him if he's about to get his 3rd. I can warn him up to 100.
Problem #2:
I got the stated command but when I do /me text it displays "USAGE: /me [action]". It doesn't work at all, it reads it like I've no text.
I can't seem to figure it out what's the problem.
Thanks!
I got the following command:
Код:
CMD:awarn( playerid, cmdtext[] ) {
new targetid,
string[128];
if(PlayerInfo[playerid][pAdmin] < 6)
return SendClientMessage(playerid, COLOR_RED, "SERVER: You can't use this command.");
if(sscanf(cmdtext, "u", targetid))
return SendClientMessage(playerid, COLOR_RED, "USAGE: /awarn [admin]");
if(!IsPlayerConnected(targetid) || PlayerInfo[targetid][pAdmin] == 0)
return SendClientMessage(playerid, COLOR_RED, "SERVER: Playerid is not an active ID or playerid is NOT an admin!");
if(PlayerInfo[playerid][pAdmin] >= 1) {
PlayerInfo[playerid][pAdminWarns] = PlayerInfo[playerid][pAdminWarns] + 1;
format(string, sizeof(string), "AdmWarning: %s has warned admin %s (Warn: #%d)", GetOOCName(playerid), GetOOCName(targetid), PlayerInfo[targetid][pAdminWarns]);
SendMessageToAdmins(COLOR_RED, string, 1);
printf("AdmWarning: %s has warned admin %s (Warn: #%d)", GetOOCName(playerid), GetOOCName(targetid), PlayerInfo[targetid][pAdminWarns]);
return 1;
}
else if(PlayerInfo[targetid][pAdminWarns] == 2)
{
PlayerInfo[targetid][pAdminWarns] = 0;
PlayerInfo[targetid][pAdmin] = PlayerInfo[playerid][pAdmin] - 1;
format(string, sizeof(string), "AdmWarning: %s has been demoted by 1 level by SYSTEM because he had gathered 3 admin warnings!", GetOOCName(targetid));
SendMessageToAdmins(COLOR_RED, string, 1);
printf("AdmWarning: %s was demoted by 1 level by SYSTEM because he had had gathered 3 admin warnings", GetOOCName(targetid));
return 1;
}
return 0;
}
As stated in the end, it doesn't demote him if he's about to get his 3rd. I can warn him up to 100.
Problem #2:
Код:
CMD:me( playerid, cmdtext[] ) {
if(IsPlayerConnected(playerid))
{
new message[128],
string[128];
if(sscanf(cmdtext, "s[126]", message)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /me [action]");
format(string, sizeof(string), "* %s %s", GetICName(playerid), message);
SendNearByMessage(playerid, COLOR_INDIGO, string, 10);
return 1;
} else {
SendClientMessage(playerid, COLOR_RED, "SERVER: You are not connected yet.");
}
return 0;
}
I can't seem to figure it out what's the problem.
Thanks!

