Jump to content

Welcome Message


MitchPS

Recommended Posts

When you say add to the gamemode if i run several modes i take it i will have to add this to every gamemode or can this not just be made into a resource?

Im kinda new to all this so just now it makes no sense lol

While im here is there a script about that will output to everyone at say 5 min intervals advertising our forums?

IE:- Visit our forums at http://www.blahblah.com.

cheers

Link to comment

Well ive got this script my self running on my server but i just put it in an .zip file with the following meta.xml|

meta.xml:

  
<meta> 
    <info name="Joinmsg" description="Message To Player when connects" author="<yournamehere>"/>     
  <script src="joinmsg.lua" type="server"/> 
</meta> 
  

And then in the .zip is the meta.xml and joinmsg.lua where the script is in.

Link to comment

Make an zip folder in resources and put there 2 files

1. I called it "welcome" :)

function onPlayerConnect() 
        local joinedPlayerName = getClientName ( source ) 
        outputChatBox ( "Welcome " .. joinedPlayerName .. " your txt " , source, 255, 255, 255 ) 
end 
addEventHandler("onPlayerJoin", getRootElement (), onPlayerConnect) 

and meta

<meta> 
  <info author="your name" name="welcome" version="1" />  
  <script src="welcome.lua" type="server" />  
  </meta> 

2. Then in ACL file make new group

<group name="welcome"> 
      <object name="resource.welcome"/> 
   </group> 

Put the "meta" in logs/scripts Run from admin panel in game "welcome" and voila, works in all mods and maps. No need to put script in each map or mode.

Edited by Guest
Link to comment

Can I remind people that you DO NOT have to use zip files for resources. You can just make a folder (named as your resource is) in your resources folder and use that (placing meta.xml, maps, scripts etc in there).

You shouldn't need an ACL for this example either, and I'd suggest you avoid using on[something] for function names, it's just going to confuse things.

Link to comment
  
function onPlayerConnect() 
        local joinedPlayerName = getClientName ( source ) 
        outputChatBox ( "Welcome " .. joinedPlayerName .. " your txt " , source, 255, 255, 0 ) 
end 
addEventHandler("onPlayerJoin", getRootElement (), onPlayerConnect) 
  

This should make it yellow.

by the way, the difference is the 255 255 0 instead of 255 255 255

That's the rgb color.

So if you want to change it to another color just change those. (or add#RRGGBB infront)

here's a nice list.

http://www.pitt.edu/~nisg/cis/web/cgi/rgb.html

Link to comment
Can I remind people that you DO NOT have to use zip files for resources. You can just make a folder (named as your resource is) in your resources folder and use that (placing meta.xml, maps, scripts etc in there).

What server have you tested it?

On XP I have to create .zip for the resource! If I have to correct something while testing I have to update the whole .zip file! If I don't have the .zip file, server will not detect the resource at all.

If I want to start the resource using "start " in server console I see this message:

[time] start: Resource could not be found

If you create .zip, you won't get that message and resource loads correctly. If I remove the .zip while the resource is loaded and I type "refresh" in console, I see:

[time] ERROR: Resource '[resourcename]' has been removed while running! Stopping resource.

So why you're saying that we don't have to create .zip?

Link to comment
  
function onPlayerConnect() 
        local joinedPlayerName = getClientName ( source ) 
        outputChatBox ( "Welcome " .. joinedPlayerName .. " your txt " , source, 255, 255, 0 ) 
end 
addEventHandler("onPlayerJoin", getRootElement (), onPlayerConnect) 
  

This should make it yellow.

by the way, the difference is the 255 255 0 instead of 255 255 255

That's the rgb color.

So if you want to change it to another color just change those. (or add#RRGGBB infront)

here's a nice list.

http://www.pitt.edu/~nisg/cis/web/cgi/rgb.html

Ah superb:D

Cheers for that :D

Link to comment
Ok just changed it and it throws up this error...

mtasadm/mods/deathmatch/resources/Joinmsg/Joinmsg.lua:3: ')' expected near '255' 

post the changed script.

Its ok, i got it working lol :D

When i changed it from 255, 255, 255 to 255, 255, 0 i forgot to add back in the comas :oops:

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...