Couple of errors.
#1

I'm not sure what to do here, but I guess you guys can help.

I wrote this line of code by myself, after using Y_INI login/register tutorial.

pawn Код:
enum PlayerInfo
{
    Pass[129],
    Adminlevel,
    VIPlevel,
    Money,
    Scores,
    Kills,
    Deaths
}


new pInfo[MAX_PLAYERS][PlayerInfo];

CMD:skin(playerid, params[])
{
  new string[128], skinid;
  if (pInfo[playerid][VIPLevel] >= 1)
  {
        if(sscanf(params, "d", skinid)
        {
            SendClientMessage(playerid, COLOR_LIGHTBLUE, "USAGE: /skin [skinID]");
        }
        else
        {
            SetPlayerSkin(playerid, skinid);
            format(string, sizeof(string), "You have set your skin ID to %d", skinid);
            SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
        }
        else
        {
        SendClientMessage(playerid, COLOR_GOLD, "Only Donators can use this command!");
        }
  }
  return 1;
}
I don't know what's wrong.
Код:
C:\Program Files (x86)\GTA San Andreas\SAMP\SA-MP Server\gamemodes\rdm.pwn(202) : error 017: undefined symbol "VIPLevel"
C:\Program Files (x86)\GTA San Andreas\SAMP\SA-MP Server\gamemodes\rdm.pwn(205) : error 001: expected token: ")", but found "{"
C:\Program Files (x86)\GTA San Andreas\SAMP\SA-MP Server\gamemodes\rdm.pwn(214) : error 029: invalid expression, assumed zero
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


3 Errors.
Reply
#2

Variables are case sensitive, you've named/used them inconsistently. VIPlevel or VIPLevel?

if(sscanf(params, "d", skinid) should have 2 closing brackets.
Reply
#3

Quote:
Originally Posted by PrivatioBoni
Посмотреть сообщение
Variables are case sensitive, you've named/used them inconsistently. VIPlevel or VIPLevel?

if(sscanf(params, "d", skinid) should have 2 closing brackets.
And.. you just proved how stupid I am. How could I miss that.

I still got
Код:
C:\Program Files (x86)\GTA San Andreas\SAMP\SA-MP Server\gamemodes\rdm.pwn(214) : error 029: invalid expression, assumed zero
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Which is related to the second "else", I think I should change how the first "if" works, right?
Reply
#4

And you also forgot to close a bracket and use the "else" statement for the VIP level. It was like using "else" twice in a row.

pawn Код:
CMD:skin(playerid, params[])
{
    if (pInfo[playerid][VIPlevel] < 1) return SendClientMessage(playerid, COLOR_GOLD, "Only Donators can use this command!");
    new skinid;
    if(sscanf(params, "d", skinid)) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "USAGE: /skin [skinID]");
    SetPlayerSkin(playerid, skinid);
    new string[33];
    format(string, sizeof(string), "You have set your skin ID to %d", skinid);
    SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
    return 1;
}
Reply
#5

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
And you also forgot to close a bracket and use the "else" statement for the VIP level. It was like using "else" twice in a row.

pawn Код:
CMD:skin(playerid, params[])
{
    if (pInfo[playerid][VIPlevel] < 1) return SendClientMessage(playerid, COLOR_GOLD, "Only Donators can use this command!");
    new skinid;
    if(sscanf(params, "d", skinid)) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "USAGE: /skin [skinID]");
    SetPlayerSkin(playerid, skinid);
    new string[33];
    format(string, sizeof(string), "You have set your skin ID to %d", skinid);
    SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
    return 1;
}
Thanks a lot!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)