when players choose skins from backward
#1

hey....

i have a small bug in my server

when someone choose any skin before 280 (backward) and he press spawn, it give him another skin

when player press < while he is in skin 280 it stays skin 280 2 times when he press < 3 times then 280 change, then when he press spawn it give him the skins that is before the skin in 2 times back from what he chose

but when he do > its normal good

but < before 280 gets bugged

pawn Код:
new skins[]={280,284,281,266,282,267,163,164,165,276,275,274,287,1,2,70,61,75,124,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,3,4,56,223,48,49,50,51,52,53,54,55,56,57,58,59,60,62,64,65,66,67,68,69,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,141,144,152,181,206,228,241,242,240};
pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
    if(NeedToReset[playerid]==1)
    {
        ResetPlayerWeapons(playerid);
    }
   
    if(Logged[playerid]==false || SInfo[playerid][readytosave] == 0)
    {
        SInfo[playerid][Skin]=skins[classid];
    }
    else
    {
        SetPlayerSkin(playerid,SInfo[playerid][Skin]);
        if (skins[classid]!=SInfo[playerid][Skin])
        return OnPlayerRequestClass(playerid,classid+1);
    }

    MostrarInicio(playerid);
    SetPlayerPos(playerid, 1436.5667,-1500.1584,13.5391);
    SetPlayerFacingAngle(playerid, 232.5814);
    SetPlayerCameraPos(playerid, 1443.1050,-1503.9122,13.3806);
    SetPlayerCameraLookAt(playerid, 1436.5667,-1500.1584,13.5391);
    switch (classid)
    {
        case 0,1,2,3,4,5:
        {
            team0(playerid);
            SetPlayerTeam(playerid, 1);
            copteam[ playerid ] = 1;
            GameTextForPlayer(playerid,"~B~Cop",5000,3);
            SetPlayerColor(playerid, 0x0000FFAA);
        }
        case 6,7,8:
        {
            team0(playerid);
            SetPlayerTeam(playerid, 1);
            ciateam[ playerid ] = 1;
            GameTextForPlayer(playerid,"~Y~CIA",5000,3);
            SetPlayerColor(playerid, 0xFFFFFFFF);
        }
        case 9,10,11:
        {
            team0(playerid);
            SetPlayerTeam(playerid, NO_TEAM);
            medicteam[ playerid ] = 1;
            GameTextForPlayer(playerid,"~P~Medic",5000,3);
            SetPlayerColor(playerid, 0x800080AA);
        }
        case 12:
        {
            team0(playerid);
            SetPlayerTeam(playerid, 1);
            armyteam[ playerid ] = 1;
            GameTextForPlayer(playerid,"~G~Army",5000,3);
            SetPlayerColor(playerid, 0x00FFFFFF);
        }
        case 13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121:
        {
            team0(playerid);
            SetPlayerTeam(playerid, NO_TEAM);
            civilianteam[ playerid ] = 1;
            GameTextForPlayer(playerid, "~W~Civilian",5000,3);
            SetPlayerColor(playerid, 0xFFFFFFAA);
        }
    }
    return 1;
}
SORRY FOR MY BAD ENGLISH

IF YOU NEED MORE INFO TELL ME
Reply
#2

You don't need this array, since you can use GetPlayerSkin function. And I'm sure it's the one which bugs it.
Reply
#3

I wouldn't recommend doing this without the use of AddPlayerClass lines...
https://sampwiki.blast.hk/wiki/AddPlayerClass

but if you really don't want to use them, try adding this:
pawn Код:
public OnPlayerSpawn(playerid)
{
    SetPlayerSkin(playerid, SInfo[playerid][Skin]);
    return 1;
}
I believe the line giving you these errors would have to be:
pawn Код:
return OnPlayerRequestClass(playerid,classid+1);
Because it doesn't necessarily have to be +1, it could be -1 either way.
Reply
#4

guys well you be more spacefic

btw i have AddPlayerClass On GameModeInit

i added

new Skins[]={}

because when player choose a skin when he register then when he relog he can't choose another one

the AddPlayerClass

are orgnized same numbers 280 . . . . . . . . . 240 same Skins[]{}

any help??

pls be more spacefic in your help
Reply
#5

