Help with my /givetag command.
#1

Hi, I created a command to give a tag, This tag is going to be displayed above the head of the players. The command is working properly.
I have to do /givetag (ID) (Text)...
I'd like to add an extra parameter called "color".
Players must do /givetag (ID) (Text) (Color)
I have tried to do it, but I'm requesting help.
I don't know how to intruduce colors in my command. Such as "green","blue".
The command is here:
PHP код:
CMD:givetag(playeridparams[])
{
    new 
targetid; new text[128]; new color;
    if(
sscanf(params"us[128]s",targetidtextcolor)) return SendClientMessage(playeridCOLOR_ORANGE"Usage: /givetag (ID) (Text) (Color) ");
    
SetPlayerChatBubble(targetidtextcolor100.0600000);
    return 
1;

Reply
#2

pawn Код:
CMD:givetag(playerid, params[])
{
    new targetid; new text[128]; new color;
    if(sscanf(params, "us[128]s",targetid, text, color)) return SendClientMessage(playerid, COLOR_ORANGE, "Usage: /givetag (ID) (Text) (Color) ");
    if(!strcmp(color, "green", true, 5))
    {
        SetPlayerChatBubble(targetid, text, /*green color*/, 100.0, 600000);
    }
//so on
    return 1;
}
try it
Reply
#3

In my opinion, you can't use more than 1 strings in a function.
Reply
#4

Quote:
Originally Posted by [HK]Ryder[AN]
Посмотреть сообщение
pawn Код:
CMD:givetag(playerid, params[])
{
    new targetid; new text[128]; new color;
    if(sscanf(params, "us[128]s",targetid, text, color)) return SendClientMessage(playerid, COLOR_ORANGE, "Usage: /givetag (ID) (Text) (Color) ");
    if(!strcmp(color, "green", true, 5))
    {
        SetPlayerChatBubble(targetid, text, /*green color*/, 100.0, 600000);
    }
//so on
    return 1;
}
try it
You're right!
Cheers!
Thanks.
Reply
#5

WHAT? /givetag blah blah blah green works?
Reply
#6

Well.
It's not working since I have 3 errors:
Код:
C:\Users\USER\Documents\samp03e_svr_R2_win32\gamemodes\TestGM.pwn(129) : error 035: argument type mismatch (argument 1)
C:\Users\USER\Documents\samp03e_svr_R2_win32\gamemodes\TestGM.pwn(133) : error 035: argument type mismatch (argument 1)
C:\Users\USER\Documents\samp03e_svr_R2_win32\gamemodes\TestGM.pwn(137) : error 035: argument type mismatch (argument 1)
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


3 Errors.

PHP код:
CMD:givetag(playeridparams[])
{
    new 
targetid; new text[128]; new color;
    if(
sscanf(params"us[128]s",targetidtextcolor)) return SendClientMessage(playeridCOLOR_ORANGE"Usage: /givetag (ID) (Text) (Color) ");
    if(
strcmp(color"green"true) == 0)
    {
    
SetPlayerChatBubble(targetidtextCOLOR_GREEN100.0600000);
    }
       else if(
strcmp(color"blue"true) == 0)
    {
    
SetPlayerChatBubble(targetidtextCOLOR_BLUE100.0600000);
    }
       else if(
strcmp(color"gold"true) == 0)
    {
    
SetPlayerChatBubble(targetidtextCOLOR_GOLD100.0600000);
    }
    return 
1;

Reply
#7

pawn Код:
new color[32];
And yet, it will not work. Where is separator between two strings? Nowhere.
Reply
#8

It worked!
Thanks.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)