
tma
Members-
Posts
173 -
Joined
-
Last visited
Everything posted by tma
-
If it's so simple, why don't you show him ? Edit : To be constructive. Look at this post I've made. It is what you want (almost) - a basic dumb freeroam mode. It doesn't use a map for spawn points however, but should get you started.
-
To hijack this slightly: is there any way of issuing these chat options in lua scripts ? Nothing I've tried seems to work.
-
Have a look at what I posted here.
-
When I told you to modify the script to remove the spawn map, that code is CLIENT side - the spawning of players is server-side only. So what you want is to remove the lines (as before) and put your new code in a server-side script. I've posted other code on this board for spawning players so have a look at that if you need to. Edit: addEventHandler('onPlayerJoin',gRoot, function() spawnThePlayer(source) end )
-
In this function playervehicle and playername are undefined - you determine them in the other function but not in this one. You're also saving the owner of a vehicle as a player element type but call the variable "playername" which is confusing. And what is the "authorized" variable ? That's the name of the player but you don't use it. In fact, I wouldn't use the name (you're not) as it could change. Edit: I notice that you've made the variables global - that's never going to work in the long run when you've multiple people on the server. function playerExpel ( thePlayer ) playervehicle = getPlayerOccupiedVehicle ( thePlayer ) if ( getElementData ( playervehicle, "parkedby" ) == thePlayer ) then setVehicleFrozen ( playervehicle, false ) setVehicleDamageProof ( playervehicle, false ) setVehicleOverrideLights ( playervehicle, 0 ) setVehicleEngineState ( playervehicle, true ) outputChatBox ( "Vehicle Started", thePlayer, 255, 0, 0 ) else removePlayerFromVehicle ( thePlayer ) outputChatBox ( "This is not your vehicle!", thePlayer, 255, 0, 0 ) end end
-
Do /help and you'll see a bunch of commands for altering the layout of the chat box (chatlines / chatscale etc.)
-
People are splitting help pages (I am) but it'd be nice to not have to. The help manager can go past the ~1000 char limit using hard-coded strings, so I think there's a bug somewhere to be fixed that would then mean we don't have to split documents up. It'd be handy that's all.
-
Why don't you add an event handler in the client for when the local player quits, that queries his weapon slot data and sends it to the server to be saved (along with the rest of the info) ? (Assuming this last packet of info is sent - I haven't sent anything client->server on player quit) Edit: Yeah, you might have a problem with who timing there. If the server has dropped the player before that info is sent, it won't know who to save it for. Easy enough to get round, or do a completely different way. The server could just track what weapons the client has for example.
-
I'm just saying that I think there's problems with enter/exit (sometimes) ? Different ones maybe - but all connected, and I think unsolvable in the scripts we're coding rather than the actual MTA engine. It's DP2 after all - bug hunting right now can be tricky because you can't be certain (sometimes) who's is the coding error. But looking at your code I can't see why it'd fail in the manner it does.
-
Yes, I've seen those in my game mode. The logic I've got seems to work to I kinda ignored them TBH (I have a player vehicle lock). I have however noted times when a player couldn't enter a newly created vehicle but I could (enter the same one). Maybe there's an issue with enter/exit in DP2 ? Note: this was the SAME player coming to my server - on different days ?! He was the only one with the problem of not being able to enter new cars (sometimes). A reconnect sorted. Strange it was just him but similar to your issue.
-
Yep, I agree but it was just a hacky piece of code for my server.
-
You want a server function to get data from the client ? It's just that what you've shown can all be done with a client command because looking at your code: 1. triggerClientEvent() doesn't return a value result, but a boolean for if the command executed (event sent) - hence your error. 2. addEvent() takes two parameters - you'll need the second for remote execution. 3. The value from getPlayerWeapon() isn't stored / sent anywhere. If you want the server to do "something" with what's in the weapon slot, just do a client command handler, make the query and trigger a server event with the result (so you need a server event handler). If you're just showing what's in the slot to the player, just make it all client-side with a command handler.
-
I do something like : function tuPlayerInACLGroup(player,groupName) local et = getElementType(player) if (et == "player") or (et == "console") then local account = getClientAccount(player) if not isGuestAccount(account) then local un = "user." .. getAccountName(account) for id, object in ipairs(aclGroupListObjects(aclGetGroup(groupName))) do if object == un then return true end end end end return false end I know this is slightly frowned upon for not using the ACL but it's just easier on my server. I know the names of the power user groups (Admin, Moderator etc.) so I just run checks to see if the player is in any of those: function tuPlayerHasPower(player) -- Return true if the player belongs to any of the priveledged users for i,groupName in pairs({"Moderator","SuperModerator","Admin","Console"}) do if tuPlayerInACLGroup(player,groupName) then return true end end return false end This lets me flick commands on/off and check other things (such as your "admin car") without having to resort to changing the ACL. The only negative to this method is the use of pre-set admin group names. I didn't check if I could determine them programatically.
-
In fr_client.lua there's a onClientResourceStart() handler. In there is what looks like a call to open the map selector (I don't use this resource so I'm guesstimating). if isPlayerDead(g_Me) then createWindow(wndSpawnMap) showCursor(true) end Just get rid of those lines I suppose.
-
function replaceModel() txd = engineLoadTXD ( "hunter.txd" ) engineImportTXD ( txd, 425 ) dff = engineLoadDFF ( "hunter.dff", 425 ) engineReplaceModel ( dff, 425 ) end addEventHandler ( "onClientResourceStart", getResourceRootElement(getThisResource()), function() replaceModel() setTimer (replaceModel, 1000, 1) end ) Something like that to just replace it twice (untested).
-
Then I'm confused ... I've tried making a readme from an xml file and as you say, I had to split it across multiple pages. BUT if I do something like : local helpTab = call(getResourceFromName("helpmanager"), "addHelpTab", getThisResource(), true) local mainText = guiCreateMemo ( 0.05, 0.05, 0.9, 0.9,"BIG ASS TEXT STRING",true, helpTab) I can use any length I like i.e. for my help text I use the above and a literal string defined in the client. My current help doc is 9300 characters long. Does this suggest there's a bug in the XML reader rather than a hard-coded memo character limit ?
-
It's not a question of giving you the answers - I got your mode working. 50p showed you in this thread how to put a player into a team but you seemed to not understand that he has (or have missed it possibly) e.g. setPlayerTeam (player,team) Read here. Now I know in your code you have created two teams (teamVagos and teamAztecas) so put the two together. Use something like : setPlayerTeam (player,teamVagos) or setPlayerTeam (player,teamAztecas)
-
No script needed. Just do something like this in the console: bind m up showchat Key 'm' now toggles the chat on/off.
-
Hey. I think there's not much more I can help you with, without spoon-feeding you the answers - no offence. You do now have a working game mode - where you go forward is up to you. If you can program OK then read the API and just use it - the MTA team have created a very easy and flexible system and you can just expand your code.
-
Yes. If you've got a map the meta.xml OK and the bits of code I gave you, starting your game mode should allow you to play it. I did that with the files you PM'ed me.
-
I mean use the three chuncks of code I said were missing and then ... 1. Include you map file in the NEW format i.e. not the old race format. I tried a test quickly using this in my meta.xml ... "ojsf2" /> ... You won't have that resource/map probably but anything will do. 2. Swap the line in the code above from : spawnPlayer(player,math.random(10) * 3,math.random(10) * 3,5) to call(getResourceFromName("spawnmanager"),"spawnPlayerAtSpawnpoint",player) I just tried it and it works fine. All you need to do is get your .map file into the meta and you're away.
-
If you're map file is included correctly in the meta.xml then the spawnpoints defined in it will exist in the MTA world. You could randomly pick one and spawn the player at it's location. Alternatively : I haven't used it, but I think the spawnmanager resource would be handy for you, especially this. Seems you can change the code from spawnPlayer() to a correct call to this resource function. It'd be something like : call(getResourceFromName("spawnmanager"),"spawnPlayerAtSpawnpoint",player)
-
I've had a look at your code and your basically missing everything to do with spawning the player i.e. putting him into the game world. I added these three functions that make your mode work : function joinHandler(player) fadeCamera(player,true) spawnPlayer(player,0,0,5) end addEventHandler("onPlayerJoin", getRootElement(), function() joinHandler(source) end ) addEventHandler("onResourceStart",getResourceRootElement(getThisResource()), function(res) for _,p in ipairs(getElementsByType("player")) do joinHandler(p) end end ) So now onPlayerJoin() spawns the player and the onResourceStart() code also spawns the player for when people are connected to your server when your game mode starts. I haven't done anything fancy with where they spawn - I've just dumped them in the middle of the world (0,0,5).
-
That wasn't what I was saying - the two ampersands in the original help file stopped it showing at all (for me). When I removed them, THEN I got truncated text.