SA-MP Forums Archive
Attachlabel - 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: Attachlabel (/showthread.php?tid=617508)



Attachlabel - iLearner - 22.09.2016

PHP код:
COMMAND:label(playeridparams[])
{
    if (
playerData[playerid][playerLoggedIn])
    {
        if(
playerData[playerid][HasCustomLable])
        {
            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("%s"0xFFDC2EFF30.040.050.060.0, -11value);
                        
Attach3DTextLabelToPlayer(playerData[playerid][CustomLabel], playerid0.00.00.4);
                        
playerData[playerid][HasCustomLable] = true;
                    }
                }
            }
        }
        else if(
playerData[playerid][HasCustomLable] == false)
            {
                
Delete3DTextLabel(playerData[playerid][CustomLabel]);
                
SendClientMessage(playerid, -1"Lable has been removed!");
            }
    }        
    return 
1;

.../cnr_commands.inc(2603) : warning 202: number of arguments does not match definition

line 2603:
playerData[playerid][CustomLabel] = Create3DTextLabel("%s", 0xFFDC2EFF, 30.0, 40.0, 50.0, 60.0, -1, 1, value);


Re: Attachlabel - StR_MaRy - 22.09.2016

try this

Код HTML:
playerData[playerid][CustomLabel] = Create3DTextLabel("%s, 40.0, 50.0", 0x008080FF, 30.0, 40.0, 50.0, 40.0, 0, 0);



Re: Attachlabel - iLearner - 22.09.2016

That %s needs something bruh....


Re: Attachlabel - StR_MaRy - 22.09.2016

put after last 0, value

like this

Код HTML:
playerData[playerid][CustomLabel] = Create3DTextLabel("%s, 40.0, 50.0", 0x008080FF, 30.0, 40.0, 50.0, 40.0, 0, 0, value);



Re: Attachlabel - iLearner - 22.09.2016

... you what... the line that gives me warning is same as you printed in post above :3


Re: Attachlabel - Konstantinos - 22.09.2016

Why would you want to pass another argument (which is not format to begin with) to the function? value is already string. You don't need sscanf either (you have used it wrong too because "s" specifier needs length in [] next to it).

pawn Код:
if (isnull(params)) return ... // usage
in strlen function you replace value with params and last:
pawn Код:
playerData[playerid][CustomLabel] = Create3DTextLabel(params, 0xFFDC2EFF, 30.0, 40.0, 50.0, 60.0, -1, 1);



Re: Attachlabel - iLearner - 22.09.2016

I see you're promoting usage of (isnull(params) for single vars... How come BTW?