13.02.2010, 05:30
Ok, so i got this /warn command that gives players warns now what my question is, How does it save it to the players? Like i'm trying to make it so it saves the reason of the warn also instead of just the amount of warns so when an admin types /getwarning it shows how many warns they have and the reason for those warns, How does it save it tho is what i wanna know
pawn Код:
if(strcmp(cmd, "/warn", true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /warn [playerid/PartOfName] [reason]");
return 1;
}
if(IsStringAName(tmp))
{
giveplayerid = GetPlayerID(tmp);
}
else
{
giveplayerid = strval(tmp);
}
if ((IsPlayerAdmin(playerid)) || PlayerInfo[playerid][pAdmin] >= 6)
{
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(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, "USAGE: /warn [playerid/PartOfName] [reason]");
return 1;
}
if(Warning[giveplayerid] == 3)
{
format(string, sizeof(string), "You warned %s, reason: %s,this was his final warning, now he's banned", giveplayer, (result));
SendClientMessage(playerid, COLOR_RED, string);
format(string, sizeof(string), "You were warned by %s, reason: %s, this was your last warning, now you'r banned", sendername, (result));
SendClientMessage(giveplayerid, COLOR_RED, string);
format(string, sizeof(string), "***Admin %s warned player %s (id: %d) and he was banned. Reason: %s ***", sendername, giveplayer, giveplayerid, tmp);
ABroadCast(COLOR_YELLOW, string,1);
Ban(giveplayerid);
}
if(Warning[giveplayerid] == 2)
{
format(string, sizeof(string), "You warned %s, reason: %s, it is his final warning(3/3)", giveplayer, (result));
SendClientMessage(playerid, COLOR_RED, string);
format(string, sizeof(string), "You were warned by %s, reason: %s, this is your last warning (3/3)", sendername, (result));
SendClientMessage(giveplayerid, COLOR_RED, string);
format(string, sizeof(string), "***Admin %s warned player %s (id: %d) (3/3). Reason: %s ***", sendername, giveplayer, giveplayerid, tmp);
ABroadCast(COLOR_YELLOW, string,1);
Warning[giveplayerid] = 3;
}
if(Warning[giveplayerid] == 1)
{
format(string, sizeof(string), "You warned %s, reason: %s, it is his 2nd warning (2/3)", giveplayer, (result));
SendClientMessage(playerid, COLOR_RED, string);
format(string, sizeof(string), "You were warned by %s, reason: %s, this is your second warning (2/3)", sendername, (result));
SendClientMessage(giveplayerid, COLOR_RED, string);
format(string, sizeof(string), "***Admin %s warned player %s (id: %d) (2/3). Reason: %s ***", sendername, giveplayer, giveplayerid, tmp);
ABroadCast(COLOR_YELLOW, string,1);
Warning[giveplayerid] = 2;
}
if(Warning[giveplayerid] == 0)
{
format(string, sizeof(string), "You warned %s, reason: %s, it is his 1st warning (1/3)", giveplayer, (result));
SendClientMessage(playerid, COLOR_RED, string);
format(string, sizeof(string), "You were warned by %s, reason: %s, this is your first warning (1/3)", sendername, (result));
SendClientMessage(giveplayerid, COLOR_RED, string);
format(string, sizeof(string), "***Admin %s warned player %s (id: %d) (1/3). Reason: %s ***", sendername, giveplayer, giveplayerid, (result));
ABroadCast(COLOR_YELLOW, string,1);
Warning[giveplayerid] = 1;
}
return 1;
}
}
format(string, sizeof(string), " %d is not an active player.", giveplayerid);
SendClientMessage(playerid, COLOR_GRAD1, string);
}
else
{
format(string, sizeof(string), " You are not authorised to use that command!");
SendClientMessage(playerid, COLOR_GRAD1, string);
}
}
return 1;
}