Is there a quicker way?
#1

pawn Код:
if(skin != 71 || skin != 280 || skin != 281 || skin != 282 || skin != 284 || skin != 285)
Is there a quicker way of doing this? Also im not actually sure if this would work ? because if you choose skin 284 for example then the skin is not equal to any other id's so would it return an error?
Reply
#2

I think for what you want, you'll have to replace the || with the &&.
quicker way would be an array, I guess..
Reply
#3

Quote:
Originally Posted by Mike_Peterson
Посмотреть сообщение
I think for what you want, you'll have to replace the || with the &&.
quicker way would be an array, I guess..
Thank you
Also maybe you will know whats wrong here?

pawn Код:
case 0: // PCSO // nothing
                {
                    if(FacInfo[playerid][fRank1] == 1)
                    SetPlayerSkin(playerid, 71);
                    format(string, sizeof(string), "* %s puts on their community support clothing.", RPN(playerid));
                    SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
                }
                case 1: // Warrented Officer // Baton + Spray
                {
                    if(FacInfo[playerid][fRank1] >= 1) return SendClientMessage(playerid, COLOR_GREY, "You're not a high enough rank!");
                    GiveZaiatWeapon(playerid, 3, 1);
                    GiveZaiatWeapon(playerid, 41, 1000);
                    SetPlayerSkin(playerid, 280);
                    format(string, sizeof(string), "* %s grabs a Baton and CS Spray from their locker.", RPN(playerid));
                    SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
                }
It sets them a warrented officer skin(280), However it doesn't set them the PCSO skin? (71)
Reply
#4

Must be that FacInfo[playerid][fRank1] aint 1.
Reply
#5

pawn Код:
case 0: // PCSO // nothing
                {
                    if(FacInfo[playerid][fRank1] == 1)
                    {
                    SetPlayerSkin(playerid, 71);
                    format(string, sizeof(string), "* %s puts on their community support clothing.", RPN(playerid));
                    SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
                    }
                }
                case 1: // Warrented Officer // Baton + Spray
                {
                    if(FacInfo[playerid][fRank1] <= 1) return SendClientMessage(playerid, COLOR_GREY, "You're not a high enough rank!");
                    {
                    GiveZaiatWeapon(playerid, 3, 1);
                    GiveZaiatWeapon(playerid, 41, 1000);
                    SetPlayerSkin(playerid, 280);
                    format(string, sizeof(string), "* %s grabs a Baton and CS Spray from their locker.", RPN(playerid));
                    SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
                }
                }
Reply
#6

case 1 is strange.
if player fRank1 is equal or higher than 1, return message 'not high enough rank'?

edit: DarkRain's case 0 is correct, you missed the brackets at the if check.
but his case 1 is incorrect, since the if check is directly followed by a return statement.
Reply
#7

Quote:
Originally Posted by Lz
Посмотреть сообщение
Thank you
Also maybe you will know whats wrong here?

pawn Код:
case 0: // PCSO // nothing
                {
                    if(FacInfo[playerid][fRank1] != 1) return 0;
                    SetPlayerSkin(playerid, 71);
                    format(string, sizeof(string), "* %s puts on their community support clothing.", RPN(playerid));
                    SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
                }
                case 1: // Warrented Officer // Baton + Spray
                {
                    if(FacInfo[playerid][fRank1] >= 1) return SendClientMessage(playerid, COLOR_GREY, "You're not a high enough rank!");
                    GiveZaiatWeapon(playerid, 3, 1);
                    GiveZaiatWeapon(playerid, 41, 1000);
                    SetPlayerSkin(playerid, 280);
                    format(string, sizeof(string), "* %s grabs a Baton and CS Spray from their locker.", RPN(playerid));
                    SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
                }
It sets them a warrented officer skin(280), However it doesn't set them the PCSO skin? (71)
pawn Код:
case 0: // PCSO // nothing
                {
                    if(FacInfo[playerid][fRank1] != 1) return 0; //You didn't return before.
                    SetPlayerSkin(playerid, 71);
                    format(string, sizeof(string), "* %s puts on their community support clothing.", RPN(playerid));
                    SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
                }
                case 1: // Warrented Officer // Baton + Spray
                {
                    if(FacInfo[playerid][fRank1] >= 1) return SendClientMessage(playerid, COLOR_GREY, "You're not a high enough rank!");
                    GiveZaiatWeapon(playerid, 3, 1);
                    GiveZaiatWeapon(playerid, 41, 1000);
                    SetPlayerSkin(playerid, 280);
                    format(string, sizeof(string), "* %s grabs a Baton and CS Spray from their locker.", RPN(playerid));
                    SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
                }
1:to do that easily, you can switch skin id's.
pawn Код:
switch(skin)
{
 case 251,252,181,255: return 0; //Etc.
Reply
#8

Quote:
Originally Posted by Mike_Peterson
Посмотреть сообщение
case 1 is strange.
if player fRank1 is equal or higher than 1, return message 'not high enough rank'?
My bad, I always get >= and <= mixed up, I don't have the .pdf file either too check

Thanks for all help everyone also, Will be repped shortly
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)