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
#2

Replace your code with

Код:
public OnPlayerSpawn(playerid)
{
if(PlayerInfo[playerid][pModel] >= 0 || PlayerInfo[playerid][pModel] < 300) return true;
return 1;
}
In the callback onplayerspawn was the code that changed the skin
Reply
#3

Quote:
Originally Posted by [IKS]Niko_Hs™
Посмотреть сообщение
Replace your code with

Код:
public OnPlayerSpawn(playerid)
{
if(PlayerInfo[playerid][pModel] >= 0 || PlayerInfo[playerid][pModel] < 300) ;
return 1;
}
In the callback onplayerspawn was the code that changed the skin
Thanks for the reply. Got warning It says

Код:
error 036: empty statement
Reply
#4

Remove the string :

Код:
if(PlayerInfo[playerid][pModel] >= 0 || PlayerInfo[playerid][pModel] < 300) ;
Reply
#5

Quote:
Originally Posted by [IKS]Niko_Hs™
Посмотреть сообщение
Oops, I'm sorry try this:

Код:
if(PlayerInfo[playerid][pModel] >= 0 || PlayerInfo[playerid][pModel] < 300) return 0;
This string can also remove..
Man the warning fix. But when get killed and spawn it change to Skin of CJ or ID 0 (Only Skin of CJ)
Reply
#6

You deleted the string?
Reply
#7

Quote:
Originally Posted by [IKS]Niko_Hs™
Посмотреть сообщение
You deleted the string?
I just copied what you posted.

And for the
Код:
	if(PlayerInfo[playerid][pModel] >= 0 || PlayerInfo[playerid][pModel] < 300) ;
it says
Код:
error 036: empty statement
Reply
#8

Delete this string :

Код:
if(PlayerInfo[playerid][pModel] >= 0 || PlayerInfo[playerid][pModel] < 300) ;
Код:
public OnPlayerSpawn(playerid)
{
return 1;
}
In this way will not set any skins
Reply
#9

Quote:
Originally Posted by [IKS]Niko_Hs™
Посмотреть сообщение
Delete this string :

Код:
if(PlayerInfo[playerid][pModel] >= 0 || PlayerInfo[playerid][pModel] < 300) ;
Код:
public OnPlayerSpawn(playerid)
{
return 1;
}
In this way will not set any skins
I did delete the whole string. Still changing back to Cj Skin. Hopefully there is a answer here

On my gamemode...

Код:
public OnPlayerSpawn(playerid)
{
        pInEvent[playerid] = 0;
	new Random = random(sizeof(RandomSpawns));
        SetPlayerPos(playerid, RandomSpawns[Random][0], RandomSpawns[Random][1], RandomSpawns[Random][2]);
	SetPlayerInterior(playerid, 0);
	SetPlayerVirtualWorld(playerid, 0);
	return 1;
}
Reply
#10

Код:
public OnPlayerSpawn(playerid)
{
SetPlayerSkin(playerid, PlayerInfo[playerid][pModel]);
return 1;
}
If your skin has been saved, you can recover it with this script to spawn
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)