Author Topic: Little scripting question  (Read 3475 times)

0 Members and 1 Guest are viewing this topic.

Offline MrSt3fan

  • Donator
  • *
  • Posts: 6364
    • View Profile
  • Nick: 33rd_Col_MrSt3fan
  • Side: Neutral
Little scripting question
« on: December 18, 2013, 08:17:05 am »
Does anyone know how to set a welcome message when someone joins a server? I've seen it in 2 servers where when someone joins they will get a welcome message in pink which only they can see. Does anyone know how to do this as I'd like to add it to 33rd_NW_Siege.

Thanks in advance !

Offline DanyEle

  • FSE Associate
  • ***
  • Posts: 517
  • Sssh! I'm coding, don't disturb :D
    • View Profile
  • Nick: DanyEle
  • Side: Confederacy
Re: Little scripting question
« Reply #1 on: December 18, 2013, 09:02:56 am »
There are lots of Open Source tools for Native you can refer to for such a feature. It'd just be a matter of displaying a string to the joining client.



Offline MrSt3fan

  • Donator
  • *
  • Posts: 6364
    • View Profile
  • Nick: 33rd_Col_MrSt3fan
  • Side: Neutral
Re: Little scripting question
« Reply #2 on: December 18, 2013, 02:13:17 pm »
Do you happen to have a link to one of those tools? Have looked around a bit but can't find it.

Offline DanyEle

  • FSE Associate
  • ***
  • Posts: 517
  • Sssh! I'm coding, don't disturb :D
    • View Profile
  • Nick: DanyEle
  • Side: Confederacy
Re: Little scripting question
« Reply #3 on: December 18, 2013, 02:17:04 pm »
Firstly, do you use the Module System?



Offline MrSt3fan

  • Donator
  • *
  • Posts: 6364
    • View Profile
  • Nick: 33rd_Col_MrSt3fan
  • Side: Neutral
Re: Little scripting question
« Reply #4 on: December 18, 2013, 02:24:55 pm »
Could you add me on steam please, it's easier :) My steam name is MrSt3fan

Offline DanyEle

  • FSE Associate
  • ***
  • Posts: 517
  • Sssh! I'm coding, don't disturb :D
    • View Profile
  • Nick: DanyEle
  • Side: Confederacy
Re: Little scripting question
« Reply #5 on: December 18, 2013, 03:13:00 pm »
I just added you. BTW, i scripted it for you this time. If anybody else would like to have a welcome string popping up when a player joins a server, here is what you have to do:

Create a new string in module_strings, for example:

Below

Code
 ("mp_walloon_farm_flag_6","Redoubt"),

Add

Code
  ("welcome_message_33rd","Welcome {s3} to 33rd Official Siege Server"),

You can replace the "33rd Official Siege Server" with whatever you want, but always keep the {s3}. That's the player name.

In module_scripts get to the script  "multiplayer_server_player_joined_common" and:

Below

Code
 (player_set_slot, ":player_no", slot_player_join_time, ":player_join_time"),
 (player_set_slot, ":player_no", slot_player_first_spawn, 1),

Add:

Code
  
 (str_store_player_username, s3,":player_no"),
(str_store_string, s4, "str_welcome_message_33rd"),
  (call_script, "script_multiplayer_broadcast_message"),

That should be it! Save and compile the files, then upload them on your server. It should print a message viewable by everyone when a player joins a server.
« Last Edit: December 18, 2013, 03:21:20 pm by DanyEle »



Offline Gurkha

  • Lieutenant General
  • ***
  • Posts: 2650
  • Former 33rd LtCol
    • View Profile
    • Official 33rd Regiment of Foot Website
  • Nick: Gurkha
  • Side: Union
Re: Little scripting question
« Reply #6 on: December 18, 2013, 03:41:57 pm »
Hey DanyEle, I don't suppose you know how to make it so only certain players and their ID's can log into a server with a admin pass?

Offline DanyEle

  • FSE Associate
  • ***
  • Posts: 517
  • Sssh! I'm coding, don't disturb :D
    • View Profile
  • Nick: DanyEle
  • Side: Confederacy
Re: Little scripting question
« Reply #7 on: December 18, 2013, 06:33:34 pm »
player_get_unique_id                         =  441  # (player_get_unique_id, <destination>, <player_id>), #can only be used on server side
eq                                                       = 31      # (eq, <value1>, <value2>),

