Help please
#1

Hey all.
Why does the gametext show above every skin and not just 280 281 and 282?

pawn Код:
new v = GetPlayerSkin(playerid);

    if(v == 280||281||282)
    {
        GameTextForPlayer(playerid,"Cops",1500,4);
    }
Reply
#2

Try this.

pawn Код:
new v = GetPlayerSkin(playerid);

    switch(v)
    {
        case 280 .. 282: GameTextForPlayer(playerid,"Cops",1500,4);
        default: return 0;
    }
Reply
#3

pawn Код:
if(v == 280 || v == 281 || v == 282)
If you have lots of skins like this, it would be best to do this:

pawn Код:
switch(GetPlayerSkin(playerid))
{
    case 0: GameTextForPlayer(...); // Shows if skin is 0
    case 1: GameTextForPlayer(...); // Shows if skin is 1
    case 2, 3, 4, 5: GameTextForPlayer(...); // Shows if skin is 2, 3, 4 or 5
    case 6 .. 10: GameTextForPlayer(...); // Shows if skin is 6, 7, 8, 9 or 10
    case 11: GameTextForPlayer(...); // Shows if skin is 11
}
Reply
#4

Quote:
Originally Posted by MP2
Посмотреть сообщение
pawn Код:
if(v == 280 || v == 281 || v == 282)
If you have lots of skins like this, it would be best to do this:

pawn Код:
switch(GetPlayerSkin(playerid))
{
    case 0: GameTextForPlayer(...); // Shows if skin is 0
    case 1: GameTextForPlayer(...); // Shows if skin is 1
    case 2, 3, 4, 5: GameTextForPlayer(...); // Shows if skin is 2, 3, 4 or 5
    case 6 .. 10: GameTextForPlayer(...); // Shows if skin is 6, 7, 8, 9 or 10
    case 11: GameTextForPlayer(...); // Shows if skin is 11
}
Beat ya to it.
Reply
#5

Thanks both. Works perfect.
Reply
#6

Quote:
Originally Posted by Schurman
Посмотреть сообщение
Beat ya to it.
Quote:
Originally Posted by MP2
Посмотреть сообщение
Fucking post limit :<
Were those really needed ?

Anyways, remember:

If you want to add more things other than GameTextForPlayer, like SendClientMessage, ApplyAnim, variables, etc... you would have to do:

pawn Код:
switch(GetPlayerSkin(playerid))
{
    case 0:
    {
        GameTextForPlayer(...);
        // sendclientmessage
        // applyanim
        // etc
    }
    case 1: GameTextForPlayer(...); // Shows if skin is 1
    case 2, 3, 4, 5: GameTextForPlayer(...); // Shows if skin is 2, 3, 4 or 5
    case 6 .. 10: GameTextForPlayer(...); // Shows if skin is 6, 7, 8, 9 or 10
    case 11: GameTextForPlayer(...); // Shows if skin is 11
}
Not all need to have text/animations though.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)