-
Posts
21,935 -
Joined
-
Last visited
-
Days Won
6
Everything posted by Castillo
-
posis is a table, you are using it like a element... posis = {{362.502, 150.813, 1025.78, 1, 3}, {353.758, 193.991, 1019.98, 1, 3}, {351.345, 164.059, 1019.98, 1, 3}} function setDimensions() for i,v in pairs(posis) do local marker = createMarker(v[1], v[2], v[3], "cylinder", 2, 255, 0, 0, 255) setElementDimension (marker , v[4] ) setElementInterior (marker , v[5]) end end addEventHandler( "onResourceStart", getResourceRootElement(getThisResource()), setDimensions ) Try that.
-
DON'T DOUBLE POST, EVEN WORST FOR SOMETHING LIKE THAT. What are you trying to achieve?
-
Well, I have a better option, go and ask to the server owner to add it to the acl, why wouldn't he agree?
-
Strange, I tested it and worked fine o_O. P.S: There's a "onPickupUse" event for "moneyPickupHit".
-
Are you willing to pay to the scripter for his/her services?
-
You forgot the attachedTo argument in the event handler, use this: addEventHandler( "onResourceStart", getResourceRootElement(getThisResource()), setDim )
-
What I understand is that is triggering everything * player count? so ex: 5 players, triggers 5 times the same thing.
-
"addEventHandler( "onResourceStart", setDim )"? That's wrong, you forgot something there. I suggest you to go read about event handlers again.
-
Could you post the script which get's bugged?
-
I don't understand what do you mean... you are executing this script via runcode or...?
-
What? it should work if the admin group has the right to use that function o_O.
-
As I said in my first post (if I remember well), you must add the resource to the admin group in acl.xml.
-
Haha, my bad, I'd read "addEvent" as "addEventHandler" .
-
I'd put a function, else it wouldn't work. P.S: Is better to have one function to handle your event handlers than a lot of them (my opinion).
-
function createMoney(player) local x, y, z = getElementPosition(player); local x1, y1, x2, y2; x1 = (x-2)+(math.random()*4); y1 = (y-2)+(math.random()*4); x2 = (x-2)+(math.random()*4); y2 = (y-2)+(math.random()*4); local moneyAmmount = getPlayerMoney(player); moneyAmmount = math.floor(moneyAmmount/2); takePlayerMoney(player, moneyAmmount); moneyAmmount = math.floor(moneyAmmount/2); setElementData(createPickup(x1, y1, z, 3, 1212), "ammount", moneyAmmount); setElementData(createPickup(x2, y2, z, 3, 1212), "ammount", moneyAmmount); end function moneyPickupHit(player) local money = getElementData(source, "ammount"); if money then givePlayerMoney(player, money); destroyElement(source); end end function playerJustGotDied(ammo, attacker, weapon, bodypart) if (isElement(attacker)) then createMoney(source) end end addEventHandler("onPickupUse", getRootElement(), moneyPickupHit); addEventHandler("onPlayerWasted", getRootElement(), playerJustGotDied); I didn't fully made this script, it was in the forums and I just searched for it for you and fixed some bugs.
-
Why don't you make it? is better to make something by ourselfs than using someone's work.
-
Well, I would say he's insulting in russian.
-
Mind posting your whole script...?
-
That event is to REMOVE an event, not to add it.
-
I don't know what is miser, but well, as you may know, we're busy here. P.S: We don't like to help someone who doesn't want to learn.
-
For all this, you need scripting knowledge, you must learn or pay to someone to do it for you.
-
Jasd1, I don't understand what are you trying to say..... he has everything in order, and "local clicked ={"left","right"ETC.}" would be a table, not a variable. Dark, try adding debug outputs to your script, that'll help you to find out where's the error.
-
I would do something like this: Team_Selection_1 = {} function onPlayerResourceStart( ) Team_Selection_1[1] = guiCreateButton(326,534,196,88,"Attack",false) guiSetFont(Team_Selection_1[1],"sa-header") Team_Selection_1[2] = guiCreateButton(199,90,5,5,"",false,Team_Selection_1[1]) Team_Selection_1[3] = guiCreateButton(562,534,196,88,"Defence",false) guiSetFont(Team_Selection_1[3],"sa-header") Team_Selection_1[4] = guiCreateButton(199,90,5,5,"",false,Team_Selection_1[3]) guiSetVisible( Team_Selection_1, true ) showCursor(true) end addEventHandler( "onClientResourceStart", getResourceRootElement( getThisResource( ) ), onPlayerResourceStart ) function onPlayerClickGUI(button) if (button == "left") then if (source == Team_Selection_1[1]) then ouputChatBox( "You clicked Attack" ) elseif (source == Team_Selection_1[3]) then ouputChatBox( "You clicked Defence" ) end end end addEventHandler ( "onClientGUIClick", root, onPlayerClickGUI )
-
Many ppl got this error, maybe is a bug, not sure, use this: setTimer(function () removeEventHandler("onClientRender",root,Function) end , 13000, 0) Try with that.