Quote:
Originally Posted by GoldZoroGrab
Посмотреть сообщение
because when player choose a skin when he register then when he relog he can't choose another one
Then check if the skin on the classid is not the same as the one when he registered and return 0; that means he can't use that skin.
pawn Код:
public OnPlayerRequestClass( playerid, classid )
{
    if( IsPlayerRegistered( playerid ) && classid != SInfo[ playerid ][ Skin ] )
    {
        SendClientMessage( playerid, COLOR_GREEN, "This skin is not yours! Choose the one you had when you registered." );
        return 0;
    }
    return 1;
}
PS: IsPlayerRegistered( playerid ) is just an example. Use the variable to check if he is registered.
Reply
#6

THIS IS THE LINE CAUSING THE ERROR:
pawn Код:
return OnPlayerRequestClass(playerid,classid+1);
The +1 will only work properly when you try to go forward, however if you try to go backward, it will only work for -1.

Is that specific enough for you?
Reply
#7

Quote:
Originally Posted by BenzoAMG
Посмотреть сообщение
THIS IS THE LINE CAUSING THE ERROR:
pawn Код:
return OnPlayerRequestClass(playerid,classid+1);
The +1 will only work properly when you try to go forward, however if you try to go backward, it will only work for -1.

Is that specific enough for you?
bro i did it

when i go backward after skin 280 < it choose another skin when press spawn

but if i did > after 280 skins are good
Reply
#8

im gonna make it easier for you

when i be in classs skin 280 and i go back it be civilian but it stays "Cop" after i go back 3 times then it be a civilian

waiting for help
Reply
#9

pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
    if(NeedToReset[playerid]==1)
    {
        ResetPlayerWeapons(playerid);
    }
   
    if(Logged[playerid]==false || SInfo[playerid][readytosave] == 0)
    {
        SInfo[playerid][Skin]=skins[classid];
        SendClientMessage(playerid,0xFF0000,"One-One");///////////////////////////////////////////
    }
    else
    {
        SendClientMessage(playerid,0xFF0000,"Two_Two");///////////////////////////////////////////
        SetPlayerSkin(playerid,SInfo[playerid][Skin]);
        if (skins[classid]!=SInfo[playerid][Skin])
        return OnPlayerRequestClass(playerid,classid+1);
    }

    MostrarInicio(playerid);
    SetPlayerPos(playerid, 1436.5667,-1500.1584,13.5391);
    SetPlayerFacingAngle(playerid, 232.5814);
    SetPlayerCameraPos(playerid, 1443.1050,-1503.9122,13.3806);
    SetPlayerCameraLookAt(playerid, 1436.5667,-1500.1584,13.5391);
    switch (classid)
    {
        case 0,1,2,3,4,5:
        {
            team0(playerid);
            SetPlayerTeam(playerid, 1);
            copteam[ playerid ] = 1;
            GameTextForPlayer(playerid,"~B~Cop",5000,3);
            SetPlayerColor(playerid, 0x0000FFAA);
        }
        case 6,7,8:
        {
            team0(playerid);
            SetPlayerTeam(playerid, 1);
            ciateam[ playerid ] = 1;
            GameTextForPlayer(playerid,"~Y~CIA",5000,3);
            SetPlayerColor(playerid, 0xFFFFFFFF);
        }
        case 9,10,11:
        {
            team0(playerid);
            SetPlayerTeam(playerid, NO_TEAM);
            medicteam[ playerid ] = 1;
            GameTextForPlayer(playerid,"~P~Medic",5000,3);
            SetPlayerColor(playerid, 0x800080AA);
        }
        case 12:
        {
            team0(playerid);
            SetPlayerTeam(playerid, 1);
            armyteam[ playerid ] = 1;
            GameTextForPlayer(playerid,"~G~Army",5000,3);
            SetPlayerColor(playerid, 0x00FFFFFF);
        }
        case 13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121:
        {
            team0(playerid);
            SetPlayerTeam(playerid, NO_TEAM);
            civilianteam[ playerid ] = 1;
            GameTextForPlayer(playerid, "~W~Civilian",5000,3);
            SetPlayerColor(playerid, 0xFFFFFFAA);
        }
    }
    return 1;
Is it One-One or Two-Two once the mistake happens?
Reply
#10

roko bro, thats not the problem

the problem is when i go back skin 280 and press spawn it choose another skins
if pressed back one time before 280 skins id it give me a civilian skin and it give me id 280 when i press spawn auto.
if i presses it twice and i press spawn it give me skin 280 if i pressed 3 times it give me the skin that is before 280

so if pressed back it give me skin that is after it in 2 times

this happens when i go back from skkin 280
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)