#1

pawn Код:
#include <a_samp>
#include <zcmd>
#include <sscanf>

enum vInfo
{
    Vip
}
new Vips[MAX_PLAYERS][vInfo];

//==========================/VIP================================================

CMD:setvip(playerid, params[])
{
    new ID, Level, string[128], name[MAX_PLAYER_NAME], pname[MAX_PLAYER_NAME];
    if(sscanf(params,"ui", ID, Level)) return SendClientMessage(playerid, -1, "{FF0000}Folosire: {FFFFFF}/SetVip [ID] [Nivel]");
    if(IsPlayerConnected(ID)) return SendClientMessage(playerid, -1, "{FF0000}EROARE: {FFFFFF}Jucătorul nu este conectat.");
    if(Level > 3) return SendClientMessage(playerid, -1, "{FF0000}EROARE: {FFFFFF}Nivel invalid. [1-3]");
    if(Vips[ID][Vip] == Level) return SendClientMessage(playerid, -1, "{FF0000}EROARE: {FFFFFF}Jucătorul are deja nivelul acela de {FF0000}VIP {FFFFFF}.");
    GetPlayerName(playerid, name, sizeof(name));
    GetPlayerName(ID, pname, sizeof(pname));
    format(string, sizeof(string), "{FF0000}[INFO]: {FFFFFF}Ai fost făcut de către {FF0000}%s {FFFFFF}nivel: {FF0000}%i {FFFFFF}de VIP.", name, Level);
    SendClientMessage(ID, -1, string);
    format(string, sizeof(string), "{FF0000}[INFO]: {FFFFFF}L-ai făcut pe {FF0000}%s {FFFFFF}nivel: {FF0000}%i {FFFFFF}de VIP.", pname, Level);
    SendClientMessage(playerid, -1, string);
    Vips[ID][Vip] = Level;
    return 1;
}
No errors when I compile, but when I enter In-Game, I type /SetVip, it shows me correct usage, but then says: "Unknown Command", there's something wrong in script?
Reply
#2

Don't you think its cause of this if(sscanf(params,"ui", ID, Level)) return SendClientMessage

SendClientMessage is on the same line

I don't know much about pawno but im 35% sure this is the error
Reply
#3

No.

pawn Код:
if(sscanf(params, "ui", ID, Level)) return SendClientMessage(....)
It's same with:

pawn Код:
if(sscanf(params, "ui", ID, Level))
{
    SendClientMessage(....)
    return 1;
}
But thanks for reply. Any other suggestions?
Reply
#4

Quote:
Originally Posted by ViperAssasin11
Посмотреть сообщение
Don't you think its cause of this if(sscanf(params,"ui", ID, Level)) return SendClientMessage

SendClientMessage is on the same line

I don't know much about pawno but im 35% sure this is the error
Nope, you just forgot a "!" before IsPlayerConnected.
Reply
#5

Try this:

pawn Код:
CMD:setvip(playerid, params[])
{
    new ID, Level, string[128], name[MAX_PLAYER_NAME], pname[MAX_PLAYER_NAME];
    if(sscanf(params,"ui", ID, Level)) return SendClientMessage(playerid, -1, "{FF0000}Folosire: {FFFFFF}/SetVip [ID] [Nivel]");
    else if(IsPlayerConnected(ID)) return SendClientMessage(playerid, -1, "{FF0000}EROARE: {FFFFFF}Jucătorul nu este conectat.");
    else if(Level > 3) return SendClientMessage(playerid, -1, "{FF0000}EROARE: {FFFFFF}Nivel invalid. [1-3]");
    else if(Vips[ID][Vip] == Level) return SendClientMessage(playerid, -1, "{FF0000}EROARE: {FFFFFF}Jucătorul are deja nivelul acela de {FF0000}VIP {FFFFFF}.");
    else {
        GetPlayerName(playerid, name, sizeof(name));
        GetPlayerName(ID, pname, sizeof(pname));
        format(string, sizeof(string), "{FF0000}[INFO]: {FFFFFF}Ai fost făcut de către {FF0000}%s {FFFFFF}nivel: {FF0000}%i {FFFFFF}de VIP.", name, Level);
        SendClientMessage(ID, -1, string);
        format(string, sizeof(string), "{FF0000}[INFO]: {FFFFFF}L-ai făcut pe {FF0000}%s {FFFFFF}nivel: {FF0000}%i {FFFFFF}de VIP.", pname, Level);
        SendClientMessage(playerid, -1, string);
        Vips[ID][Vip] = Level;
    }
    return 1;
}
Make sure you have deleted OnPlayerCommandText.

Quote:
Originally Posted by Flori
Посмотреть сообщение
Nope, you just forgot a "!" before IsPlayerConnected.
If he adds ! (Which you should do btw) it'll return this:
pawn Код:
return SendClientMessage(playerid, -1, "{FF0000}EROARE: {FFFFFF}Jucătorul nu este conectat.");
and not 'SERVER:Unknown Message' like he said.
Reply
#6

@Flori,

Oh, thanks. I'm so clumsy.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)