Color/Skin problem after Spawning
#1

So when I do /color and choose the color i want, it's fine and after choosing skin it changes and fine. But then after I get killed and Spawn. It automatically changes the skin, next to the skin that I have chosen before.

Example. I choose skin 41 and I died. After spawn the skin changes to 42.

Also fix when choosing skin under 300+ it close my gta.



pawn Код:
new PlayerInfo[MAX_PLAYERS][pInfo];

public OnFilterScriptInit()
{
    print("\n--------------------------------------");
    print("Player Color & Skin Saving Loaded");
    print("--------------------------------------\n");
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    if(!dini_Exists(UserPath(playerid))) dini_Create(UserPath(playerid));
    dini_IntSet(UserPath(playerid), "SkinID", PlayerInfo[playerid][pModel]);
    dini_IntSet(UserPath(playerid), "ColorID", PlayerInfo[playerid][pColorID]);
    return 1;
}

public OnPlayerConnect(playerid)
{
    if(!dini_Exists(UserPath(playerid)))
    {
        PlayerInfo[playerid][pModel] = -1;
        PlayerInfo[playerid][pColorID] = random(MAX_COLOR);
    }
    else
    {
        PlayerInfo[playerid][pModel] = dini_Int(UserPath(playerid), "SkinID");
        PlayerInfo[playerid][pColorID] = dini_Int(UserPath(playerid), "ColorID");
    }
    switch(PlayerInfo[playerid][pModel])
    {
        case 0:SetPlayerColor(playerid, WHITE);
        case 1:SetPlayerColor(playerid, GREEN);
        case 2:SetPlayerColor(playerid, RED);
        case 3:SetPlayerColor(playerid, YELLOW);
        case 4:SetPlayerColor(playerid, BLUE);
        case 5:SetPlayerColor(playerid, PURPLE);
        case 6:SetPlayerColor(playerid, GOLD);
        case 7:SetPlayerColor(playerid, PINK);
        case 8:SetPlayerColor(playerid, ORANGE);
        case 9:SetPlayerColor(playerid, BLACK);
        case 10:SetPlayerColor(playerid, GREY);
        case 11:SetPlayerColor(playerid, BROWN);
    }
    return 1;
}

public OnPlayerSpawn(playerid)
{
    if(PlayerInfo[playerid][pModel] >= 0 || PlayerInfo[playerid][pModel] < 300) SetPlayerSkin(playerid, PlayerInfo[playerid][pModel]);
    return 1;
}

CMD:color(playerid, params[])
{
    ShowPlayerDialog(playerid, DIALOG_COLOR, DIALOG_STYLE_LIST, "Player Color", "White\nGreen\nRed\nYellow\nBlue\nPurple\nGold\nPink\nOrange\nBlack\nGrey\nBrown", "Choose", "Close");
    return 1;
}

CMD:skin(playerid, params[])
{
    ShowPlayerDialog(playerid, DIALOG_SKIN, DIALOG_STYLE_INPUT, "Skin selection", "Type in a skin you would like to have.", "Choose", "Cancel");
    return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == DIALOG_COLOR && response)
    {
        switch(listitem)
        {
            case 0:
            {
                GameTextForPlayer(playerid,"~y~Color set to White",2000,3);
                SetPlayerColor(playerid, WHITE);
            }
            case 1:
            {
                GameTextForPlayer(playerid,"~y~Color set to Green",2000,3);
                SetPlayerColor(playerid, GREEN);
            }
            case 2:
            {
                GameTextForPlayer(playerid,"~y~Color set to Red",2000,3);
                SetPlayerColor(playerid, RED);
            }
            case 3:
            {
                GameTextForPlayer(playerid,"~y~Color set to Yellow",2000,3);
                SetPlayerColor(playerid, YELLOW);
            }
            case 4:
            {
                GameTextForPlayer(playerid,"~y~Color set to Blue",2000,3);
                SetPlayerColor(playerid, BLUE);
            }
            case 5:
            {
                GameTextForPlayer(playerid,"~y~Color set to Purple",2000,3);
                SetPlayerColor(playerid, PURPLE);
            }
            case 6:
            {
                GameTextForPlayer(playerid,"~y~Color set to Gold",2000,3);
                SetPlayerColor(playerid, GOLD);
            }
            case 7:
            {
                GameTextForPlayer(playerid,"~y~Color set to Pink",2000,3);
                SetPlayerColor(playerid, PINK);
            }
            case 8:
            {
                GameTextForPlayer(playerid,"~y~Color set to Orange",2000,3);
                SetPlayerColor(playerid, ORANGE);
            }
            case 9:
            {
                GameTextForPlayer(playerid,"~y~Color set to Black",2000,3);
                SetPlayerColor(playerid, BLACK);
            }
            case 10:
            {
                GameTextForPlayer(playerid,"~y~Color set to Grey",2000,3);
                SetPlayerColor(playerid, GREY);
            }
            case 11:
            {
                GameTextForPlayer(playerid,"~y~Color set to Brown",2000,3);
                SetPlayerColor(playerid, BROWN);
            }
        }
        PlayerInfo[playerid][pModel] = listitem;
        return 1;
    }
    if(dialogid == DIALOG_SKIN && response)
    {
        if(strval(inputtext) < 0 || strval(inputtext) > 299) SendClientMessage(playerid, WHITE, "SERVER: Cannot go under 0 or above 299.");
        new skin = strval(inputtext);
        PlayerInfo[playerid][pModel] = skin;
        SetPlayerSkin(playerid, skin);
        GameTextForPlayer(playerid,"~g~Skin ~g~Changed",2000,3);
        return 1;
    }
    return 0;
}
Reply


Messages In This Thread
Color/Skin problem after Spawning - by kbalor - 23.07.2012, 17:32
Re: Color/Skin problem after Spawning - by [IKS]Niko_Hs™ - 23.07.2012, 18:27
Re: Color/Skin problem after Spawning - by kbalor - 23.07.2012, 18:31
Re: Color/Skin problem after Spawning - by [IKS]Niko_Hs™ - 23.07.2012, 18:58
Re: Color/Skin problem after Spawning - by kbalor - 23.07.2012, 19:05
Re: Color/Skin problem after Spawning - by [IKS]Niko_Hs™ - 23.07.2012, 19:08
Re: Color/Skin problem after Spawning - by kbalor - 23.07.2012, 19:12
Re: Color/Skin problem after Spawning - by [IKS]Niko_Hs™ - 23.07.2012, 19:15
Re: Color/Skin problem after Spawning - by kbalor - 23.07.2012, 19:21
Re: Color/Skin problem after Spawning - by [IKS]Niko_Hs™ - 23.07.2012, 19:36

Forum Jump:


Users browsing this thread: 3 Guest(s)