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;
}
Ok, I got it to where it saves to player account. I have another question tho. it's set up to where an admin warns someone the admin give a reason before warning. I'm curious of how i would go about saving the reason to player account
How would i set the /warn command to save the warning to those in player account.
So for example a admin types /getwarning and it shows how many warns they have then below that it gives the reason of the warn so an admin type
/warn [playerid] Deathmatching and for warning 2 /warn [playerid] Carkilling and for 3rd warn /warn [playerid] Flaming Admin and on the fourth they get autobanned
No one has anything? Dang i was hoping i could get a little help with this.