Guest Posted October 5, 2008 Share Posted October 5, 2008 Hey there, i need some help. I got this script: function Script_onMapLoad () barrier = createObject (968, 1544.714966, -1630.837036, 13.317049, 1.574999, 1.604999, 0.000000) end addEventHandler ( "onResourceStart", getRootElement(), Script_onMapLoad ) function consoleOpen () local hello = getClientName ( source ) outputChatBox ( "Barrier up!", hello) moveObject ( barrier, 2000, 1544.714966, -1630.837036, 13.317049, 1.574999 -0.014999 0.000000 ) end addCommandHandler ( "open", consoleOpen ) but it doesn't work The barrier don't even appear, i want the barrier to be created, wenn the gamemode has started (on gamemode start). What's wrong with the script? Sorry if this is simple, I've just began to script in LUA, PAWN is something different^^ Thx for help Flibber100 Link to comment
DiSaMe Posted October 5, 2008 Share Posted October 5, 2008 Like 7: try changing getRootElement() to getResourceRootElement(getThisResource()) And function consoleOpen must have first two parameters as a player who wrote command and command name. For example, changing consoleOpen() to consoleOpen(source,cmdname) would make it good. Link to comment
Guest Posted October 5, 2008 Share Posted October 5, 2008 function Script_onMapLoad () barrier = createObject (968, 1544.714966, -1630.837036, 13.317049, 1.574999, 1.604999, 0.000000) end addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), Script_onMapLoad ) function consoleOpen (source, cmdname) local hello = getClientName ( source ) outputChatBox ( "Barrier up!", hello) moveObject ( barrier, 2000, 1544.714966, -1630.837036, 13.317049, 1.574999 -0.014999 0.000000 ) end addCommandHandler ( "open", consoleOpen ) The barrier still doesn't appear Link to comment
robhol Posted October 6, 2008 Share Posted October 6, 2008 function Script_onMapLoad () barrier = createObject (968, 1544.714966, -1630.837036, 13.317049, 1.574999, 1.604999, 0.000000) end addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), Script_onMapLoad ) function consoleOpen (source, cmdname) local hello = getClientName ( source ) outputChatBox ( "Barrier up!", hello) moveObject ( barrier, 2000, 1544.714966, -1630.837036, 13.317049, 1.574999 -0.014999 0.000000 ) end addCommandHandler ( "open", consoleOpen ) The barrier still doesn't appear You sure you got the right coordinates and are looking at the right spot? Also, type DEBUGSCRIPT 3 into the console before you start the gamemode next time. If something's wrong, you can see it there. Link to comment
SpZ Posted October 6, 2008 Share Posted October 6, 2008 The second parameter for 'outputChatBox' doesn't take a string; replace 'hello' with 'source'. Link to comment
tma Posted October 6, 2008 Share Posted October 6, 2008 function Script_onMapLoad () barrier = createObject (968, 1544.714966, -1630.837036, 13.317049, 0,90,90) end addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), Script_onMapLoad ) addCommandHandler ( "open", function(player,cmd,...) outputChatBox ( "Barrier up!", player) moveObject ( barrier, 2000, 1544.714966, -1630.837036, 13.317049, 0,-90,0 ) end ) What was wrong: + You missed commas out on the moveObject() call + You angle parameters to createObject() and moveObject() where in radians not degrees + The incorrect use of outputChatBox() (as mentioned before) Link to comment
Guest Posted October 6, 2008 Share Posted October 6, 2008 Yeah! thx man, it works now! I get it now, hot to make a function with a console command. But how can i make the object (door) open itself, when e.g. a cop comes around it? Link to comment
Guest Posted October 6, 2008 Share Posted October 6, 2008 But how can i make the object (door) open itself, when e.g. a cop comes around it? Link to comment
Gamesnert Posted October 6, 2008 Share Posted October 6, 2008 But how can i make the object (door) open itself, when e.g. a cop comes around it? Create some colshapes, then use onColShapeHit&onColShapeLeave to trigger it. To check the team, you can use getPlayerTeam. ((NOTE: All of the commands I used are clickable )) Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now