These are the commands you need to use for that! So, let's say.

Code
(player_get_unique_id, ":game_id", ":player_no"), #imported from above
(this_or_next|eq, ":game_id", 400510), #random number as example. Unique id of an admin
(this_or_next|eq, ":game_id", 400511), #other random number that should be the unique GUID of the other admin
(eq, ":game_id", 400512), #for the last GUID just use this
« Last Edit: December 18, 2013, 06:36:22 pm by DanyEle »



Offline Becker-

  • Donator
  • *
  • Posts: 2470
    • View Profile
    • "The Gang joins the Army"
  • Nick: Bring back the 54th.
  • Side: Confederacy
Re: Little scripting question
« Reply #8 on: February 04, 2014, 05:19:03 am »
Just bumping this old thread cause I got a question, but could anybody help me with both of these codes? I'm illiterate when it comes to coding!

Add me on steam Becker [54th] or misguidedx


Thanks

Offline hunter491

  • First Sergeant
  • *
  • Posts: 188
    • View Profile
  • Side: Neutral
Re: Little scripting question
« Reply #9 on: September 24, 2015, 09:29:09 pm »
player_get_unique_id                         =  441  # (player_get_unique_id, <destination>, <player_id>), #can only be used on server side
eq                                                       = 31      # (eq, <value1>, <value2>),

These are the commands you need to use for that! So, let's say.

Code
(player_get_unique_id, ":game_id", ":player_no"), #imported from above
(this_or_next|eq, ":game_id", 400510), #random number as example. Unique id of an admin
(this_or_next|eq, ":game_id", 400511), #other random number that should be the unique GUID of the other admin
(eq, ":game_id", 400512), #for the last GUID just use this


where should i add that

Offline Ted

  • Colonel
  • *
  • Posts: 4478
  • Aufknöpfen!
    • View Profile
  • Side: Neutral
Re: Little scripting question
« Reply #10 on: September 24, 2015, 09:30:44 pm »
player_get_unique_id                         =  441  # (player_get_unique_id, <destination>, <player_id>), #can only be used on server side
eq                                                       = 31      # (eq, <value1>, <value2>),

These are the commands you need to use for that! So, let's say.

Code
(player_get_unique_id, ":game_id", ":player_no"), #imported from above
(this_or_next|eq, ":game_id", 400510), #random number as example. Unique id of an admin
(this_or_next|eq, ":game_id", 400511), #other random number that should be the unique GUID of the other admin
(eq, ":game_id", 400512), #for the last GUID just use this


where should i add that

In you tiny brain

*@Kanade I know I'm not helping hunter but I just can't stop laughing about this hilarious "headadmin" failing so hard*
« Last Edit: September 24, 2015, 09:34:24 pm by Ted »
Dat kid who put up a global banlist back in Betty's times.
Former Regiments: 7te Kurmarkische Landwehr, 6te Ulanen, kk Kürassierregiment Nr.4, kk Bombardier-Regiment Nr.3, kk AR Nr.2, GGR Nr.4, Artillerie im Kö.Preuß.IR Nr.33.
>>Scenes<<

Offline hunter491

  • First Sergeant
  • *
  • Posts: 188
    • View Profile
  • Side: Neutral
Re: Little scripting question
« Reply #11 on: September 24, 2015, 09:42:27 pm »
Why are you  taunting me?

Offline Dazzer

  • Donator
  • *
  • Posts: 5690
    • View Profile
  • Side: Union
Re: Little scripting question
« Reply #12 on: September 24, 2015, 09:58:59 pm »
Why are you  taunting me?

He is from Austria...



HAHAHHAHAHHHAHAHA

Offline Ted

  • Colonel
  • *
  • Posts: 4478
  • Aufknöpfen!
    • View Profile
  • Side: Neutral
Re: Little scripting question
« Reply #13 on: September 24, 2015, 10:01:52 pm »
Why are you  taunting me?

He is from Austria...



HAHAHHAHAHHHAHAHA

No I'm a reallife german  ;D
Dat kid who put up a global banlist back in Betty's times.
Former Regiments: 7te Kurmarkische Landwehr, 6te Ulanen, kk Kürassierregiment Nr.4, kk Bombardier-Regiment Nr.3, kk AR Nr.2, GGR Nr.4, Artillerie im Kö.Preuß.IR Nr.33.
>>Scenes<<