3DTEXTLABEL help
#1

Hello i start to bullid a mask system but i have problem its work only to id 0 please help me



PHP код:
public OneSecondPublic(playerid)
{
    
Delete3DTextLabel(Mask[playerid]);
    new 
FloatHealthFloatArmourArmourMathFlawHealthMathFlaw;
    
GetPlayerHealth(playeridHealth);
    
GetPlayerArmour(playeridArmour);
    
HealthMathFlaw floatround(Healthfloatround_ceil);
    
ArmourMathFlaw floatround(Armourfloatround_ceil);
    
MaskedName[playerid] = Player[playerid][MaskRandom];
    
format(sendernameMAX_PLAYER_NAME"Mask[%d]\nHP:%d AR:%d",MaskedName[playerid],HealthMathFlaw,ArmourMathFlaw);
    new 
Float:xFloat:yFloat:z;
    
GetPlayerPos(playerid,x,y,z);
    
Mask[playerid] = Create3DTextLabel(sendername,WHITE,x,y,z+2,20,0,0);
    
Attach3DTextLabelToPlayer(Mask[playerid],playerid,0.0,0.0,0.0);
  ) 
Reply
#2

Where do you call this OneSecondPublic?
Reply
#3

on gamemodeint
On‌eSecondTimer = SetTimer("OneSecondPublic", 1000, true);
Reply
#4

There is no 'playerid' parameter in OnGameModeInit...
You need to use this in a public function that involves a playerid parameter, for example, in a command under OnPlayerCommandText or OnPlayerConnect etc.
Reply
#5

Plus that you cannot create the playerid parameter out of the blue. You have to assign it to the timer with SetTimerEx("OneSecondPublic", 1000, true, "i", playerid);
Reply
#6

PHP код:
public OneSecondPublic()
{
    for (new 
iMAX_PLAYERSi++)
    {
        new 
FloatHealthFloatArmourArmourMathFlawHealthMathFlaw;
        
GetPlayerHealth(iHealth);
        
GetPlayerArmour(iArmour);
        
HealthMathFlaw floatround(Healthfloatround_ceil);
        
ArmourMathFlaw floatround(Armourfloatround_ceil);
        
MaskedName[i] = Player[i][MaskRandom];
        
format(sendernameMAX_PLAYER_NAME"Mask[%d]\nHP:%d AR:%d",MaskedName[playerid],HealthMathFlaw,ArmourMathFlaw);
        
Update3DTextLabelText(Mask[i], 0xFFFFFFFFsendername);
    }
    return 
1;

Reply
#7

Quote:
Originally Posted by Audiophr3ak
Посмотреть сообщение
PHP код:
public OneSecondPublic()
{
    for (new 
iMAX_PLAYERSi++)
    {
        new 
FloatHealthFloatArmourArmourMathFlawHealthMathFlaw;
        
GetPlayerHealth(iHealth);
        
GetPlayerArmour(iArmour);
        
HealthMathFlaw floatround(Healthfloatround_ceil);
        
ArmourMathFlaw floatround(Armourfloatround_ceil);
        
MaskedName[i] = Player[i][MaskRandom];
        
format(sendernameMAX_PLAYER_NAME"Mask[%d]\nHP:%d AR:%d",MaskedName[playerid],HealthMathFlaw,ArmourMathFlaw);
        
Update3DTextLabelText(Mask[i], 0xFFFFFFFFsendername);
    }
    return 
1;

Wrong...
pawn Код:
public OnGameModeInit()
{
    SetTimer("OneSecondPublic", 1000, true);
    return 1;
}

forward OneSecondPublic();
public OneSecondPublic()
{
    for (new i; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            new Float: Health, Float: Armour, ArmourMathFlaw, HealthMathFlaw;
            GetPlayerHealth(i, Health);
            GetPlayerArmour(i, Armour);
            HealthMathFlaw = floatround(Health, floatround_ceil);
            ArmourMathFlaw = floatround(Armour, floatround_ceil);
            MaskedName[i] = Player[i][MaskRandom];
            format(sendername, MAX_PLAYER_NAME, "Mask[%d]\nHP:%d AR:%d",MaskedName[i],HealthMathFlaw,ArmourMathFlaw);
            Update3DTextLabelText(Mask[i], 0xFFFFFFFF, sendername);
        }
    }
    return 1;
}
Reply
#8

Quote:
Originally Posted by clarencecuzz
Посмотреть сообщение
Wrong...
pawn Код:
public OnGameModeInit()
{
    SetTimer("OneSecondPublic", 1000, true);
    return 1;
}

forward OneSecondPublic();
public OneSecondPublic()
{
    for (new i; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            new Float: Health, Float: Armour, ArmourMathFlaw, HealthMathFlaw;
            GetPlayerHealth(i, Health);
            GetPlayerArmour(i, Armour);
            HealthMathFlaw = floatround(Health, floatround_ceil);
            ArmourMathFlaw = floatround(Armour, floatround_ceil);
            MaskedName[i] = Player[i][MaskRandom];
            format(sendername, MAX_PLAYER_NAME, "Mask[%d]\nHP:%d AR:%d",MaskedName[i],HealthMathFlaw,ArmourMathFlaw);
            Update3DTextLabelText(Mask[i], 0xFFFFFFFF, sendername);
        }
    }
    return 1;
}
WRONG?! You trollin' meh? He already forwarded that function and made a timer.
Reply
#9

You forgot to check if the player is connected which could've caused some unexpected side effects
Reply
#10

Quote:
Originally Posted by mamorunl
Посмотреть сообщение
You forgot to check if the player is connected which could've caused some unexpected side effects
IK, i just edited it basically to make it work atleast.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)