/label problem [may give you an idea]
#1

i have made a /label command which when you write /label <Text> it appears above your head but the problem is when i write it all the players in the server who wrote /label <text> its removed from their head and its only me and if i wrote /deletelabel it deletes the whole player's texts

pawn Код:
//at the very top
new Text3D:ltext[MAX_PLAYERS];
pawn Код:
dcmd_label(playerid,params[])
{
    #pragma unused params
    new string[128];
    if(!strlen(params))
    {
        SendClientMessage(playerid,COLOR_ERROR,"USAGE: /label (Text)");
        return 1;
    }
    if(IsSpawned[playerid] == 0)
    {
        SendClientMessage(playerid,COLOR_ERROR,"You must be alive and spawned in order to be able to use this command.");
        return 1;
    }
for(new i=0; i<MAX_PLAYERS; i++)
    {
     format(string,sizeof(string),"%s",params);
         Update3DTextLabelText(ltext[playerid], 0xFFFFFFAA, string);
     Attach3DTextLabelToPlayer(ltext[playerid], playerid, 0.0, 0.0, 0.6);
return 1;
    }
return 1;
}
deletelabel command
pawn Код:
dcmd_deletelabel(playerid,params[])
{
  #pragma unused params
Update3DTextLabelText(ltext[playerid], 0xFFFFFFAA, " ");//making it invisible
  return 1;
}
Reply
#2

help? its serious
Reply
#3

please help guys there arelots fo good ppl here
Reply
#4

You dont have to loop it
pawn Код:
dcmd_label(playerid,params[])
{
    #pragma unused params
    new string[128];
    if(!strlen(params))
    {
        SendClientMessage(playerid,COLOR_ERROR,"USAGE: /label (Text)");
        return 1;
    }
    if(IsSpawned[playerid] == 0)
    {
        SendClientMessage(playerid,COLOR_ERROR,"You must be alive and spawned in order to be able to use this command.");
        return 1;
    }
    format(string,sizeof(string),"%s",params);
    Update3DTextLabelText(ltext[playerid], 0xFFFFFFAA, string);
    Attach3DTextLabelToPlayer(ltext[playerid], playerid, 0.0, 0.0, 0.6);
    return 1;
}
Reply
#5

Why are you using a loop

pawn Код:
dcmd_label(playerid,params[])
{
    //#pragma unused params seriously? you are using params

    new string[128];
    if(sscanf(params,"s[128]",string)) return  SendClientMessage(playerid,COLOR_ERROR,"USAGE: /label (Text)");
    if(IsSpawned[playerid] == 0)return SendClientMessage(playerid,COLOR_ERROR,"You must be alive and spawned in order to be able to use this command.");

    Update3DTextLabelText(ltext[playerid], 0xFFFFFFAA, string);
    Attach3DTextLabelToPlayer(ltext[playerid], playerid, 0.0, 0.0, 0.6);
    return 1;
}
Reply
#6

Quote:
Originally Posted by IceMeteor
Посмотреть сообщение
You dont have to loop it
pawn Код:
dcmd_label(playerid,params[])
{
    #pragma unused params
    new string[128];
    if(!strlen(params))
    {
        SendClientMessage(playerid,COLOR_ERROR,"USAGE: /label (Text)");
        return 1;
    }
    if(IsSpawned[playerid] == 0)
    {
        SendClientMessage(playerid,COLOR_ERROR,"You must be alive and spawned in order to be able to use this command.");
        return 1;
    }
    format(string,sizeof(string),"%s",params);
    Update3DTextLabelText(ltext[playerid], 0xFFFFFFAA, string);
    Attach3DTextLabelToPlayer(ltext[playerid], playerid, 0.0, 0.0, 0.6);
    return 1;
}
thanks alot bro rep +
Reply
#7

Quote:
Originally Posted by [MM]RoXoR[FS]
Посмотреть сообщение
Why are you using a loop

pawn Код:
dcmd_label(playerid,params[])
{
    //#pragma unused params seriously? you are using params

    new string[128];
    if(sscanf(params,"s[128]",string)) return  SendClientMessage(playerid,COLOR_ERROR,"USAGE: /label (Text)");
    if(IsSpawned[playerid] == 0)return SendClientMessage(playerid,COLOR_ERROR,"You must be alive and spawned in order to be able to use this command.");

    Update3DTextLabelText(ltext[playerid], 0xFFFFFFAA, string);
    Attach3DTextLabelToPlayer(ltext[playerid], playerid, 0.0, 0.0, 0.6);
    return 1;
}
dude.. ofcourse i need params because its not a stable text they can change it when ever they want they can write what ever they want and if ur so genius u just commented on #pargma unused paramas and u forgot that it will give u a warning becuz dcmd_label(playerid,params[])
Reply
#8

Quote:
Originally Posted by CROSS_Hunter
Посмотреть сообщение
dude.. ofcourse i need params because its not a stable text they can change it when ever they want they can write what ever they want and if ur so genius u just commented on #pargma unused paramas and u forgot that it will give u a warning becuz dcmd_label(playerid,params[])
I am sure you have not even tested it.
Код:
#pragma unused params
tells the compiler that you have not used it and hence you do not get any Symbol Never Used Warning.

But if look in my/your script, you have used params quite a few times.
So there was no need to add #pragma unused params.

I hope you get it.
Reply
#9

Quote:
Originally Posted by [MM]RoXoR[FS]
Посмотреть сообщение
I am sure you have not even tested it.
Код:
#pragma unused params
tells the compiler that you have not used it and hence you do not get any Symbol Never Used Warning.

But if look in my/your script, you have used params quite a few times.
So there was no need to add #pragma unused params.

I hope you get it.
dude ok i get u but the problem is still the same the label of the player beside me disappears when i set my label why is that? what code should i use ? help
Reply
#10

help any one?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)