SA-MP Forums Archive
Help with my /givetag command. - 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: Help with my /givetag command. (/showthread.php?tid=402962)



Help with my /givetag command. - Magic_Time - 28.12.2012

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;




Re: Help with my /givetag command. - [HK]Ryder[AN] - 28.12.2012

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


Re: Help with my /givetag command. - Diorturato - 28.12.2012

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


Re: Help with my /givetag command. - Magic_Time - 28.12.2012

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.


Re: Help with my /givetag command. - Diorturato - 28.12.2012

WHAT? /givetag blah blah blah green works?


Re: Help with my /givetag command. - Magic_Time - 28.12.2012

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;




Re: Help with my /givetag command. - Diorturato - 28.12.2012

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


Re: Help with my /givetag command. - Magic_Time - 28.12.2012

It worked!
Thanks.