-
Posts
353 -
Joined
-
Last visited
-
Days Won
3
Everything posted by LoPollo
-
Honestly the html files can be stolen even in a web server. Just a moment.. i'm searching something about this EDIT: The first thing i found is obfuscation, but you can't obfuscate the whole page at once... i'm still searching EDIT: deleting all the newlines (and to make sure i deleted also tabs and double spaces) seems to work. Be sure you don't have line comments... well if you want the other people to not know... delete ANY comment http://www.colddata.com/developers/online_tools/obfuscator.shtml have fun
-
What do you mean with "secure"?
-
try this UNTESTED local sounds = {} --Sirens Section function sound003 (player) if not sounds["003"] then sounds["003"] = playSound("Sirens/Sound_003.wav") setSoundVolume(sounds["003"], 0.3) else stopSound( sounds["003"] ) destroyElement( sounds["003"] ) sounds["003"] = nil end end addCommandHandler("sound003", sound003) bindKey("num_1", "down", "sound003") function sound012 (player) if not sounds["012"] then sounds["012"] = playSound("Sirens/Sound_012.wav") setSoundVolume(sounds["012"], 0.3) else stopSound( sound["012"] ) destroyElement( sounds["012"] ) sounds["012"] = nil end end addCommandHandler("sound012", sound012) bindKey("n", "down", "sound012") EDIT: also the way @Walid use (one function to control all the sounds identified by a string) is better than this if all the sound files have the same name as the string you use as ID in the script. If you want i can post a function using that logic
-
Post the block code where the error is generated So when you type /k [Q] [A1] [A2] the vote window appears BUT without the question text and without the answers texts right?
-
If i'm right the panel is accessible by F1 press and by typing "/fr" In fr_client.lua@Line1620 there's the function that shows (and hide) the panel. Insert the needed checks here. Another solution would be adding an handler on both keypress and on the chat event (i don't remember the name... onPlayerChat maybe) with a very high priority, cancelling the event. But i'm not sure if the event will still be triggered if the other handlers do not check if the event was cancelled
-
Ok here's the serverside with all in it. I never used the restricted argument in addCMDHandler, but it should work... still it's better to test. If testing of the first function result in a "fail", then use the second variant. function nameThatFunction( playerSource, cmd, ... ) local pX, pY, pZ = getElementPosition ( playerSource ) createExplosion ( pX+3, pY+3, pZ, 2 ) createExplosion ( pX-3, pY-3, pZ, 2 ) createExplosion ( pX+5, pY-2, pZ, 2 ) createExplosion ( pX-4, pY+4, pZ, 2 ) end addCommandHandler( "rob", nameThatFunction, true) --that true means the resource is restricted, so only if a player is in a group with the access to command.rob that command will be executed --since i NEVER used the restricted argument, here's the variant with the check inside the function function nameThatFunction( playerSource, cmd, ... ) if hasObjectPermissionTo(playerSource,"command.rob") then local pX, pY, pZ = getElementPosition ( playerSource ) createExplosion ( pX+3, pY+3, pZ, 2 ) createExplosion ( pX-3, pY-3, pZ, 2 ) createExplosion ( pX+5, pY-2, pZ, 2 ) createExplosion ( pX-4, pY+4, pZ, 2 ) end end addCommandHandler( "rob", nameThatFunction) EDIT: lol i noticed that the second variant is already posted, sorry for the duplicate.
-
Line 3 serverside: triggerClientEvent(getRootElement(),"rob",getRootElement()) replace with triggerClientEvent(p,"rob",getRootElement()) If you want to solve the problem said in the note of triggerClientEvent, replace with triggerClientEvent(p,"rob",p) (if you don't need the extra arguments of clientside createExplosion then it's still better to move all on serverside, i will post the code as soon as i return)
-
I can't see any error... but why are you making a clientside script if you can do all serverside? triggerClientEvent note: Note: To save client CPU, you should avoid setting sourceElement to the root element where possible. Using resourceRoot is usually sufficient if the event is handled by the same resource on the client. EDIT: ohhh i now see the problem: you are triggering to the root, so EVERY player will get the clientside script.
-
yes it is Still remove the addEventHandler from the loop, it that function is added, added, added and added again then i don't know if one removeEventHandler will remove only 1 handler or all. But i can guess. And guessing makes me think that only one is removed, leaving the others doing their job Short version: recode that part so there are no more X handlers drawing 1 text each, make only 1 handler that draw them all addEventHandler ( 'setData', root, function (data) table.sort ( data, function (a,b) return ( tonumber(a.clan_kills) or 0 ) > ( tonumber(b.clan_kills) or 0 )end) for k,v in ipairs ( data ) do function drawtext () test = tostring(v.clan_name).." - "..tostring(v.clan_kills).."kills" dxDrawText(test, x*1110, (y*552)+(y*(20*k)), x*1280, y*570, tocolor(255, 255, 255, 255), x*1.00, "default-bold", "left", "top", false, false, false, false, false) end addEventHandler("onClientPreRender", root, drawtext) if k == 10 then break end end end) EDIT: another faster solution is to remove all the handlers
-
You are using an addEventHandler within a loop PS: i still don't know what that dximage is or where it comes from
-
what dximage is? something handled in drawlist? then check what i have said in the reply, i've edited
-
if isMouseSetColor (x*1064, y*611, x*38, y*77) then probably returns false Also this is a BIG problem for k,v in ipairs ( data ) do function drawtext () ... end addEventHandler("onClientPreRender", root, drawtext) ... end
-
So if you have like 3 properties with $500, $7500, $1500, and you hit the pickup of the property with $1500, you get $9500 instead of $1500? Also isn't that function to increase the cash of the properties? mmm no i'm not understanding the code, it's not similar to my style... No after reading it more times i can't understand what do you want to do with that function honestly. Can you make something like this to explain the code? or post that function with comments that explain what every code block should do PS: i can't find what propertiesLocs[...].lucre should be
-
Do you mean something like this? https://community.multitheftauto.com/index.php?p=resources&s=details&id=6292 I use an edited version of that resource (fix message order for example) But why the normal chatbox isn't enough?
-
Lol This includes: what if 2 maps are bought (even before starting the first time a bought map)? I think there are a huge numbers of ways to "solve" this. Disabling buying maps if a bough map is running? nexmap is no more a variable but a table which is used as a queue? Simply letting the previous map get overwritten and maybe a refund? Let 2 maps be bought and simply ignore the one which is not voted (basically it can become a waste of money)? there are hunderds of solutions... A very simple solution* is that you pay for playing the map once, seeing the "play again" as a chance to get that map replayed. If it will be played only once cause another map is bought, then you still had what you paid for. *There's still a problem. as above, what if 2 maps are bought before starting for the first time a bought map?
-
I'm to lazy to read 230 lines of code: what do you mean with the statement in the quote? Also are there errors?
-
No no the problem is that i'm an idiot if getPlayerMoney >=25 then i'm comparing a function with a number... replace line 4 with if getPlayerMoney(player) >=25 then tell me if it's working after this edit PS: Warning: You should use the global variable client serverside instead of passing the localPlayer by parameter or source. Otherwise event faking (passing another player instead of the localPlayer) would be possible. More information at addEventHandler insert between line 1 and 2 this: player = client or player That way if the function is used as handler for the event, "client" will be the player that triggered the event and the variable "player" will have that player as value without security problems If the function is called from the commandhandler, "client" will be nil and so the "player" variable will have as value the player that typed the command "rentroller"
-
You only nil the data if the winner map is the same as the one in keepnextmap Yes it will work, but the currentmap and the data should be EQUAL and not different. It's the basically same thing of what i was saying: - on poll end, pick the winner map, nil the data IF the winner map is the one in keepnextmap, start the map vs - on map start check if currentMap is the same as the keepnextmap, and if true nil the data. It's the third time i write this since i'm at school and the connection here sucks -.- sorry if i omitted something and let me know
-
Tell me if i understand right: 1. Every time the marker is hit a vehicle will be spawned. 2. Every time the marker is hit, the previous vehicle spawned by the marker should be destroyed. 3. The hit-event code will get executed only if a player* hit the marker: for example if the spawned vehicle gets pushed inside but NO player hit the marker, nothing from this script should happen *The player must be in a given ACL group If this is right then when you assign to Veh1 the vehicle (createVehicle), the previous vehicle, if it exists, must be destroyed: local Marker1 = createMarker (-1529.0632324219, 455.220062255886, 6, "cylinder", 3, 0, 0, 255, 100) function Vehicle1 ( hitPlayer, getPlayerVehicle ) if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(hitPlayer)), aclGetGroup("Clan1")) then if isElement(Veh1) then destroyElement( Veh1 ) end local Veh1 = createVehicle(541, -1529.0632324219, 455.220062255886, 7.2) warpPedIntoVehicle ( hitPlayer, Veh1 ) else outputChatBox ("Clan1: Access denied", hitPlayer, 100, 0, 0) end end addEventHandler( "onMarkerHit", Marker1, Vehicle1) Actually if i'm right (not sure though) if the vehicle is destroyed by something that is NOT the script, it's possible the "id" of Veh1 will be referenced to another object. So additionals checks should be made: adding an handler on vehicle explode event bound to Veh1 where you nil the value of Veh1 should solve the issue Correct me if someone with these knowledge read this, i'm tired and really not sure about this
-
So if the number of turfs owned by a clan is equal to 0, the text will NOT be printed? Line 14 --replace if ( groupTurfs [ clanList ] or 0 ) then --with if groupTurfs [ clanList ] and groupTurgs[clanList]~=0 then When you wrote "or 0" you make lua take 0 as condition if groupTurfs[clanList] returned a false value, in which case the if statement was exactly equal to: if 0 then and since 0 is a non false value (is not false and is not nil) it will be evalutated as true, and the code inside the if gets executed
-
Give us a headstart: explain more when vehicles are spawned. (the event that handle this, the functions that should be called, etc) Also tell me if i understood: when a vehicle is spawned for this script, some gui should appear (inventory)? i don't get the tires and engine part Another little but very important detail, tell us about ANY error of that resource both client and server side, as @pa3ck said. If these are not presents, explicitly say that there are no errors neither in clientside nor in serverside
-
if not getElementData(resourceRoot, "keepnextmap") then local mapName = getResourceInfo(_nextMap, "name") or getResourceName(_nextMap) table.insert(poll, {mapName , 'nextMapVoteResult', getRootElement(), _nextMap}) end The problem may be here (quote above) or in the poll end: do you set the keepnextmap to nil when that map is voted? For example, if the map setted as nextmap (keepnextmap) is "premiumMap", this "premiumMap" map will get inserted into the poll (assume the current map hasn't reached the play number limit). When the poll ends, out of "premiumMap" and "Play again", the voted map is "premiumMap". If the keepnextmap is not resetted here (when the map starts/poll ends) or when the map ends (race finished) then the data is present when the poll starts again, and the current map has NOT reached the limit (number of plays). If you set the data to nil in the case related to the above example, then the code in the quote will get executed, which will add to the poll _nextMap. Double check that _nextMap is NOT the resource of the map in the map previously stored under key keepnextmap. PS: forgive for any errors, here it's 2326 and i'm tired. So in case of stupid things i'm sorry (i say a lot of stupid things because i easily forget little, but still important things)
-
I still don't understand: isn't this what you have? groupTurfs[_owner] = _count where _owner is the team name and _count is the number of turfs and you are looking for the _owner Pratically: replace outputChatBox ( "Test : " ..tostring(groupTurfs [ clanList ]).. "",) with outputChatBox ( "Test : "..clanList.."->"..tostring(groupTurfs [ clanList ]).. "",) Can you explain where i'm wrong? I mean, i'm probably missing something PS: pls align the code you post with indentation? it makes it so much easier to read PS: why "or 0"? if ( groupTurfs [ clanList ] or 0 ) then
-
Is it possible that SO MANY PEOPLE ask for help without even saying what's the problem? I'm not angry with you @alvarkiis, it's general. But please notes that there are some rules that must be followed, and also these rules helps you getting a quicker solution: the more info we have about the problem, the more we KNOW the problem. The more we know what's wrong, the easier is the solution to be made.
