ugly bugs
#1

Uhh... I do so hate them a lot... but I might know the cause of them,

Here is bug no.1

Freeze and Unfreeze cmd:

pawn Код:
CMD:freeze(playerid, params[])
{
    new string[128], name[24];
    if (MasterAccount[playerid][mSuperAdmin] || Character[playerid][cAdminLevel] >= 1)
    GetPlayerName(playerb,name,24);
    if(sscanf(params, "u", playerb)) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "[SYNTAX]: : /freeze [playerid]");
    if(!IsPlayerConnected(playerb)) return SendClientMessage(playerid, COLOR_RED, "[ERROR]: Invalid player id");
    if(IsFrozen[playerb]) return SendClientMessage(playerid, COLOR_RED, "[ERROR]: Player is already frozen.");
    IsFrozen[playerb] = 1;
    format(string,128,"[SUCCESS]: You Have Successfully Frozen Player %s (%d)",name,playerb); // name, id of playerb
    SendClientMessage(playerid,COLOR_LIGHTGREEN -1,string); // sending the above message to the admin
    GetPlayerPos(playerb, FX[playerb], FY[playerb], FZ[playerb]);
    SendClientMessage(playerb, COLOR_RED, "[INFO]: You have been frozen!");
    return 1;
}
CMD:unfreeze(playerid, params[]) //
{
    new string[128], name[24];
    if (MasterAccount[playerid][mSuperAdmin] || Character[playerid][cAdminLevel] >= 1)
    GetPlayerName(playerb,name,24); // getting the name of the target (playerb)
    if(sscanf(params, "u", playerb)) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "[SYNTAX]: /unfreeze [playerid]");
    if(!IsPlayerConnected(playerb)) return SendClientMessage(playerid, COLOR_RED, "[ERROR]: Invalid player id");
    if(!IsFrozen[playerb]) return SendClientMessage(playerid, COLOR_RED, "[ERROR]: Player is not frozen.");
    IsFrozen[playerb] = 0;
    format(string,128,"[SUCCESS]: You Have Successfully Unfrozen Player %s (%d)",name,playerb); // name, id of playerb
    SendClientMessage(playerid,COLOR_LIGHTGREEN -1,string);
    SendClientMessage(playerb, COLOR_RED, "[INFO]: You have been unfrozen!");
    return 1;
}
When ever I freeze someone it says You have Successfully frozen player Norton [1] - ID but it suppose to say the master account name of the one I have frozen basically Norton - me I am freezing id 1 it says ID 1 correctly but it gives wrong name.

When I unfreeze someone it says "This player is not frozen" but he is and he gets unfrozen. I do believe it is the GetPlayerName(name) that causes it because playerb gives the correct ID.

Report command:
pawn Код:
COMMAND:report(playerid,params[]) {
    new
        name1[30],
        name2[30],
        id,
        text[128],
        reason[50];
    if(sscanf(params,"us",id,reason))
        return SendClientMessage(playerid,COLOR_LIGHTBLUE,"[SYNTAX]: /report [id] [reason]");
    if(IsPlayerConnected(id)) {
        SendClientMessage(playerid,COLOR_LIGHTGREEN,"[SUCCESS]: Your report has been sent to the administrators! Please wait.");
        for(new i = 0; i < MAX_PLAYERS; ++i) {
            if(IsPlayerConnected(i) && !IsPlayerNPC(i) && Character[playerid][cAdminLevel] >= 1) {
            GetPlayerName(playerid,name1,sizeof(name1));
            GetPlayerName(id,name2,sizeof(name2));
            new Hour,Minute,Second;
            gettime(Hour,Minute,Second);
            format(text,sizeof(text),"|| %d:%d:%d || [Report] | \"%s\" [%i] has reported \"%s\" [%i], reason: %s.",Hour,Minute,Second,name1,playerid,name2,id,reason);
            SendClientMessage(i,COLOR_GOLD,text);
            ReportLog(text);
        }
        }
    } else {
        return SendClientMessage(playerid,COLOR_RED,"[ERROR]: Invalid ID");
    }
    return 1;
}
Now on this one I am confused, you see player can do /report and it will say to them "[SUCCESS]: Your report has been sent to the administrators! Please wait" but admins dont get it but when I tried to do it as an admin it showed me the report format who reported who but when a normal player did it it never appear.
Could anyone help me out with these bugs, I am not good in killing them...

Thank you.
Reply
#2

In the first command, you're getting the name of player 0, the function sscanf assign the id typed to the variable playerb.
Solution(make it on unfreeze too):
pawn Код:
CMD:freeze(playerid, params[])
{
    new string[128], name[24];
    if (MasterAccount[playerid][mSuperAdmin] || Character[playerid][cAdminLevel] >= 1)    
    if(sscanf(params, "u", playerb)) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "[SYNTAX]: : /freeze [playerid]");
    if(!IsPlayerConnected(playerb)) return SendClientMessage(playerid, COLOR_RED, "[ERROR]: Invalid player id");
    if(IsFrozen[playerb]) return SendClientMessage(playerid, COLOR_RED, "[ERROR]: Player is already frozen.");
    GetPlayerName(playerb,name,24);
    IsFrozen[playerb] = 1;
    format(string,128,"[SUCCESS]: You Have Successfully Frozen Player %s (%d)",name,playerb); // name, id of playerb
    SendClientMessage(playerid,COLOR_LIGHTGREEN -1,string); // sending the above message to the admin
    GetPlayerPos(playerb, FX[playerb], FY[playerb], FZ[playerb]);
    SendClientMessage(playerb, COLOR_RED, "[INFO]: You have been frozen!");
    return 1;
}
Reply
#3

Quote:
Originally Posted by CyNiC
Посмотреть сообщение
In the first command, you're getting the name of player 0, the function sscanf assign the id typed to the variable playerb.
Solution(make it on unfreeze too):
pawn Код:
CMD:freeze(playerid, params[])
{
    new string[128], name[24];
    if (MasterAccount[playerid][mSuperAdmin] || Character[playerid][cAdminLevel] >= 1)    
    if(sscanf(params, "u", playerb)) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "[SYNTAX]: : /freeze [playerid]");
    if(!IsPlayerConnected(playerb)) return SendClientMessage(playerid, COLOR_RED, "[ERROR]: Invalid player id");
    if(IsFrozen[playerb]) return SendClientMessage(playerid, COLOR_RED, "[ERROR]: Player is already frozen.");
    GetPlayerName(playerb,name,24);
    IsFrozen[playerb] = 1;
    format(string,128,"[SUCCESS]: You Have Successfully Frozen Player %s (%d)",name,playerb); // name, id of playerb
    SendClientMessage(playerid,COLOR_LIGHTGREEN -1,string); // sending the above message to the admin
    GetPlayerPos(playerb, FX[playerb], FY[playerb], FZ[playerb]);
    SendClientMessage(playerb, COLOR_RED, "[INFO]: You have been frozen!");
    return 1;
}
wait which line is that
Reply
#4

Alright unfreeze and freeze cmd is fixed but something does not smell good, not admin characters can do /freeze but I have already made that only admins and superadmins can do it aka
pawn Код:
if (MasterAccount[playerid][mSuperAdmin] || Character[playerid][cAdminLevel] >= 1)
and so report is left to fix as well...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)