SA-MP Forums Archive
3DTEXTLABEL help - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: 3DTEXTLABEL help (/showthread.php?tid=376567)



3DTEXTLABEL help - UnAngel - 10.09.2012

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);
  ) 



Re: 3DTEXTLABEL help - Roko_foko - 10.09.2012

Where do you call this OneSecondPublic?


Re: 3DTEXTLABEL help - UnAngel - 11.09.2012

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


Re: 3DTEXTLABEL help - clarencecuzz - 11.09.2012

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.


Re: 3DTEXTLABEL help - mamorunl - 11.09.2012

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);


Re: 3DTEXTLABEL help - Audiophr3ak - 11.09.2012

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;




Re: 3DTEXTLABEL help - clarencecuzz - 11.09.2012

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;
}



Re: 3DTEXTLABEL help - Audiophr3ak - 11.09.2012

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.


Re: 3DTEXTLABEL help - mamorunl - 11.09.2012

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


Re: 3DTEXTLABEL help - Audiophr3ak - 11.09.2012

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.