Not Getting Warning
#1

when i do /warn (id) (reason)

it show

Administrator %s(%d) warns %s(%d) [Reason: %s] [Warnings: 3/] and no number is on other side of 3 there must be a max warning to it

example
Administrator %s(%d) warns %s(%d) [Reason: blah] [Warnings: 1/3]
Administrator %s(%d) warns %s(%d) [Reason: blah] [Warnings: 2/3]
Administrator %s(%d) warns %s(%d) [Reason: blah] [Warnings: 3/3]

here is the code

pawn Код:
CMD:warn(playerid, params[])
{
    new str[128],id, reason[64];
    if(PInfo[playerid][Level] < 1) return SendClientMessage(playerid,red,error);
    if(sscanf(params,"us[64]",id,reason)) return SendClientMessage(playerid,lightgreen,"USAGE: "lyellow2"/warn (id) (reason)");
    if(!IsPlayerConnected(id)) return SendClientMessage(playerid,red,error2);
    if(PInfo[id][Warn] == MAX_WARNINGS)
    {
        format(str, sizeof(str), "%s(%d) has been kicked [Reason: Reach the Maxium Warnings!]", GetPName(id), id);// Line 6084
        SendClientMessageToAll(RED, str);
        SendClientMessage(id, RED, "You've been kicked [Reason: Reach the Maxium Warnings!]");
        SetTimerEx("KickTimer",1000,false,"i",id);
    }
    PInfo[id][Warn] += 1;
    format(str, sizeof(str), "» Administrator %s(%d) warns %s(%d) [Reason: %s] [Warnings: %d/%d]", GetPName(playerid), playerid, GetPName(id), id, reason, MAX_WARNINGS);
    SendClientMessageToAll(yellow, str);
    format(str, sizeof(str), "» You warned %s(%d) [Reason: %s] [Warnings: %d/%d]",GetPName(id), id, reason, MAX_WARNINGS);
    SendClientMessage(playerid, green, str);
    format(str, sizeof(str), "» You've been warned by Administrator %s(%d) [Reason: %s] [Warnings: %d/%d]",GetPName(playerid), playerid, reason, MAX_WARNINGS);
    SendClientMessage(id, red, str);
    return 1;
}
Reply
#2

pawn Код:
format(str, sizeof(str), "» Administrator %s(%d) warns %s(%d) [Reason: %s] [Warnings: %d/%d]", GetPName(playerid), playerid, GetPName(id), id, reason, MAX_WARNINGS);
You are defining the second last with MAX_WARNINGS.
The last one should be with MAX_WARNINGS Too.

Quote:

[Warnings: 3/]

Second 3 isn't defining the sendclientmessage!
Reply
#3

pawn Код:
format(str, sizeof(str), "» Administrator %s(%d) warns %s(%d) [Reason: %s] [Warnings: %d/%d]", GetPName(playerid), playerid, GetPName(id), id, reason, PInfo[id][Warn], MAX_WARNINGS);
You never put PInfo[id][Warn], before the MAX_Warnings therefore it wasn't formatted into the string.
Reply
#4

Код:
format(str, sizeof(str), "» Administrator %s(%d) warns %s(%d) [Reason: %s] [Warnings: %d/%d]", GetPName(playerid), playerid, GetPName(id), id, reason, ADD THIS >> PLAYERINFO[id][pWARNS] << ADD THIS MAX_WARNINGS);
just add that
Reply
#5

hmm the weird
pawn Код:
Administrator %s(%d) warns %s(%d) [Reason: blah] [Warnings: 4/3]


and please help me here too
https://sampforum.blast.hk/showthread.php?tid=533793
Reply
#6

pawn Код:
CMD:warn(playerid, params[])
{
    new str[128],id, reason[64];
    if(PInfo[playerid][Level] < 1) return SendClientMessage(playerid,red,error);
    if(sscanf(params,"us[64]",id,reason)) return SendClientMessage(playerid,lightgreen,"USAGE: "lyellow2"/warn (id) (reason)");
    if(!IsPlayerConnected(id)) return SendClientMessage(playerid,red,error2);
    PInfo[id][Warn] += 1;//Change
    if(PInfo[id][Warn] == MAX_WARNINGS)
    {
        format(str, sizeof(str), "%s(%d) has been kicked [Reason: Reach the Maxium Warnings!]", GetPName(id), id);// Line 6084
        SendClientMessageToAll(RED, str);
        SendClientMessage(id, RED, "You've been kicked [Reason: Reach the Maxium Warnings!]");
        SetTimerEx("KickTimer",1000,false,"i",id);
    }
    format(str, sizeof(str), "» Administrator %s(%d) warns %s(%d) [Reason: %s] [Warnings: %d/%d]", GetPName(playerid), playerid, GetPName(id), id, reason, PInfo[id][Warn], MAX_WARNINGS);
    SendClientMessageToAll(yellow, str);
    format(str, sizeof(str), "» You warned %s(%d) [Reason: %s] [Warnings: %d/%d]",GetPName(id), id, reason, MAX_WARNINGS);
    SendClientMessage(playerid, green, str);
    format(str, sizeof(str), "» You've been warned by Administrator %s(%d) [Reason: %s] [Warnings: %d/%d]",GetPName(playerid), playerid, reason, MAX_WARNINGS);
    SendClientMessage(id, red, str);
    return 1;
}
You had PInfo[id][Warn] += 1; AFTER the check for warnings.
Reply
#7

alright it work thanks

now one more problem is this
https://sampforum.blast.hk/showthread.php?tid=533793
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)