-
Posts
110 -
Joined
-
Last visited
About Blueman
- Birthday March 29
Details
-
Interests
C++,C,Lua,Java,ActionScript,Assembly and just about any other programing language/topic
Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
Blueman's Achievements
Sucka (13/54)
0
Reputation
-
I never called setElementMoney in my code.. I called setPlayerMoney because when I called givePlayerMoney(source, 1000) it would do nothing... Cleaned up the code and added some comments. This is a bit different than the original since i've been working on it but it does not seem to be destroy the map blip local hasBeenCollected=true local theDrug local locx,locy,locz,hint={-2923.1591, -1126.8721}, {1165.1446, 834.1354}, {13.5312, 3.0777}, {"The back yards of san fiero", "A oceanic rock next to a bridge support"} --An array with drug package locations and hints function pickedUpDrug(pickup,dimension) -- Called when something is picked up. if(getElementData(pickup, "rpg.drug") == "a") then local earnings=math.random(2000)--Generate random earnings from 1 to 2000 local money = getPlayerMoney(source) setPlayerMoney(source , money + earnings)--Give player money does nothing where as this seems to work fine. hasBeenCollected = true --Tell setupDrugRun we've collected it destroyElement(getElementAttachedTo(pickup))--Destroy the pickups blip(does not seem to work) destroyElement(pickup)--Make sure we destroy our pickup outputChatBox ( getPlayerName(source).." has collected the drug package for $"..earnings, getRootElement(), 0, 0, 255, true )--Tell everyone about it elseif(getElementData(pickup, "rpg.money") == "mons") then --This can be ignored it has nothing to do with the drug run local money = getPlayerMoney(source) setPlayerMoney(source , money + 100) destroyElement(pickup) end end function setupDrugRun() if(hasBeenCollected == true) then --Has our drug package been collected hasBeenCollected=false --If so reset it local location=math.random(2) --Choose a random location from the array theDrug = createPickup ( locx[location], locy[location], locz[location], 3, 1279) --Possibly not passing the element to theDrug createBlipAttachedTo ( theDrug, 36) setElementData(theDrug, "rpg.drug", "a")--We cannot pass theDrug to addEventHandler as element(Perhaps a bug or user error) outputChatBox ( "A new drug package is available for pick up", getRootElement(), 0, 0, 255, true )--Tell everyone about it. end end function startDrugRun() --Sets up the timer for the drug run this can be ignored setTimer(setupDrugRun, 1000, 0) end addEventHandler("onResourceStart", resourceRoot, startDrugRun)--Starts up the timer on resource start. addEventHandler("onPlayerPickupUse",root,pickedUpDrug) --Replacing root with theDrug results in nothing
-
My issue is using givePlayerMoney just does nothing with no errors and no feedback at all. LaCosta's suggestion worked fine though.
-
It seems the givePlayerMoney is not behaving as it should in this case. I get output into the chatbox but I receive no money. local hasBeenCollected local theDrug local locx,locy,locz={-2923.1591},{1165.1446},{13.5312} function pickedUpDrug(pickup,dimension) if(getElementData(theDrug, "rpg.drug") == "a") then local dbgmny = setPlayerMoney(source, 20000) if(dbgmny == false) then outputChatBox("Error money", getRootElement(), 0, 0, 255, true) end outputChatBox ( getPlayerName(source).." has collected the drug package", getRootElement(), 0, 0, 255, true ) end end function setupDrugRun() hasBeenCollected=false local location=math.random(1) theDrug = createPickup ( locx[location], locy[location], locz[location], 3, 1279) setElementData(theDrug, "rpg.drug", "a") outputChatBox ( "A new drug package is available for pick up", getRootElement(), 0, 0, 255, true ) end addEventHandler("onResourceStart", resourceRoot, setupDrugRun) addEventHandler("onPlayerPickupUse",root,pickedUpDrug) Please mind the messy code, also I should note that I used setElementData because when I called addEventHandler("onPickupUse", theDrug, pickedUpDrug) I would get no output at all.
-
If this is your gamemode you must use spawnPlayer() in order to spawn the players at start. local X= local Y= local Z= --Write your spawn coordinates after the X, Y and Z function PLJOIN() spawnPlayer(source, X, Y, Z) fadeCamera(source, true) setCameraTarget(source, source) end addEventHandler("onPlayerJoin", getRootElement(), PLJOIN) --Change this to "onPlayerLogin" if you want players to spawn at login
-
Thanks I am not looking to do much I am just scripting for fun and the problem is it wouldn't save to the xml file but I will see if yours works. Also the script was just a test script thanks. Note: I was pretty tired when I wrote this so the debug string thing was probably due to that. :3
-
It seems when I execute this code it doesn't save to the xml file like it is intended to. Ranks.xml <Ranks> <gameranks> </gameranks> </Ranks> Meta.xml <meta> <info name="RankSystem" author="Blueman" version="1.0.0" type="script"></info> <script src="Main.lua" type="server"/> <file src="Ranks.xml" /> </meta> Ranks = xmlLoadFile ( "Ranks.xml" ) function createRank(INT, Label) if (INT) and (Label) then local GR = xmlFindChild(Ranks,"gameranks",0) if (xmlFindChild(GR, INT)) then outputDebugSting("That rank has been created already") else xmlNodeSetValue (xmlCreateChild (GR , INT), Label ) xmlSaveFile(Ranks) end else outputDebugString("In function createRank() incorrect arguments") end end Any help would be appreciated.
-
24.11.225.9 You are fast to respond
-
It seems that no one accept me is able to connect to my server. My ports are forwarded properly I made sure the firewall was set up right and yet no one can connect. I have no problem with my other servers such as my http and MC server. Also a little thing to note is that it is unable to connect to game-monitor.com it says it is unavailable.
-
Thanks for the help.
-
Where would it be best to ask about problems with my server I can't seem to remember where.
-
One problem you set the amount of times to repeat to 0 causing an infinite loop. local PingTable = { } local default_time = 10000 addEventHandler( 'onPlayerJoin', root, function( ) PingTable [ source ] = setTimer( function( player ) if getPlayerPing( player ) > tonumber( get( 'MaxPing' ) ) then kickPlayer( player, "High Ping" ) else outputDebugString( '*'..getPlayerName( player ).. ' Has passed the ping check' ) end end, tonumber( get( "Delay" ) or default_time ), 1 , source ) end ) addEventHandler( 'onPlayerQuit', root, function( ) if isTimer( PingTable [ source ] ) then killTimer( PingTable [ source ] ) end PingTable [ source ] = nil end )
-
It is still polite to make sure he knows. :3
-
Well the console keeps claiming that this is a string then I make some changes to convert it from a string to a int and it says it is a Boolean. Ping.lua PingTable = { } function PingCheck(source) if (getPlayerPing(sourcer) > get("MaxPing")) then kickPlayer(ThePlayer, "High Ping") else outputConsle( ThePlayer.. "Has passed the ping check") end end function onPlayerJoinGame() table.insert(PingTable ,setTimer(PingCheck, tonumber(get("Delay")), 1 , source) ) end addEventHandler("onPlayerJoin", getRootElement(), onPlayerJoinGame) Meta.xml <Meta> <info author="Blueman" type="script" name="Ping Kicker" /> <script src="Ping.lua" type="server"/> <settings> <setting name="MaxPing" value="50"/> <setting name="Delay" value="10000"/> </settings> </Meta>
-
You can just put a script in a function and execute that function when needed like so. function excutor() --A bunch of code here. CODE() --A bunch of code here. end function CODE() --Your code to be executed here. end