Player name in chatmsg?

Status
Not open for further replies.

Donboo

New Member
Joined
Mar 23, 2014
Messages
4
Likes
0
Points
1
1
#1

4changesLeft

Well-Known Member
Joined
Apr 10, 2015
Messages
365
Likes
1
Points
48
#2

springfield

Well-Known Member
Staff member
Joined
Feb 18, 2005
Messages
2,941
Likes
39
Points
98
Website
www.ugbase.eu
10
#3
Donboo said:
will output " : loves you.". How can I display the player's name :surprised: ? Thanks
Your code should work, make sure your sanny builder format setting is set to 'as is' from the format tab in the options menu.

TehArgis said:
"%s" means string and "v" after a variable allocates more memory.
so you have to do it like /command <playername>
Uhh, what?
If you already have his name you wouldn't need to call 0B36, right?
Since 0B36 takes a int as parameter, that needs to be the player id not name.
@v strings can only hold 16 chars, what if a player name has more, like 18 or 20 or 24?
 

4changesLeft

Well-Known Member
Joined
Apr 10, 2015
Messages
365
Likes
1
Points
48
#4
springfield said:
Uhh, what?
If you already have his name you wouldn't need to call 0B36, right?
Since 0B36 takes a int as parameter, that needs to be the player id not name.
@v strings can only hold 16 chars, what if a player name has more, like 18 or 20 or 24?
Yeah I know  he could just do it with ID but i thought it would be more cool to insert any name :3
Also SAMP has a char limit so it's not a problem :p

 

springfield

Well-Known Member
Staff member
Joined
Feb 18, 2005
Messages
2,941
Likes
39
Points
98
Website
www.ugbase.eu
10
#5
Yes, has a limit, but if my nick is "SPRINGFIELD_COOL_PLAYER" @v will only store part of the name, not the full name. That's not good.

Code:
:cmd
SAMP.IsCommandTyped([email protected])
if 0AD4: $nul  = scan_string [email protected] format "%s" [email protected] //just to check if the input contains a string
then 0AF8: chatmsg "{CECECE}%s:{FFFFFF} loves you." -1 [email protected] //use the input pointer directly
else print "~r~/love<id>" 2000
end
SAMP.CmdRet()
And your second solution is partialy bad too, using [email protected] = SAMP.GetActorHandleByPlayerID([email protected]) requires the player to be streamed, you can use
0B23: samp is_player_connected [email protected] to check if the player is online and the nickname is valid.
 
Status
Not open for further replies.
Top