Raised This Month: $51 Target: $400
 12% 

name function with double name arg


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
sparkey
Senior Member
Join Date: May 2010
Old 08-03-2010 , 02:17   name function with double name arg
Reply With Quote #1

PHP Code:
    if ((!equal(nick"0")) && (!equal(nick"")))
    {
        
set_user_info(id"name", ("%s %s",get_stat(sid),nick));
    }
    else
    {
        
set_user_info(id"name", ("%s %s",get_stat(sid),glob));
    } 
is this completely wrong? In my head i think it should work but maybe not ;p

It seems that it only uses the second argument and not the first.
sparkey is offline
nikodz
Junior Member
Join Date: Jul 2009
Old 08-03-2010 , 02:49   Re: name function with double name arg
Reply With Quote #2

If you want to change player name user client_cmd instead set_user_info.
If client ID=sid in your script...
PHP Code:
client_cmd(sid"name "%%s"" get_stat(sid), glob); 
nikodz is offline
Spunky
Senior Member
Join Date: May 2008
Location: Orlando, Fl.
Old 08-03-2010 , 02:56   Re: name function with double name arg
Reply With Quote #3

PHP Code:
client_cmd(id"name ^"%%s^"" get_stat(sid), glob); 
You have to use escape sequences when using quotes within quotes.
Spunky is offline
Send a message via AIM to Spunky
sparkey
Senior Member
Join Date: May 2010
Old 08-03-2010 , 13:26   Re: name function with double name arg
Reply With Quote #4

Thx for your answers.

The thing is that the set_user_info can execute proper earlier then the client_cmd and that is why i am using it. Dont know why really but it seems that the client_cmd wont execute when a player is not in a team. I am also using an update function which runs every 10 minutes but i want the name to be changed on connect and not 10 seconds later if you know what i mean

Thanks guys
sparkey is offline
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 08-03-2010 , 15:17   Re: name function with double name arg
Reply With Quote #5

PHP Code:
    if (nick[0] && !equal(nick"0"))
        
client_cmd(id"name ^"%%s^""get_stat(sid), nick);
    else
        
client_cmd(id"name ^"%%s^""get_stat(sid), glob); 
__________________
hleV is offline
sparkey
Senior Member
Join Date: May 2010
Old 08-03-2010 , 17:57   Re: name function with double name arg
Reply With Quote #6

Yes that was exactly what the guy above wrote and it did not work but thanks for your answer anyway.
sparkey is offline
Seta00
The Seta00 user has crashed.
Join Date: Jan 2010
Location: Berlin
Old 08-03-2010 , 18:38   Re: name function with double name arg
Reply With Quote #7

Use setinfo:
Code:
    if (nick[0] && !equal(nick, "0"))         set_user_info(id, "name""%s %s", get_stat(sid), nick);     else         set_user_info(id, "name", "%s %s", get_stat(sid), glob);
Seta00 is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 08-03-2010 , 18:48   Re: name function with double name arg
Reply With Quote #8

@Seta, you can't format in set_user_info().

PHP Code:
    new szString[32]
    if (
nick[0] && !equal(nick"0"))
        
formatex(szStringcharsmax(szString), "%s %s"get_stat(sid), nick)
    else
        
formatex(szStringcharsmax(szString), "%s %s"get_stat(sid), glob)
    
set_user_info(id"name"szString
__________________

Last edited by fysiks; 08-03-2010 at 18:51.
fysiks is offline
sparkey
Senior Member
Join Date: May 2010
Old 08-03-2010 , 18:49   Re: name function with double name arg
Reply With Quote #9

Thx for your answer.

That was the function i started with first and tried it just as you wrote but it seems that the function cant handle all that parameters.

gsop.cpp(460) : error 088: number of arguments does not match definition
sparkey is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 08-03-2010 , 18:54   Re: name function with double name arg
Reply With Quote #10

Quote:
Originally Posted by sparkey View Post
Thx for your answer.

That was the function i started with first and tried it just as you wrote but it seems that the function cant handle all that parameters.

gsop.cpp(460) : error 088: number of arguments does not match definition
See my post above.
__________________
fysiks is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 23:10.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode