18.05.2014, 00:33
hi all...
i got one question....
why is my player's color turned into black when they are died?
i got one question....
why is my player's color turned into black when they are died?
SetPlayerColor(playerid, GetPlayerColor(playerid));
public OnPlayerDeath(playerid, killerid, reason)
public OnPlayerDeath(playerid, killerid, reason)
{
LoadColor(playerid);
return 1;
}
stock LoadColor(playerid)
{
if(pInfo[playerid][pUseCol] == 1)
{
/*new color;
//strmid(color,pInfo[playerid][pColor], 0, strlen(pInfo[playerid][pColor]), 11);
color = pInfo[playerid][pColor];
color <<= 8;
color |= 0xFF;*/
SetPlayerColor(playerid, pInfo[playerid][pColor]);
}
if(pInfo[playerid][pUseCol] == 0)
{
SetPlayerColor(playerid, PlayerColors[playerid]);
}
}
if(pInfo[playerid][pUseCol] == 1)
{
/*new color;
//strmid(color,pInfo[playerid][pColor], 0, strlen(pInfo[playerid][pColor]), 11);
color = pInfo[playerid][pColor];
color <<= 8;
color |= 0xFF;*/
SetPlayerColor(playerid, pInfo[playerid][pColor]);
}
if(pInfo[playerid][pUseCol] == 1)
{
/*new color;
//strmid(color,pInfo[playerid][pColor], 0, strlen(pInfo[playerid][pColor]), 11);
color = pInfo[playerid][pColor];
color <<= 8;
color |= 0xFF;*/
SetPlayerColor(playerid, pInfo[playerid][pColor]);
printf("%d", pInfo[playerid][pColor]);
}
stock LoadColor(playerid)
return SetPlayerColor(playerid, ((pInfo[playerid][pUseCol]) ? (pInfo[playerid][pColor]) : (PlayerColors[playerid])));
pInfo[playerid][pColor] is the wrong value.
Do this: pawn Код:
EDIT: You can also shorten your code to: pawn Код:
|
stock LoadColor(playerid,onlogin)
{
if(onlogin == 1) return SetPlayerColor(playerid, ((pInfo[playerid][pUseCol]) ? (pInfo[playerid][pColor]) : (PlayerColors[playerid]))), printf("%d", pInfo[playerid][pColor]);
return 1;
}
LoadColor(playerid, 0);