OnPlayerRequestSpawn problem
#1

I have a little problem with OnPlayerRequestSpawn problem, don't understand what is wrong at the condition...

Defines/vars used:
pawn Код:
#define id                      playerid
#define function%0(%1)          forward%0(%1); public%0(%1)

#define _FID                    1
#define _FWARN                  2
#define _FRANK                  3
#define MAX_FACTION_INFO        4

enum _:p_info
{
    passKey[ 128 ],
    account[ MAX_ACCOUNT_INFO ],
    level[ MAX_LEVEL_INFO ],
    skills[ MAX_SKILLS_INFO ],
    licenses[ MAX_LICENSE_INFO ],
    faction[ MAX_FACTION_INFO ],
    stats[ MAX_STATS_INFO ],
    crime[ MAX_CRIME_INFO ],
    crash[ p_crash_info ]
    items[ MAX_ITEM_INFO ],
    weapons[ p_weapon_info ]
};

new p_data_i[ MAX_PLAYERS ][ p_info ]
pawn Код:
public OnPlayerRequestSpawn(id)
{
    if(!FACTION_Check(id))
        return 0
   
    return 1
}
pawn Код:
function FACTION_Check(id)
{
    new checktext[ 256 ], name[ MAX_PLAYER_NAME ]
    GetPlayerName(id, name, sizeof(name))
   
    if(g_classRequest[ id ] == p_data_i[ id ][ faction ][ _FID ])
    {
        format(checktext, sizeof(checktext)-1, "[ ! ] Welcome Back {FF6347}%s \"%s\"", f_data_ranks[ g_classRequest[ id ] ][ p_data_i[ id ][ faction ][ _FRANK ] ], name)
        SendClientMessage(id, COLOR_ANNOUNCE, checktext)
        return 1
    }
    else
    {
        g_wrongFaction[ id ]++
        format(checktext, sizeof(checktext)-1, "[ ! ] Wrong Faction selected {FFFFFF}%s{FF6347}, you should choose {FFFFFF}%s", f_data_name[ g_classRequest[ id ] ], f_data_name[ p_data_i[ id ][ faction ][ _FID ] ])
        SendClientMessage(id, COLOR_LIGHTRED, checktext)
        if(g_wrongFaction[ id ] == 3)
        {
            format(checktext, sizeof(checktext)-1, "[ ! ] You've chosen the wrong Faction 3 times in a row so you got kicked", f_data_name[ g_classRequest[ id ] ])
            SendClientMessage(id, COLOR_LIGHTRED, checktext)
            TogglePlayerControllable(id, 0)
            Kick(id)
        }
        return 0
    }
}
When I choose the class, I made a little log so I can try to figure it out, this is what I've got in log:

[12:09:04] g_classRequest[ id ]: 1001 || p_data_i[ id ][ faction ][ _FID ]: 0
1000+ means the skin is for Leader only.

