CMD doesnt work..
#1

pawn Код:
CMD:report(playerid,params[])
{
    new id, reason[35], string[128], sendername[MAX_PLAYER_NAME], name[MAX_PLAYER_NAME];
    if(sscanf(params,"uz", id, reason)) return SendClientMessage(playerid, lb,"USAGE: /report [playerid/partofname] [reason]");
    if(!IsPlayerConnected(id)) return SendClientMessage(playerid, red,"Invalid player ID");
    else
    {
        GetPlayerName(id, name,sizeof(name));
        GetPlayerName(playerid, sendername, sizeof(sendername));
        sendername[strfind(sendername,"_")] = ' ';
        format(string, sizeof(string), "[ID:%d] %s has reported %s: %s.", playerid, sendername, name, reason);
        ABroadCast(yel,string,1);
        format(string, sizeof(string), "Use /markfalse [id] or /acceptreport [id]");
        ABroadCast(yel,string,1);
        format(string, sizeof(string), "Your report was just send to the online admins, please wait for a reply");
        SendClientMessage(playerid,COLOR_ORANGE,string);
        PlayerNeedsHelp[playerid] = 1;
        return 1;
    }
}
it just says unkown command.
Reply
#2

EDIT: I was wrong.. solution already posted below.
Reply
#3

pawn Код:
CMD:report(playerid,params[])
{
    new id, reason[35], string[128], sendername[MAX_PLAYER_NAME], name[MAX_PLAYER_NAME];
    if(sscanf(params,"uz", id, reason)) return SendClientMessage(playerid, lb,"USAGE: /report [playerid/partofname] [reason]");
    if(!IsPlayerConnected(id)) return SendClientMessage(playerid, red,"Invalid player ID");
    GetPlayerName(id, name,sizeof(name));
    GetPlayerName(playerid, sendername, sizeof(sendername));
    sendername[strfind(sendername,"_")] = ' ';
    format(string, sizeof(string), "[ID:%d] %s has reported %s: %s.", playerid, sendername, name, reason);
    ABroadCast(yel,string,1);
    format(string, sizeof(string), "Use /markfalse [id] or /acceptreport [id]");
    ABroadCast(yel,string,1);
    format(string, sizeof(string), "Your report was just send to the online admins, please wait for a reply");
    SendClientMessage(playerid,COLOR_ORANGE,string);
    PlayerNeedsHelp[playerid] = 1;
    return 1;
}
Reply
#4

pawn Код:
CMD:report(playerid,params[])
{
    new id, reason[35], string[128], sendername[MAX_PLAYER_NAME], name[MAX_PLAYER_NAME];
    if(sscanf(params,"uz", id, reason)) return SendClientMessage(playerid, lb,"USAGE: /report [playerid/partofname] [reason]");
    if(!IsPlayerConnected(id)) return SendClientMessage(playerid, red,"Invalid player ID");
    else
    {
        GetPlayerName(id, name,sizeof(name));
        GetPlayerName(playerid, sendername, sizeof(sendername));
        sendername[strfind(sendername,"_")] = ' ';
        format(string, sizeof(string), "[ID:%d] %s has reported %s: %s.", playerid, sendername, name, reason);
        ABroadCast(yel,string,1);
        format(string, sizeof(string), "Use /markfalse [id] or /acceptreport [id]");
        ABroadCast(yel,string,1);
        format(string, sizeof(string), "Your report was just send to the online admins, please wait for a reply");
        SendClientMessage(playerid,COLOR_ORANGE,string);
        PlayerNeedsHelp[playerid] = 1;
        return 1;
    }
    return 1;
}
That will work i believe

EDIT: i guess i am late to post, the above poster wrote the correct code
Reply
#5

can u tell me what was the problem please?
Reply
#6

The problem was...
You didn't returned the value of command.
pawn Код:
return 1;
Read the green text
pawn Код:
CMD:report(playerid,params[])
{
    new id, reason[35], string[128], sendername[MAX_PLAYER_NAME], name[MAX_PLAYER_NAME];
    if(sscanf(params,"uz", id, reason)) return SendClientMessage(playerid, lb,"USAGE: /report [playerid/partofname] [reason]");
    if(!IsPlayerConnected(id)) return SendClientMessage(playerid, red,"Invalid player ID");
    else
    {
        GetPlayerName(id, name,sizeof(name));
        GetPlayerName(playerid, sendername, sizeof(sendername));
        sendername[strfind(sendername,"_")] = ' ';
        format(string, sizeof(string), "[ID:%d] %s has reported %s: %s.", playerid, sendername, name, reason);
        ABroadCast(yel,string,1);
        format(string, sizeof(string), "Use /markfalse [id] or /acceptreport [id]");
        ABroadCast(yel,string,1);
        format(string, sizeof(string), "Your report was just send to the online admins, please wait for a reply");
        SendClientMessage(playerid,COLOR_ORANGE,string);
        PlayerNeedsHelp[playerid] = 1;
        return 1; //You just returned the value of above code.. not WHOLE command so,
    }
   return 1; //You need to put 'return 1;' 1 = true here before 1 ending brace
}
Reply
#7

thanks ! +rep
Reply
#8

ahh damn .. i tryed the 2 options and it still doesnt work ..
Reply
#9

Well.. dude.. i got your problem then ..

Do you have sscanf plugin? . .show me your server_log.txt
Reply
#10

Код:
[18:06:55] sscanf warning: 'z' is deprecated, consider using 'S' instead.
[18:06:55] sscanf warning: No default value found.
[18:06:55] sscanf warning: Strings without a length are deprecated, please add a destination size.
[18:07:01] sscanf warning: 'z' is deprecated, consider using 'S' instead.
[18:07:01] sscanf warning: No default value found.
[18:07:01] sscanf warning: Strings without a length are deprecated, please add a destination size.
[18:07:05] sscanf warning: 'z' is deprecated, consider using 'S' instead.
[18:07:05] sscanf warning: No default value found.
[18:07:05] sscanf warning: Strings without a length are deprecated, please add a destination size.
change z to s?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)