Seems like its working only for class id 23
#1

I made Admin Class/VIP Class the problem is

the game text/client message only appears for class id 23
i make sure that i'm Admin Level 5 & VIP Level 2 What is the problem in my code?

pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
    SetPlayerPos(playerid, 2282.3689,-1248.0156,24.0000);
    SetPlayerFacingAngle(playerid, 180.6267);
    SetPlayerCameraPos(playerid, 2282.2136,-1252.6395,24.0000);
    SetPlayerCameraLookAt(playerid, 2282.3689,-1248.0156,24.0000);
    if(PlaySong[playerid] == 0)
    {
        PlaySong[playerid] = 1;
        PlayAudioStreamForPlayer(playerid, "http://k002.kiwi6.com/hotlink/04gp2006f8/s_club_7_you_re_my_number_one.mp3");
    }
    else if(classid == 22 || classid == 24)
    {
        pData[playerid][PrivateSkin] = 0;
    }
    else if(classid == 23)
    {
        if(pData[playerid][VIP] < 1)
        {
            SendClientMessage(playerid, COLOR_RED, "*** For VIP only! ***");
            GameTextForPlayer(playerid, "~r~For VIP only!", 3000, 4);
        }
        else if(pData[playerid][VIP] > 1)
        {
            SendClientMessage(playerid, COLOR_LIGHTGREEN, "*** You are allowed to use this skin! ***");
            GameTextForPlayer(playerid, "~g~You are allowed to use this skin!", 4000, 4);
        }
        pData[playerid][PrivateSkin] = 1;
    }
    else if(classid == 28 || classid == 30 || classid == 55 || classid == 57)
    {
        pData[playerid][PrivateSkin] = 0;
    }
    else if(classid == 29 || classid == 56)
    {
        if(pData[playerid][Admin] < 5)
        {
            SendClientMessage(playerid, COLOR_RED, "*** For Clan Owner/Co-Owner only! ***");
            GameTextForPlayer(playerid, "~r~For Clan Owner/Co-Owner only!", 3000, 4);
        }
        else if(pData[playerid][Admin] > 5)
        {
            SendClientMessage(playerid, COLOR_LIGHTGREEN, "*** You are allowed to use this skin! ***");
            GameTextForPlayer(playerid, "~g~You are allowed to use this skin!", 4000, 4);
        }
        pData[playerid][PrivateSkin] = 2;
    }
    else if(classid == 207 || classid == 209 || classid == 216 || classid == 218)
    {
        pData[playerid][PrivateSkin] = 0;
    }
    else if(classid == 208 || classid == 217)
    {
        if(pData[playerid][Admin] < 1)
        {
            SendClientMessage(playerid, COLOR_RED, "*** For Server Administrators only! ***");
            GameTextForPlayer(playerid, "~r~For Server Administrators only!", 3000, 4);
        }
        else if(pData[playerid][Admin] > 1)
        {
            SendClientMessage(playerid, COLOR_LIGHTGREEN, "*** You are allowed to use this skin! ***");
            GameTextForPlayer(playerid, "~g~You are allowed to use this skin!", 4000, 4);
        }
        pData[playerid][PrivateSkin] = 3;
    }
    return 1;
}
but it seems like OnPlayerRequestSpawn is working fine when i use other admin class/vip class it shows me

Код:
*** You use your Private Admin/VIP class ***
Reply
#2

Can you be more specific?
What isn't working well?

