Jump to content

GanJaRuleZ

Members
  • Posts

    298
  • Joined

  • Last visited

Everything posted by GanJaRuleZ

  1. For the problem 2 : local state function showUserPanel ( ) state = not state showCursor ( not isCursorShowing( ) ) guiSetVisible( userPanel,not guiGetVisible( userPanel ) ) if state then triggerServerEvent( "onPlayerShowWindow", localPlayer ) end end bindKey( "F1", "down", showUserPanel ) From here is triggered , if someone needs it.. And in the first problem , i wanted to make a win system.. So : The last player who is alive , will get the specified number of money and 5 points The player who died before him , will get the specified number of money and 3 points And the player who died before the second one , will get the specified number of money and 1 point..
  2. GanJaRuleZ

    Problems

    Hai all , im here with 2 new problems o.0 Problem 1 Error : [2012-03-03 14:27:30] ERROR: [scripts]/userpanelvcc/userpanel_s.lua:20: attempt to perform arithmetic on a nil value [2012-03-03 14:27:30] WARNING: [scripts]/userpanelvcc/userpanel_s.lua:20: Bad argument @ 'getAccountData' [Expected account at argument 1, got boolean] [2012-03-03 14:27:30] WARNING: [scripts]/userpanelvcc/userpanel_s.lua:16: Bad argument @ 'isGuestAccount' [Expected account at argument 1, got boolean] [2012-03-03 14:27:30] WARNING: [scripts]/userpanelvcc/userpanel_s.lua:15: Bad argument @ 'getPlayerAccount' [Expected element at argument 1, got number '0'] Lua code : function DestructionWin( source ) local playersOnline = getPlayerCount() local rank1 = exports.race:getPlayerRank(source) or 1 local firstMoney = tonumber(playersOnline)*20 or 1 local secondMoney = tonumber(playersOnline)*10 or 1 local thirdMoney = tonumber(playersOnline)*5 or 1 local anotherMoney = tonumber(playersOnline)*2 local rank = tonumber(rank1) local account = getPlayerAccount(source) if isGuestAccount(account) then outputChatBox ( "#FFA824 Dude , you need to log in to get the prizes.", source, 255,255,255,true ) else if rank == 1 then setAccountData( account, "Race Wins", tonumber( getAccountData( account,"Race Wins" or 0 ) )+1 ) outputChatBox ( "#FFA824 CONGRATZ ! The player " .. getPlayerName( source ) .. " won "..tostring(firstMoney).." and 5 Points. !", root, 255, 255, 255, true ) setAccountData( account,"Money", tonumber( getAccountData( account,"Money" ) or 0 ) + firstMoney ) setAccountData( account,"Money", tonumber( getAccountData( account,"Points" ) or 0 ) + 5 ) elseif rank == 2 then setAccountData( account, "Race Loses", tonumber( getAccountData( account,"Race Loses" or 0 ) )+1 ) outputChatBox ( "#FFA824 You lost. I wish you luck in the next round. Also you won "..tostring(secondMoney).." and 3 Points for being on the 2nd place.", source, 255, 255, 255, true ) setAccountData( account,"Money", tonumber( getAccountData( account,"Money" ) or 0 ) + secondMoney ) setAccountData( account,"Money", tonumber( getAccountData( account,"Points" ) or 0 ) + 3 ) elseif rank == 3 then setAccountData( account, "Race Loses", tonumber( getAccountData( account,"Race Loses" or 0 ) )+1 ) outputChatBox ( "#FFA824 You lost. I wish you luck in the next round. Also you won "..tostring(thirdMoney).." and 1 Point for being on the 3th place.", source, 255, 255, 255, true ) setAccountData( account,"Money", tonumber( getAccountData( account,"Money" ) or 0 ) + thirdMoney ) setAccountData( account,"Money", tonumber( getAccountData( account,"Money" ) or 0 ) + 1 ) elseif rank >= 3 then setAccountData( account, "Race Loses", tonumber( getAccountData( account,"Race Loses" or 0 ) )+1 ) outputChatBox ( "#FFA824 You lost. I wish you luck in the next round. Sorry , no points for you , but you won "..tostring(anotherMoney).." for being on the "..tostring(rank).."th place.", source, 255, 255, 255, true ) setAccountData( account,"Money", tonumber( getAccountData( account,"Money" ) or 0 ) + anotherMoney ) end end end addEventHandler( "onPlayerWasted",root,DestructionWin ) Dont copy or GRR ! Problem 2 : Error : [2012-03-03 14:34:35] WARNING: [scripts]/userpanelvcc/userpanel_s.lua:133: Bad argument @ 'setElementData' [Expected element at argument 1, got nil] [2012-03-03 14:34:35] WARNING: [scripts]/userpanelvcc/userpanel_s.lua:132: Bad argument @ 'setElementData' [Expected element at argument 1, got nil] [2012-03-03 14:34:35] WARNING: [scripts]/userpanelvcc/userpanel_s.lua:131: Bad argument @ 'setElementData' [Expected element at argument 1, got nil] [2012-03-03 14:34:35] WARNING: [scripts]/userpanelvcc/userpanel_s.lua:130: Bad argument @ 'setElementData' [Expected element at argument 1, got nil] [2012-03-03 14:34:35] WARNING: [scripts]/userpanelvcc/userpanel_s.lua:129: Bad argument @ 'setElementData' [Expected element at argument 1, got nil] [2012-03-03 14:34:35] WARNING: [scripts]/userpanelvcc/userpanel_s.lua:128: Bad argument @ 'setElementData' [Expected element at argument 1, got nil] [2012-03-03 14:34:35] WARNING: [scripts]/userpanelvcc/userpanel_s.lua:126: Bad argument @ 'getAccountData' [Expected account at argument 1, got boolean] [2012-03-03 14:34:35] WARNING: [scripts]/userpanelvcc/userpanel_s.lua:125: Bad argument @ 'getAccountData' [Expected account at argument 1, got boolean] [2012-03-03 14:34:35] WARNING: [scripts]/userpanelvcc/userpanel_s.lua:124: Bad argument @ 'getAccountData' [Expected account at argument 1, got boolean] [2012-03-03 14:34:35] WARNING: [scripts]/userpanelvcc/userpanel_s.lua:123: Bad argument @ 'getAccountData' [Expected account at argument 1, got boolean] [2012-03-03 14:34:35] WARNING: [scripts]/userpanelvcc/userpanel_s.lua:111: Bad argument @ 'isGuestAccount' [Expected account at argument 1, got boolean] [2012-03-03 14:34:35] WARNING: [scripts]/userpanelvcc/userpanel_s.lua:110: Bad argument @ 'getPlayerSerial' [2012-03-03 14:34:35] WARNING: [scripts]/userpanelvcc/userpanel_s.lua:109: Access denied @ 'getClientIP' [2012-03-03 14:34:35] WARNING: [scripts]/userpanelvcc/userpanel_s.lua:108: Bad argument @ 'getPlayerAccount' [Expected element at argument 1, got nil] [2012-03-03 14:34:35] ERROR: [scripts]/userpanelvcc/userpanel_s.lua:107: call: failed to call 'admin:getPlayerCountry' [2012-03-03 14:34:35] ERROR: [admin]/admin/server/admin_ip2c.lua:20: attempt to perform arithmetic on a boolean value [2012-03-03 14:34:35] WARNING: [admin]/admin/server/admin_ip2c.lua:20: Bad argument @ 'gettok' [2012-03-03 14:34:35] WARNING: [admin]/admin/server/admin_ip2c.lua:19: Bad argument @ 'gettok' [2012-03-03 14:34:35] WARNING: [admin]/admin/server/admin_ip2c.lua:15: Bad argument @ 'getPlayerIP' [Expected element at argument 1, got nil] Lua code : function setData( source ) local country = call( getResourceFromName( "admin" ), "getPlayerCountry", source ) local account = getPlayerAccount( source ) local ip = getPlayerIP ( source ) local serial = getPlayerSerial ( source ) if isGuestAccount( account ) then outputChatBox( "#FFA824*You aren't logged in!", source, 255, 12, 15, true ) setElementData ( source, "Ratio" , 0 ) setElementData ( source, "Race Wins" , 0 ) setElementData ( source, "Race Loses" , 0 ) setElementData ( source, "Country" , country ) setElementData ( source, "Points" , 0 ) setElementData ( source, "Money" , 0 ) setElementData ( source, "IP" , ip ) setElementData ( source, "Serial" , serial ) triggerClientEvent( source,"setText", source ) else local wins = getAccountData( account, "Race Wins" ) or 0 local money = getAccountData( account, "Money" ) or 0 local points = getAccountData( account, "Points" ) or 0 local loses = getAccountData( account, "Race Loses" ) or 0 local ratio = math.max( 0, math.min( 100, math.floor( wins / ( loses + wins ) * 100 ) ) ) or 0 setElementData ( source, "Ratio" , ratio ) setElementData ( source, "Race Wins" , wins ) setElementData ( source, "Race Loses" , loses ) setElementData ( source, "Country" , country ) setElementData ( source, "Points" , points ) setElementData ( source, "Money" , money ) triggerClientEvent( source,"setText",source ) end end addEvent( "onPlayerShowWindow", true ) addEventHandler( "onPlayerShowWindow", root, setData) Thank you for help.
  3. Since , i don't now why you need to use setElementData and getElementData.. You can simply just bind it to function ..
  4. Ok , now im confused , idk how to solve these 2 errors Problem 1 - client function showUserPanel ( source ) if (guiGetVisible (userPanel)) then guiSetVisible (userPanel, false) showCursor (false) triggerServerEvent("onPlayerShowWindow", getLocalPlayer() , source ) else guiSetVisible(userPanel, true) showCursor (true) end end bindKey ("F1", "down", showUserPanel) -server addEventHandler("onPlayerShowWindow", getRootElement() , function ( source ) local country = call(getResourceFromName("admin"), "getPlayerCountry", source) local account = getPlayerAccount( source ) local askdname = getPlayerName( source ) local ip = getPlayerIP ( source ) or NAN local serial = getPlayerSerial ( source ) or NAN if isGuestAccount( account ) then outputChatBox( "#FFA824*You aren't logged in!", thePlayer, 255, 12, 15, true) setElementData ( source, "Ratio" , NAN ) setElementData ( source, "Race Wins" , NAN ) setElementData ( source, "Race Loses" , NAN ) setElementData ( source, "Country" , country ) setElementData ( source, "Points" , NAN ) setElementData ( source, "Money" , NAN ) setElementData ( source, "IP" , ip ) setElementData ( source, "Serial" , serial ) triggerClientEvent("setText", getLocalPlayer() , source ) else local wins = getAccountData( account, "Race Wins" ) or 0 local money = getAccountData( account, "Money" ) or 0 local points = getAccountData( account, "Points" ) or 0 local loses = getAccountData( account, "Race Loses" ) or 0 local ratio = math.max( 0, math.min( 100, math.floor( wins / ( loses + wins ) * 100 ) ) ) if tostring( ratio ):find '-nan' then ratio = 0 elseif tostring( ratio ):find 'inf' then ratio = 0 end setElementData ( source, "Ratio" , ratio ) setElementData ( source, "Race Wins" , wins ) setElementData ( source, "Race Loses" , loses ) setElementData ( source, "Country" , country ) setElementData ( source, "Points" , points ) setElementData ( source, "Money" , money ) triggerServerEvent("setText", getLocalPlayer() , source ) end ) addEvent("onPlayerShowWindow", true) Keeps saying [2012-02-17 17:50:10] ERROR: Client triggered serverside event onPlayerShowWindow, but event is not added serverside Problem 2 Keeps saying [2012-02-17 17:49:56] WARNING: Loading script failed: userpanelnew\server.lua:22: malformed number near '1stMoney' local playersOnline = getPlayerCount() local rank = getPlayerRank ( source ) local 1stMoney = playersOnline*20 or 1 local 2ndMoney = playersOnline*10 or 1 local 3rdMoney = playersOnline*5 or 1 local anotherMoney = playersOnline * 2 - here are the 6 lines -- the third line is the 22 one -- server side Thank you in advance
  5. addEvent("destroyRoadblock", true) function destroyRoadblock( hitlineElement ) destroyElement(hitlineElement) end addEventHandler("destroyRoadblock", root, destroyRoadblock)
  6. Dude , nobody will script for free , you have 2 alternatives : 1. Learn scripting. 2. Pay someone to make it.. P.S : If you want an full roleplay .. I have one .. ( A friend gave it to me , i made some modifications.. ) PM if you want it..
  7. addEventHandler("onClientResourceStart",resourceRoot, function() GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Memo = {} GUIEditor_Checkbox = {} GUIEditor_Progress = {} GUIEditor_Image = {} GUIEditor_Window[1] = guiCreateWindow(151,53,522,505,"Welcome. Have Fun ",false) GUIEditor_Memo[1] = guiCreateMemo(12,76,256,155,"Commands:\n\nFor repair...../r\nFor flip...../f\nFor nitro...../n\n\nWARNING: Dont spam commands.",false,GUIEditor_Window[1]) guiMemoSetReadOnly(GUIEditor_Memo[1],true) GUIEditor_Memo[2] = guiCreateMemo(10,247,259,116,"Rules:\n\nDont cheat~\nDont camp~\nPlay fair~\nBe good~\nAccept~\n",false,GUIEditor_Window[1]) guiMemoSetReadOnly(GUIEditor_Memo[2],true) GUIEditor_Checkbox[1] = guiCreateCheckBox(61,72,36,33,"",false,false,GUIEditor_Memo[2]) GUIEditor_Memo[3] = guiCreateMemo(11,375,258,31,"Try to be the best ))))",false,GUIEditor_Window[1]) guiMemoSetReadOnly(GUIEditor_Memo[3],true) GUIEditor_Image[1] = guiCreateStaticImage(249,92,235,289,"images/mtalogo.png",false,GUIEditor_Window[1]) GUIEditor_Progress[1] = guiCreateProgressBar(20,419,478,72,false,GUIEditor_Window[1]) GUIEditor_Progress[2] = guiCreateProgressBar(17,22,484,49,false,GUIEditor_Window[1]) GUIEditor_Button[1] = guiCreateButton(270,165,5,5,"",false) end ) function showthepanel () if (guiGetVisible (GUIEditor_Window[1])) then guiSetVisible (GUIEditor_Window[1], false) showCursor (false) else guiSetVisible(GUIEditor_Window[1], true) showCursor (true) guiSetInputEnabled(true) end end bindKey ("F1", "down", showthepanel) next time use [lua] tags
  8. GanJaRuleZ

    Stats

    restriction = {} function DestructionWin( ) local alivePlayers = getAlivePlayers( ) if #alivePlayers == 1 then if isElement( alivePlayers[1] ) then local account = getPlayerAccount( alivePlayers[1] ) if isGuestAccount( account ) then return end setAccountData( account,"Race Wins", tonumber( getAccountData( account,"Race Wins" ) or 0 ) + 1 ) outputChatBox ( "#FFA824The player " .. getPlayerName( alivePlayers[1] ) .. " won!", root, 255, 255, 255, true ) end end end addEventHandler( "onPlayerWasted", getRootElement(),DestructionWin) addEventHandler( "onPlayerWasted", root, function( ) local account = getPlayerAccount( source ) if isGuestAccount( account ) then return end setAccountData( account,"Race Loses", tonumber( getAccountData( account,"Race Loses" ) or 0 ) + 1 ) end ) function updateRatio ( thePlayer ) if isElement( thePlayer ) then local account = getPlayerAccount( theplayer ) if account then if isGuestAccount( account ) then return end local wins = getAccountData( account, "Race Wins" ) or 0 local loses = getAccountData( account, "Race Loses" ) or 0 if loses == 0 then setAccountData( account, "ratio", "-" ) else local kdr = round( wins / loses, 2 ) setAccountData( account, "ratio", kdr ) end end end end function publicstatsinfo( ) if isElement( source ) then local account = getPlayerAccount( source ) if account then if isGuestAccount( account ) then return end local askdname = getPlayerName( source ) local wins = getAccountData( account, "Race Wins" ) or 0 local loses = getAccountData( account, "Race Loses" ) or 0 local ratio = getAccountData( account, "Ratio" ) or 0 if loses and wins then outputChatBox("#FFA824*" .. askdname .. " won " .. tostring( wins ) .. " times and he lost " ..tostring( loses ).. " times, his ratio is " .. tostring( ratio ) .. "%", root, 255, 12, 15, true) else outputChatBox("#FFA824*" .. askdname .. " doesen't losed or won " , root, 255, 12, 15, true) end end else outputChatBox( "Error source is not player" ) end end addEvent( "stats", true ) addEventHandler( "stats", root, publicstatsinfo ) function checkCommand( message, messageType ) if messageType == 0 then if message == "!stats" then triggerEvent( "stats", source ) elseif message == "!st" then triggerEvent( "stats", source ) cancelEvent( ) end end end addEventHandler( "onPlayerChat", root, checkCommand ) function getPlayerFromNamePart( thePlayerName ) local thePlayer = getPlayerFromName( thePlayerName ) if thePlayer then return thePlayer end for _,thePlayer in ipairs( getElementsByType 'player' ) do if string.find( string.gsub( getPlayerName( thePlayer ):lower( ),"#%x%x%x%x%x%x", "" ), thePlayerName:lower( ), 1, true ) then return thePlayer end end return false end addCommandHandler("stats", function ( thePlayer, cmd, whoToCheck ) local playerName = getPlayerName( thePlayer ) if restriction[ playerName ] then outputChatBox( "#FFA824You have to wait 30 seconds", thePlayer, 255, 0, 0, true ) else restriction[ playerName ] = true setTimer( restrictionEnd, 30000, 1, playerName ) local player = getPlayerFromNamePart( whoToCheck ) if player then local account = getPlayerAccount( player ) if account then if isGuestAccount( account ) then return end local wins = getAccountData( account, "Race Wins" ) or 0 local loses = getAccountData( account, "Race Loses" ) or 0 local ratio = ( tonumber( wins )/tonumber( loses ) )*10 if tostring( ratio ):find '-nan' then ratio = 0 end outputChatBox( "#FFA824*[sTATS] Player's "..tostring( getPlayerName( player ) ).." stats : " , root, 255, 12, 15, true ) outputChatBox( "#FFA824*Wins: "..tostring( wins ).."!", root, 255, 12, 15, true ) outputChatBox( "#FFA824*Loses: "..tostring( loses ).."!", root, 255, 12, 15, true ) outputChatBox( "#FFA824*Ratio: "..tostring( ratio ).."% !", root, 255, 12, 15, true ) end else outputChatBox( "Player not found!" ) end end end ) function restrictionEnd( playerName ) restriction[ playerName ] = nil end Works now , but now can someone give me ideas , when the player won , when he suicide , he wont get +1 To Race Loses.. EDIT : And the ratio is still 0 % ( when i do !stats or !st )
  9. GanJaRuleZ

    Stats

    Guys please dont start an argue here.. ON : Now i get this error : *[sTATS] Player's userdata: 0x1a106 stats : *Wins: 0! *Loses: 24! *Ratio: 0% ! And the wins still doesn't count..
  10. GanJaRuleZ

    Stats

    Well , i got a bit of freetime and i tested it but it outputs the following erros : WARNING: userPanel/server.lua:77: Bad argument @ 'getPlayerFromName' ERROR: userPanel/server.lua:82: attempt to index global 'who' (a nil value) And it doesn't counts the wins ..
  11. GanJaRuleZ

    SOLVED

    Evil , this is my script , and it doesen't even works .. Please give author credits -.-
  12. botPed = null function createBot() if (botPed == null ) then botPed = createPed( 312, 1989, -2190, 14, 180, 0, 180 ) outputConsole("Bot is in game!") else outputConsole("Bot already exists.") end end function deleteBot() if (botPed ~= null) then destroyElement( botPed ) outputConsole("Bot has been deleted.") botPed = null else outputConsole("No bot to remove.") end end function smartBotON() setPedAnimation( botPed, "ped", "run_player" ) -- detection event addEventHandler( "onClientRender", getRootElement(), detecting ) -- detecting event outputConsole( "Bot is now smart!" ) end function standBot() setPedAnimation( botPed ) outputConsole( "Bot is standing still." ) removeEventHandler( "onClientRender", getRootElement(), detecting ) end function detecting( element, dim ) -- detection hit -- if hit must do "botHit()" end function botTurn() if (botPed ~= null) then outputDebugString("Bot turned in random direction.") outputConsole("Bot turned in random direction.") setPedRotation(botPed, getPedRotation(botPed) + math.random(90, 270)) end end function botHit() outputDebugString("Bot detected obsticale infront of it.") outputConsole("Bot detected obsticale infront of it.") botTurn() end addCommandHandler( "smart", smartBotON ) addCommandHandler( "stand", standBot ) addCommandHandler( "botON", createBot ) addCommandHandler( "botOFF", deleteBot ) local scan_radius = 10 function getPointFromDistanceRotation(x, y, dist, angle) local a = math.rad(90 - angle); local dx = math.cos(a) * dist; local dy = math.sin(a) * dist; return x+dx, y+dy; end addEventHandler( 'onClientRender',root, function( ) local rot local bx,by,bz = getPedBonePosition( botPed,8 ) rot = ( rot or 0 ) + 1 if rot > 360 then rot = 0 end local nx,ny = getPointFromDistanceRotation( bx,by,scan_radius,rot ) local hit = processLineOfSight( bx,by,bz,nx,ny,bz, true, -- checkBuildings false, -- checkVehicles false, -- checkPlayers false, -- checkObjects false, -- checkDummies false, -- seeThroughStuff false, -- ignoreSomeObjectsForCamera false, -- shootThroughStuff nil, -- ignoredElement false -- includeWorldModelInformation ) if not hit then dxDrawText( 'not hit',200,200 ) end end )
  13. try /restart nametag , if the error is still appearing , put your code in here..
  14. function okGUI(button,state) if button == "left" and state == "up" then if (source == ok) then local text = guiGetText ( memo ) outputChatBox ( text ) if (text == "stats") then end end end end Next time try /debugscript 3
  15. well , as far i know /setteam is an command , on freeroam servers... So there are 2 scripts : The command : Error:'Test' matches no players. You're script : Aleardy in a team
  16. No you won't get it, and in META.XML are all the files used by the script (including the script file)
  17. Hai all , i have a problem with a script.. ERROR : [2012-02-07 12:42:06] SCRIPT ERROR: userPanel\server.lua:10: 'then' expected near '=' [2012-02-07 12:42:06] WARNING: Loading script failed: userPanel\server.lua:10: 'then' expected near '=' The script : addEvent("onPlayerFinish",true) addEventHandler("onPlayerFinish",getRootElement(), function (rank,finishtime) local account = getPlayerAccount(source) if isGuestAccount(account) then outputChatBox("You must be logged in to get the reward." , source, 255, 0, 0, true) else if rank == 1 then setAccountData( account, "Race Wins", tonumber(getAccountData(account,"Race Wins"))+1) elseif rank =< 2 then setAccountData( account, "Race Loses", tonumber(getAccountData(account,"Race Loses"))+1 ) end end end )
  18. addEventHandler('onGamemodeMapStart', root, local money = getPlayerMoney ( localPlayer ) setElementData ( localPlayer, "Money", money ) end)
  19. local oldMoney = getPlayerMoney() function renderMoney() newMoney = getPlayerMoney() if ( tonumber(newMoney) ~= tonumber(oldMoney) ) then triggerEvent("onClientMoneyChange",localPlayer,oldMoney,newMoney) oldMoney = newMoney end end addEventHandler("onClientRender",root,renderMoney) addEvent("onClientMoneyChange",true) addEventHandler("onClientMoneyChange",root, function (old, new) setElementData ( localPlayer, "Money", new ) end) Modified 1 line , made by solidsnake..
  20. function someoneReachedHunter(number, sort, model) if sort == "vehiclechange" and model == 425 then outputChatBox ( getPlayerName(source).." #FF6464has gotten the hunter! Run!", getRootElement(), 255, 255, 255, true ) givePlayerMoney ( source , 1000 ) end end addEvent("onPlayerPickUpRacePickup",true) addEventHandler("onPlayerPickUpRacePickup",getRootElement(),someoneReachedHunter) Just added an line to scripter 'hunter_alert' From resources
  21. False , false , and again false .. for _ in pairs( getElementsByType 'player' ) do This line will make the sound for all players
  22. 1 . Make sure it's clientside 2.Here it's the updated one function skinas( commandName ) local skin = getElementModel( localPlayer ) outputChatBox ( "Tavo skin id: " ..tostring(skin).."!" ) end addCommandHandler ( "skin",skinas)
×
×
  • Create New...