As log says, the condition should block the spawn.. but when I press spawn, player just spawns (this occurs only when I'm Civilian and I choose a skin that is reserved for Leader, or if I'm in a Faction and I choose any skin. If I choose a member skin that is reserved to a Faction and I'm Civilian, everything works fine)

So, what da hell is wrong?!

This is OnPlayerRequestClass function:
pawn Код:
public OnPlayerRequestClass(id, classid)
{
    new classtext[ 64 ]
    if(classid >= 0 && classid <= 9)
    {
        switch(p_data_i[ id ][ stats ][ _CITY ])
        {
            case 0: // Los Santos
            {
                SetPlayerPos(id, 479.7586, -1500.8718, 20.5128)
                SetPlayerFacingAngle(id, 267.6682)
                SetPlayerCameraPos(id, 488.2594, -1500.1848, 20.3090)
                SetPlayerCameraLookAt(id, 479.7586, -1500.8718, 20.5128)
            }
            case 1: // San Fierro
            {
                SetPlayerPos(id, -1754.0198, 960.0816, 24.8828)
                SetPlayerFacingAngle(id, 174.9049)
                SetPlayerCameraPos(id, -1753.4861, 950.4507, 24.7422)
                SetPlayerCameraLookAt(id, -1754.0198, 960.0816, 24.8828)
            }
            case 2: // Las Venturas
            {
                SetPlayerPos(id, 2176.2610, 1119.7736, 12.6630)
                SetPlayerFacingAngle(id, 61.6283)
                SetPlayerCameraPos(id, 2166.9424, 1125.4362, 12.5594)
                SetPlayerCameraLookAt(id, 2176.2610, 1119.7736, 12.6630)
            }
        }
        g_classRequest[ id ] = 0
        format(classtext, sizeof(classtext), "~b~~h~C~w~ivilian")
        GameTextForPlayer(id, classtext, 3000, 6)
    }
    else if(classid > 9 && classid <= 18)
    {
        SetPlayerPos(id, 1552.8140, -1675.8142, 16.1953)
        SetPlayerFacingAngle(id, 92.0539)
        SetPlayerCameraPos(id, 1545.0789, -1675.7349, 13.5597)
        SetPlayerCameraLookAt(id, 1552.8140, -1675.8142, 16.1953)
        if(classid == 18)
        {
            format(classtext, sizeof(classtext), "~b~~h~P~w~olice Department [Leader]")
            g_classRequest[ id ] = 1001
        }
        else
        {
            format(classtext, sizeof(classtext), "~b~~h~P~w~olice Department [Member]")
            g_classRequest[ id ] = 1
        }
        GameTextForPlayer(id, classtext, 3000, 6)
    }
    else if(classid > 18 && classid <= 21)
    {
        SetPlayerPos(id, -1605.5674, 712.1249, 13.8672)
        SetPlayerFacingAngle(id, 1.8478)
        SetPlayerCameraPos(id, -1605.7665, 717.1442, 12.0231)
        SetPlayerCameraLookAt(id, -1605.5674, 712.1249, 13.8672)
        if(classid == 21)
        {
            format(classtext, sizeof(classtext), "~b~~h~F~w~.B.I. [Leader]")
            g_classRequest[ id ] = 1002
        }
        else
        {
            format(classtext, sizeof(classtext), "~b~~h~F~w~.B.I. [Member]")
            g_classRequest[ id ] = 2
        }
        GameTextForPlayer(id, classtext, 3000, 6)
    }
    else if(classid > 21 && classid <= 23)
    {
        SetPlayerPos(id, -1329.3069, 484.2915, 12.1823)
        SetPlayerFacingAngle(id, 180.2710)
        SetPlayerCameraPos(id, -1329.2854, 479.1790, 9.0729)
        SetPlayerCameraLookAt(id, -1329.3069, 484.2915, 12.1823)
        if(classid == 23)
        {
            format(classtext, sizeof(classtext), "~b~~h~N~w~ational Guard [Leader]")
            g_classRequest[ id ] = 1003
        }
        else
        {
            format(classtext, sizeof(classtext), "~b~~h~N~w~ational Guard [Member]")
            g_classRequest[ id ] = 3
        }
        GameTextForPlayer(id, classtext, 3000, 6)
    }
    else if(classid > 23 && classid <= 29)
    {
        SetPlayerPos(id, -2655.2688, 638.7628, 14.4531)
        SetPlayerFacingAngle(id, 183.4059)
        SetPlayerCameraPos(id, -2654.7747, 631.2579, 14.4531)
        SetPlayerCameraLookAt(id, -2655.2688, 638.7628, 14.4531)
        if(classid == 24)
        {
            format(classtext, sizeof(classtext), "~y~~h~M~w~edic Department [Leader]")
            g_classRequest[ id ] = 1004
        }
        else
        {
            format(classtext, sizeof(classtext), "~y~~h~M~w~edic Department [Member]")
            g_classRequest[ id ] = 4
        }
        GameTextForPlayer(id, classtext, 3000, 6)
    }
    else if(classid > 29 && classid <= 35)
    {
        SetPlayerPos(id, 1123.2224, -2036.7623, 69.8935)
        SetPlayerFacingAngle(id, 269.2483)
        SetPlayerCameraPos(id, 1128.8674, -2036.7786, 69.3977)
        SetPlayerCameraLookAt(id, 1123.2224, -2036.7623, 69.8935)
        if(classid == 35)
        {
            format(classtext, sizeof(classtext), "~y~L~w~a Cosa Nostra [Leader]")
            g_classRequest[ id ] = 1005
        }
        else
        {
            format(classtext, sizeof(classtext), "~y~L~w~a Cosa Nostra [Member]")
            g_classRequest[ id ] = 5
        }
        GameTextForPlayer(id, classtext, 3000, 6)
    }
    else if(classid > 35 && classid <= 41)
    {
        SetPlayerPos(id, -2200.8608, 646.8175, 49.4375)
        SetPlayerFacingAngle(id, 179.5416)
        SetPlayerCameraPos(id, -2200.5791, 642.1305, 49.4429)
        SetPlayerCameraLookAt(id, -2200.8608, 646.8175, 49.4375)
        if(classid == 41)
        {
            format(classtext, sizeof(classtext), "~g~Y~w~akuza [Leader]")
            g_classRequest[ id ] = 1006
        }
        else
        {
            format(classtext, sizeof(classtext), "~g~Y~w~akuza [Member]")
            g_classRequest[ id ] = 6
        }
        GameTextForPlayer(id, classtext, 3000, 6)
    }
    else if(classid > 41 && classid <= 42)
    {
        SetPlayerPos(id, 1482.1328, -1768.3431, 18.7958)
        SetPlayerFacingAngle(id, 0.0458)
        SetPlayerCameraPos(id, 1482.0868, -1760.9182, 17.7068)
        SetPlayerCameraLookAt(id, 1482.1328, -1768.3431, 18.7958)
       
        format(classtext, sizeof(classtext), "~g~P~w~resident [Leader]")
        g_classRequest[ id ] = 1007
        GameTextForPlayer(id, classtext, 3000, 6)
    }
    else if(classid > 42 && classid <= 45)
    {
        SetPlayerPos(id, 1073.2141, -344.6863, 73.9922)
        SetPlayerFacingAngle(id, 7.6093)
        SetPlayerCameraPos(id, 1071.7578, -336.7174, 73.9922)
        SetPlayerCameraLookAt(id, 1073.2141, -344.6863, 73.9922)
        if(classid == 45)
        {
            format(classtext, sizeof(classtext), "~r~H~w~itman [Leader]")
            g_classRequest[ id ] = 1008
        }
        else
        {
            format(classtext, sizeof(classtext), "~g~H~w~itman [Member]")
            g_classRequest[ id ] = 8
        }
        GameTextForPlayer(id, classtext, 3000, 6)
    }
    else if(classid > 45 && classid <= 48)
    {
        SetPlayerPos(id, -2050.5740, 460.6887, 35.1719)
        SetPlayerFacingAngle(id, 314.6902)
        SetPlayerCameraPos(id, -2046.7891, 464.6131, 35.1719)
        SetPlayerCameraLookAt(id, -2050.5740, 460.6887, 35.1719)
        if(classid == 46)
        {
            format(classtext, sizeof(classtext), "~p~~h~N~w~ews Reporter [Leader]")
            g_classRequest[ id ] = 1009
        }
        else
        {
            format(classtext, sizeof(classtext), "~p~~h~N~w~ews Reporter [Member]")
            g_classRequest[ id ] = 9
        }
        GameTextForPlayer(id, classtext, 3000, 6)
    }
    else if(classid > 48 && classid <= 51)
    {
        SetPlayerPos(id, -1978.6296, 94.7382, 27.6875)
        SetPlayerFacingAngle(id, 93.5249)
        SetPlayerCameraPos(id, -1985.0043, 94.9262, 27.6875)
        SetPlayerCameraLookAt(id, -1978.6296, 94.7382, 27.6875)
        if(classid == 50)
        {
            format(classtext, sizeof(classtext), "~y~T~w~axi Company [Leader]")
            g_classRequest[ id ] = 1010
        }
        else
        {
            format(classtext, sizeof(classtext), "~y~T~w~axi Company [Member]")
            g_classRequest[ id ] = 10
        }
        GameTextForPlayer(id, classtext, 3000, 6)
    }
    else if(classid > 51 && classid <= 54)
    {
        SetPlayerPos(id, -2026.5409, -100.3505, 35.1641)
        SetPlayerFacingAngle(id, 6.2996)
        SetPlayerCameraPos(id, -2026.6808, -95.8112, 35.1641)
        SetPlayerCameraLookAt(id, -2026.5409, -100.3505, 35.1641)
        if(classid == 53)
        {
            format(classtext, sizeof(classtext), "~b~~h~~h~S~w~chool Instructor [Leader]")
            g_classRequest[ id ] = 1011
        }
        else
        {
            format(classtext, sizeof(classtext), "~b~~h~~h~S~w~chool Instructor [Member]")
            g_classRequest[ id ] = 11
        }
        GameTextForPlayer(id, classtext, 3000, 6)
    }
    else if(classid > 54 && classid <= 57)
    {
        SetPlayerPos(id, -1694.6290, 1356.0724, 9.8047)
        SetPlayerFacingAngle(id, 221.5718)
        SetPlayerCameraPos(id, -1691.5452, 1352.6522, 9.8047)
        SetPlayerCameraLookAt(id, -1694.6290, 1356.0724, 9.8047)
        if(classid == 56)
        {
            format(classtext, sizeof(classtext), "~p~V~w~iva la Vida [Leader]")
            g_classRequest[ id ] = 1012
        }
        else
        {
            format(classtext, sizeof(classtext), "~p~V~w~iva la Vida [Member]")
            g_classRequest[ id ] = 12
        }
        GameTextForPlayer(id, classtext, 3000, 6)
    }
    else if(classid > 57 && classid <= 60)
    {
        SetPlayerPos(id, 726.6241, -1276.4071, 13.6484)
        SetPlayerFacingAngle(id, 271.2312)
        SetPlayerCameraPos(id, 733.7746, -1275.8116, 13.5659)
        SetPlayerCameraLookAt(id, 726.6241, -1276.4071, 13.6484)
        if(classid == 58)
        {
            format(classtext, sizeof(classtext), "~l~G~w~-Unit [Leader]")
            g_classRequest[ id ] = 1013
        }
        else
        {
            format(classtext, sizeof(classtext), "~l~G~w~-Unit [Member]")
            g_classRequest[ id ] = 13
        }
        GameTextForPlayer(id, classtext, 3000, 6)
    }
    else if(classid > 60 && classid <= 63)
    {
        SetPlayerPos(id, 2094.4526, -1145.1388, 26.5929)
        SetPlayerFacingAngle(id, 89.8440)
        SetPlayerCameraPos(id, 2088.6987, -1145.7178, 25.5860)
        SetPlayerCameraLookAt(id, 2094.4526, -1145.1388, 26.5929)
        if(classid == 63)
        {
            format(classtext, sizeof(classtext), "~p~B~w~allas [Leader]")
            g_classRequest[ id ] = 1014
        }
        else
        {
            format(classtext, sizeof(classtext), "~p~B~w~allas [Member]")
            g_classRequest[ id ] = 14
        }
        GameTextForPlayer(id, classtext, 3000, 6)
    }
    else if(classid > 63 && classid <= 69)
    {
        SetPlayerPos(id, 2495.4407, -1688.8901, 14.0886)
        SetPlayerFacingAngle(id, 3.3104)
        SetPlayerCameraPos(id, 2494.9556, -1682.8475, 13.3387)
        SetPlayerCameraLookAt(id, 2495.4407, -1688.8901, 14.0886)
        if(classid == 69)
        {
            format(classtext, sizeof(classtext), "~g~~h~G~w~roove [Leader]")
            g_classRequest[ id ] = 1015
        }
        else
        {
            format(classtext, sizeof(classtext), "~g~~h~G~w~roove [Member]")
            g_classRequest[ id ] = 15
        }
        GameTextForPlayer(id, classtext, 3000, 6)
    }
    else if(classid > 69 && classid <= 72)
    {
        SetPlayerPos(id, 2413.3525, -1425.8778, 23.9845)
        SetPlayerFacingAngle(id, 89.1306)
        SetPlayerCameraPos(id, 2406.4539, -1426.0520, 23.9836)
        SetPlayerCameraLookAt(id, 2413.3525, -1425.8778, 23.9845)
        if(classid == 71)
        {
            format(classtext, sizeof(classtext), "~y~~h~T~w~ow Car Company [Leader]")
            g_classRequest[ id ] = 1016
        }
        else
        {
            format(classtext, sizeof(classtext), "~y~~h~T~w~ow Car Company [Member]")
            g_classRequest[ id ] = 16
        }
        GameTextForPlayer(id, classtext, 3000, 6)
    }
    else if(classid > 72 && classid <= 75)
    {
        SetPlayerPos(id, 1360.3661, -1643.3361, 13.3828)
        SetPlayerFacingAngle(id, 273.0993)
        SetPlayerCameraPos(id, 1370.2251, -1642.9153, 13.3828)
        SetPlayerCameraLookAt(id, 1360.3661, -1643.3361, 13.3828)
        if(classid == 74)
        {
            format(classtext, sizeof(classtext), "~l~L~w~os Santos Drift King [Leader]")
            g_classRequest[ id ] = 1017
        }
        else
        {
            format(classtext, sizeof(classtext), "~l~L~w~os Santos Drift King [Member]")
            g_classRequest[ id ] = 17
        }
        GameTextForPlayer(id, classtext, 3000, 6)
    }
    else if(classid > 75 && classid <= 78)
    {
        SetPlayerPos(id, -2497.5818, 320.3014, 30.1722)
        SetPlayerFacingAngle(id, 339.9534)
        SetPlayerCameraPos(id, -2493.5420, 330.7277, 32.4231)
        SetPlayerCameraLookAt(id, -2497.5818, 320.3014, 30.1722)
        if(classid == 77)
        {
            format(classtext, sizeof(classtext), "~l~S~w~an Fierro Street Kings [Leader]")
            g_classRequest[ id ] = 1018
        }
        else
        {
            format(classtext, sizeof(classtext), "~l~S~w~an Fierro Street Kings [Member]")
            g_classRequest[ id ] = 18
        }
        GameTextForPlayer(id, classtext, 3000, 6)
    }
    printf("g_classRequest[ id ]: %d || p_data_i[ id ][ faction ][ _FID ]: %d", g_classRequest[ id ], p_data_i[ id ][ faction ][ _FID ])
    return 1;
}
I know it's GodFather based.. but it's not actually GodFather gamemode.

Thanks in advance.

LE: I figure it out.. close the topic
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)