Edit: Try this, you were comparing PlaySong[playerid] to classid which wouldn't really make it work.
I've removed the else before if(classid == 22 || classid == 24)
pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
    SetPlayerPos(playerid, 2282.3689,-1248.0156,24.0000);
    SetPlayerFacingAngle(playerid, 180.6267);
    SetPlayerCameraPos(playerid, 2282.2136,-1252.6395,24.0000);
    SetPlayerCameraLookAt(playerid, 2282.3689,-1248.0156,24.0000);
    if(PlaySong[playerid] == 0)
    {
        PlaySong[playerid] = 1;
        PlayAudioStreamForPlayer(playerid, "http://k002.kiwi6.com/hotlink/04gp2006f8/s_club_7_you_re_my_number_one.mp3");
    }
    if(classid == 22 || classid == 24)
    {
        pData[playerid][PrivateSkin] = 0;
    }
    else if(classid == 23)
    {
        if(pData[playerid][VIP] < 1)
        {
            SendClientMessage(playerid, COLOR_RED, "*** For VIP only! ***");
            GameTextForPlayer(playerid, "~r~For VIP only!", 3000, 4);
        }
        else if(pData[playerid][VIP] > 1)
        {
            SendClientMessage(playerid, COLOR_LIGHTGREEN, "*** You are allowed to use this skin! ***");
            GameTextForPlayer(playerid, "~g~You are allowed to use this skin!", 4000, 4);
        }
        pData[playerid][PrivateSkin] = 1;
    }
    else if(classid == 28 || classid == 30 || classid == 55 || classid == 57)
    {
        pData[playerid][PrivateSkin] = 0;
    }
    else if(classid == 29 || classid == 56)
    {
        if(pData[playerid][Admin] < 5)
        {
            SendClientMessage(playerid, COLOR_RED, "*** For Clan Owner/Co-Owner only! ***");
            GameTextForPlayer(playerid, "~r~For Clan Owner/Co-Owner only!", 3000, 4);
        }
        else if(pData[playerid][Admin] > 5)
        {
            SendClientMessage(playerid, COLOR_LIGHTGREEN, "*** You are allowed to use this skin! ***");
            GameTextForPlayer(playerid, "~g~You are allowed to use this skin!", 4000, 4);
        }
        pData[playerid][PrivateSkin] = 2;
    }
    else if(classid == 207 || classid == 209 || classid == 216 || classid == 218)
    {
        pData[playerid][PrivateSkin] = 0;
    }
    else if(classid == 208 || classid == 217)
    {
        if(pData[playerid][Admin] < 1)
        {
            SendClientMessage(playerid, COLOR_RED, "*** For Server Administrators only! ***");
            GameTextForPlayer(playerid, "~r~For Server Administrators only!", 3000, 4);
        }
        else if(pData[playerid][Admin] > 1)
        {
            SendClientMessage(playerid, COLOR_LIGHTGREEN, "*** You are allowed to use this skin! ***");
            GameTextForPlayer(playerid, "~g~You are allowed to use this skin!", 4000, 4);
        }
        pData[playerid][PrivateSkin] = 3;
    }
    return 1;
}
Reply
#3

Nope i try the before but don't work, the gametext/message only appears for class id 23
Reply
#4

Alright let's work first on cleaning it as I can see you're using pData[playerid][PrivateSkin] = 0; in many conditions while you can use them in one.
Also cleaning a little with else conditions.

+ I've noticed you're using if(pData[playerid][Admin] < 5) for clan owners, maybe you wanna revise that.

pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
    SetPlayerPos(playerid, 2282.3689,-1248.0156,24.0000);
    SetPlayerFacingAngle(playerid, 180.6267);
    SetPlayerCameraPos(playerid, 2282.2136,-1252.6395,24.0000);
    SetPlayerCameraLookAt(playerid, 2282.3689,-1248.0156,24.0000);
    if(PlaySong[playerid] == 0)
    {
        PlaySong[playerid] = 1;
        PlayAudioStreamForPlayer(playerid, "http://k002.kiwi6.com/hotlink/04gp2006f8/s_club_7_you_re_my_number_one.mp3");
    }
    // Public Classes
    if(classid == 22 || classid == 24 || classid == 28 || classid == 30 || classid == 55 || classid == 57 || classid == 207 || classid == 209 || classid == 216 || classid == 218)
    {
        pData[playerid][PrivateSkin] = 0;
    }
    // Level 1+ VIP classes
    else if(classid == 23)
    {
        if(pData[playerid][VIP] < 1)
        {
            SendClientMessage(playerid, COLOR_RED, "*** For VIP only! ***");
            GameTextForPlayer(playerid, "~r~For VIP only!", 3000, 4);
        }
        else
        {
            SendClientMessage(playerid, COLOR_LIGHTGREEN, "*** You are allowed to use this skin! ***");
            GameTextForPlayer(playerid, "~g~You are allowed to use this skin!", 4000, 4);
        }
        pData[playerid][PrivateSkin] = 1;
    }
    // Level 5+ admin classes
    else if(classid == 29 || classid == 56)
    {
        if(pData[playerid][Admin] < 5)
        {
            SendClientMessage(playerid, COLOR_RED, "*** For Clan Owner/Co-Owner only! ***");
            GameTextForPlayer(playerid, "~r~For Clan Owner/Co-Owner only!", 3000, 4);
        }
        else
        {
            SendClientMessage(playerid, COLOR_LIGHTGREEN, "*** You are allowed to use this skin! ***");
            GameTextForPlayer(playerid, "~g~You are allowed to use this skin!", 4000, 4);
        }
        pData[playerid][PrivateSkin] = 2;
    }
    // Level 1+ admin classes
    else if(classid == 208 || classid == 217)
    {
        if(pData[playerid][Admin] < 1)
        {
            SendClientMessage(playerid, COLOR_RED, "*** For Server Administrators only! ***");
            GameTextForPlayer(playerid, "~r~For Server Administrators only!", 3000, 4);
        }
        else
        {
            SendClientMessage(playerid, COLOR_LIGHTGREEN, "*** You are allowed to use this skin! ***");
            GameTextForPlayer(playerid, "~g~You are allowed to use this skin!", 4000, 4);
        }
        pData[playerid][PrivateSkin] = 3;
    }
    return 1;
}
Reply
#5

didn't see that Thank you iRage
Reply
#6

No problem, waiting for your reply to see if that by any chance helped with getting it to work.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)