Need help with 3dText
#1

I need this command where if a player types: /channel 1 it displays "Channel: 1" above their head, if they type channel 2 it displays "Channel: 2" above their head and so on..
If the player already has "Channel 1" displayed above their head and the player decides to switch to /channel 2 it has to change to "Channel 2"
I've been trying all day to get this to work but I cannot manage to get it done, here is what I have:
PHP код:
CMD:channel(playerid,params[])
{
    if(
isnull(params)) return SendClientMessage(playeridCOLOR_GREY"/channel (Channel ID)");
    {
    if(!
strcmp(params"1"true7))
    {
    
Channel1[playerid] = Create3DTextLabel("Channel: 1"0xE91616FF0001701);
    
Attach3DTextLabelToPlayer(Channel1[playerid], playerid0.00.00.275);
    
PlayerGlobalMessage(playerid,20.0"Has switched to channel 1.");
    }
    else if(!
strcmp(params"2"true7))
    {
    
Channel2[playerid] = Create3DTextLabel("Channel: 2"0xE91616FF0001701);
    
Attach3DTextLabelToPlayer(Channel2[playerid], playerid0.00.00.275);
    
PlayerGlobalMessage(playerid,20.0"Has switched to channel 2.");
    
Delete3DTextLabel(Channel1[playerid]);
    }
    }
    return 
1;

I don't know if this is anywhere close to what it's supposed to be but I don't know..
If you can help me that'd be great. Thanks in advance.
Reply
#2

Try this bro:
Quote:

CMD:channel(playerid,params[])
{
if(isnull(params)) return SendClientMessage(playerid, COLOR_GREY, "/channel (Channel ID)");
{
if(!strcmp(params, "1", true, 7))
{
if(Channel1[playerid] != INVALID_3DTEXT_ID)
{
Delete3DTextLabel(Channel1[playerid]);
}
Channel1[playerid] = Create3DTextLabel("Channel: 1", 0xE91616FF, 0, 0, 0, 17, 0, 1);
Attach3DTextLabelToPlayer(Channel1[playerid], playerid, 0.0, 0.0, 0.275);
PlayerGlobalMessage(playerid,20.0, "Has switched to channel 1.");
}
else if(!strcmp(params, "2", true, 7))
{
if(Channel1[playerid] != INVALID_3DTEXT_ID)
{
Delete3DTextLabel(Channel1[playerid]);
}
Channel2[playerid] = Create3DTextLabel("Channel: 2", 0xE91616FF, 0, 0, 0, 17, 0, 1);
Attach3DTextLabelToPlayer(Channel2[playerid], playerid, 0.0, 0.0, 0.275);
PlayerGlobalMessage(playerid,20.0, "Has switched to channel 2.");
}
}
return 1;
}

Reply
#3

Quote:
Originally Posted by Kraeror
Посмотреть сообщение
Try this bro:
Getting Tag mismatches on:

PHP код:
if(Channel1[playerid] != INVALID_3DTEXT_ID)
if(
Channel1[playerid] != INVALID_3DTEXT_ID
Reply
#4

Here you are, I think it is working fine:
Quote:

CMD:channel(playerid,params[])
{
if(isnull(params)) return SendClientMessage(playerid, COLOR_GREY, "/channel (Channel ID)");
{
if(!strcmp(params, "1", true, 7))
{
Delete3DTextLabel(Channel1[playerid]);
Channel1[playerid] = Create3DTextLabel("Channel: 1", 0xE91616FF, 0, 0, 0, 17, 0, 1);
Attach3DTextLabelToPlayer(Channel1[playerid], playerid, 0.0, 0.0, 0.275);
PlayerGlobalMessage(playerid,20.0, "Has switched to channel 1.");
}
else if(!strcmp(params, "2", true, 7))
{
Delete3DTextLabel(Channel1[playerid]);
Channel2[playerid] = Create3DTextLabel("Channel: 2", 0xE91616FF, 0, 0, 0, 17, 0, 1);
Attach3DTextLabelToPlayer(Channel2[playerid], playerid, 0.0, 0.0, 0.275);
PlayerGlobalMessage(playerid,20.0, "Has switched to channel 2.");
}
}
return 1;
}

Reply
#5

Quote:
Originally Posted by Kraeror
Посмотреть сообщение
Here you are, I think it is working fine:
It works but I'm stil having one issue tough.
If player 1 has "Channel 1" or "Channel 2" above their head and player 2 then uses the command /channel it removes the 3dtext from player 1 and puts it either "Channel 1" or "Channel 2" above player 2's head (whichever one they have chosen)
Reply
#6

Quote:
Originally Posted by Cubie
Посмотреть сообщение
It works but I'm stil having one issue tough.
If player 1 has "Channel 1" or "Channel 2" above their head and player 2 then uses the command /channel it removes the 3dtext from player 1 and puts it either "Channel 1" or "Channel 2" above player 2's head (whichever one they have chosen)
Anybody? Please I need this to work
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)