#1

PHP код:
COMMAND:label(playeridparams[])
{
    if (
playerData[playerid][playerLoggedIn])
    {
        if(
playerData[playerid][HasCustomLable] == false)
        {
            new 
value[25];
            if(
sscanf(params"s"value))
            {
                return 
SendClientMessage(playeridCOLOR_WHITE"{B7B7B7}[SERVER] {FFFF00}Usage: /lable TEXT [COST = 4000XP]");
            }
            else
            {
                if (
playerData[playerid][playerXP] >= 4000)
                {
                    if(
strlen(value) < 16)
                    {
                        
playerGiveXP(playerid, -4000);
                        
playerData[playerid][CustomLabel] = Create3DTextLabel(value0xFFDC2EFF30.040.050.060.0, -11);
                        
Attach3DTextLabelToPlayer(playerData[playerid][CustomLabel], playerid0.00.00.4);
                        
playerData[playerid][HasCustomLable] = true;
                        
SendClientMessage(playeridCOLOR_RED"Label succesfully updated!");
                    }
                    else
                    {
                        
SendClientMessage(playeridCOLOR_RED"Label length must be inferior to 16!");
                    }
                }
                else
                {
                    
SendClientMessage(playeridCOLOR_RED"You dont have enough xp to do that!");
                }
            }
        }
        else if(
playerData[playerid][HasCustomLable] == true)
            {
                
Delete3DTextLabel(playerData[playerid][CustomLabel]);
                
SendClientMessage(playerid, -1"Lable has been removed!");
            }
    }        
    return 
1;

no errors on compilation, but gives no answer on /label (or /label something) and when with the one i posted above /label triggers as player already has custom lable and tends to remove it

PHP код:
[16:50:27Lable has been removed
Reply
#2

Try this.
You were calling an else statement for
Код:
if(sscanf(params, "s", value))
Instead of
Код:
if(playerData[playerid][HasCustomLable] == false)
This code should work out for you.

PHP код:
COMMAND:label(playeridparams[])
{
    if (
playerData[playerid][playerLoggedIn])
    {
        if(
playerData[playerid][HasCustomLable] == false)
        {
            new 
value[25];
            if(
sscanf(params"s"value)) return SendClientMessage(playeridCOLOR_WHITE,  "{B7B7B7}[SERVER] {FFFF00}Usage: /lable TEXT [COST = 4000XP]");
            if(
playerData[playerid][HasCustomLable] == true)
            {
                
Delete3DTextLabel(playerData[playerid][CustomLabel]);
                
SendClientMessage(playerid, -1"Lable has been removed!");
            }
            else
            {
                if (
playerData[playerid][playerXP] >= 4000)
                {
                    if(
strlen(value) < 16)
                    {
                        
playerGiveXP(playerid, -4000);
                        
playerData[playerid][CustomLabel] = Create3DTextLabel(value0xFFDC2EFF30.040.050.060.0, -11);
                        
Attach3DTextLabelToPlayer(playerData[playerid][CustomLabel], playerid0.00.00.4);
                        
playerData[playerid][HasCustomLable] = true;
                        
SendClientMessage(playeridCOLOR_RED"Label succesfully updated!");
                    }
                    else
                    {
                        
SendClientMessage(playeridCOLOR_RED"Label length must be inferior to 16!");
                    }
                }
                else
                {
                    
SendClientMessage(playeridCOLOR_RED"You dont have enough xp to do that!");
                }
            }
        }
    }
    return 
1;

Reply
#3

I dont get it... you're putting HasCustomLable true into HasCustomLable False... ? i mean if the HasCustomLable value is true system is never going to enter into loop if
Reply
#4

ps: it doesnt work, server just doesnt answers... not even error message
Reply
#5

Bump
Reply
#6

Can I ask why you have "HasCustomLable" and then "CustomLabel" Not sure if you realize but you're spelling Label wrong in the first variable. May be your issue? I'll take a closer look soon.
Reply
#7

Код:
COMMAND:label(playerid, params[])
{
	if (playerData[playerid][playerLoggedIn])
	{
        if(playerData[playerid][HasCustomLable] == false)
        {
            new value[25];
//            if(sscanf(params, "s", value))
            if(sscanf(params, "s[25]", value))
            {
                return SendClientMessage(playerid, COLOR_WHITE, "{B7B7B7}[SERVER] {FFFF00}Usage: /lable TEXT [COST = 4000XP]");
            }
            else
            {
                if (playerData[playerid][playerXP] >= 4000)
                {
                    if(strlen(value) < 16)
                    {
                        playerGiveXP(playerid, -4000);
                        playerData[playerid][CustomLabel] = Create3DTextLabel(value, 0xFFDC2EFF, 30.0, 40.0, 50.0, 60.0, -1, 1);
                        Attach3DTextLabelToPlayer(playerData[playerid][CustomLabel], playerid, 0.0, 0.0, 0.4);
                        playerData[playerid][HasCustomLable] = true;
                        SendClientMessage(playerid, COLOR_RED, "Label succesfully updated!");
                    }
                    else
                    {
                        SendClientMessage(playerid, COLOR_RED, "Label length must be inferior to 16!");
                    }
                }
                else
                {
                    SendClientMessage(playerid, COLOR_RED, "You dont have enough xp to do that!");
                }
            }
        }
        else if(playerData[playerid][HasCustomLable] == true)
            {
                Delete3DTextLabel(playerData[playerid][CustomLabel]);
                SendClientMessage(playerid, -1, "Lable has been removed!");
            }
    }

    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)