SA-MP Forums Archive
Redefining something.. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Redefining something.. (/showthread.php?tid=495757)



Redefining something.. - SnL - 18.02.2014

I'm doing something like this ( example )

pawn Код:
#define SOMETHING 1
#define SOMETHING2 2

static result[MAX_PLAYERS];

public OnPlayerRequestClass(playerid,classid)
{
    switch(GetPlayerSkin(playerid))
    {
        case 9:result[playerid] = SOMETHING;
    case 10:result[playerid] = SOMETHING;
    case 11:result[playerid] = SOMETHING;
    case 12:result[playerid] = SOMETHING;
        default:result[playerid] = SOMETHING2;
    }
    return 1;
}

public OnPlayerSpawn(playerid)
{
    new string[45];
    format(string,sizeof string,"Your skin is %s",result);
    SendClientMessage(playerid,-1,string);
    return 1;
}
But it says Your skin is
And no more... then i change %s ti %d and it says Your skin is 1 or 2 , but i want that it says
Your skin is SOMETHING
or
Your skin is SOMETHING2

->I don't want numbers i want the word <-

Sorry bad english


Re: Redefining something.. - [D]ry[D]esert - 18.02.2014

You mean something like
pawn Код:
#define SOMETHING "This is something number 1"
not sure if that what you mean


Re: Redefining something.. - SnL - 18.02.2014

Umm yes i tried it but i'm giving a value to each case so it gave me errors...


Re: Redefining something.. - [D]ry[D]esert - 18.02.2014

i think in this case, you'll have to use enum.
EDIT:
Example:
pawn Код:
enum skins_
{
    skinname[10],
    skinid
}
new skins[][skins_] =
{
    {"CJ skin"/*Skin name*/,0/*Skinid*/}
     
   
};
new pskin[MAX_PLAYERS][skins];



Re: Redefining something.. - Ada32 - 18.02.2014

Quote:
Originally Posted by [D]ry[D]esert
Посмотреть сообщение
i think in this case, you'll have to use enum.
enums don't do what you think they do..


Re: Redefining something.. - SnL - 18.02.2014

Nice example but i want an example to use it ( example a format / message)


Re: Redefining something.. - [D]ry[D]esert - 18.02.2014

Quote:
Originally Posted by Ada32
Посмотреть сообщение
enums don't do what you think they do..
ehum ? what do you mean lol, then say how to do that? i know there are many ways to do it, but im completely lazy to make..