Jump to content

WolfPire

Members
  • Posts

    141
  • Joined

  • Last visited

Everything posted by WolfPire

  1. Btw... Same error of the concatenate thing.
  2. Believe it or not, localPlayer can also be used server-side if you do it the correct way
  3. well this is how it ended up after some testing... FR Client --------------------------- -- Profile --------------------------- ProfileW = guiCreateWindow(497,155,345,471,"",false) ProfileN = guiCreateLabel(16,114,300,16,"Name:",false,ProfileW) ProfileMS = guiCreateLabel(16,139,300,16,"Member Since: ",false,ProfileW) Line1 = guiCreateLabel(14,162,317,18,"_____________________________________________",false,ProfileW) guiLabelSetColor(Line1,0,255,0) ProfileK = guiCreateLabel(16,190,300,16,"Kills:",false,ProfileW) ProfileHS = guiCreateLabel(38,215,300,16,"Headshots: ",false,ProfileW) ProfileD = guiCreateLabel(16,239,300,16,"Deaths: ",false,ProfileW) ProfileT = guiCreateLabel(16,294,300,16,"Team: ",false,ProfileW) Line2 = guiCreateLabel(14,264,317,18,"_____________________________________________",false,ProfileW) guiLabelSetColor(Line2,0,255,0) Exp = guiCreateLabel(16,322,300,16,"Experience: ",false,ProfileW) ButtonPX = guiCreateButton(273,435,63,26,"X",false,ProfileW) guiWindowSetSizable(ProfileW,false) local screenW,screenH=guiGetScreenSize() local windowW,windowH=guiGetSize(ProfileW,false) local x,y = (screenW-windowW)/2,(screenH-windowH)/2 guiSetPosition(ProfileW,x,y,false) guiSetVisible(ProfileW, false) function nProfile() if guiGetVisible(ProfileW) == true then guiSetVisible(ProfileW, false) removeEventHandler("onClientGUIClick", ButtonPX, closeManualP) else guiSetVisible(ProfileW, true) setTimer(Data,1000,1) addEventHandler("onClientGUIClick", ButtonPX, closeManualP) end end function closeManualP() guiSetVisible(ProfileW, false) removeEventHandler("onClientRender", root, Data) end function Data() triggerServerEvent("DataS", root, localPlayer) end addEvent("DataC",true) addEventHandler("DataC", root, function( sincehoursT, sinceminutesT, sincedayT, sincemonthT, sinceyearT, exppoints, exppoints ) guiSetText(ProfileMS, "Member Since: " .. sincedayT .. " / " .. sincemonthT .. " / " .. sinceyearT .. " | " .. sincehoursT .. ":" .. sinceminutesT ) guiSetText(Exp, "Experience: " .. exppoints) end ) FR Server addEvent("DataS",true) addEventHandler("DataS",root, function(localPlayer) pAccount = getPlayerAccount ( localPlayer ) getAccountData( pAccount, "player.member" ) sincehours = sincehoursT sinceminutes = sinceminutesT sinceday = sincedayT sincemonth = sincemonthT sinceyear = sinceyearT exppoints = exports.exp:addPlayerEXP(localPlayer,5) triggerClientEvent("DataC", root, sincehoursT, sinceminutesT, sincedayT, sincemonthT, sinceyearT, exppoints) end ) ___________________________________ No errors, except one in the debug that says: "ERROR: freeroam/fr_client.lua:794: attempt to concatenate local 'sinceminutesT' (a nil value)" For some reason the account data doesn't retrieve.
  4. Better but.. "[2012-03-17 14:17:29] WARNING: freeroam\fr_server.lua:528: Bad argument @ 'getPlayerAccount' [Expected element at argument 1, got nil] [2012-03-17 14:17:29] WARNING: freeroam\fr_server.lua:528: Bad argument @ 'getAccountData' [Expected account at argument 1, got boolean]"
  5. "addEventHandler("onClientRender", root, Data)" Is added when the label "My profile" is clicked in the FR GUI. There is when the errors appear and when it renders the "triggerServerEvent". That's why they don't
  6. Those errors come from console, you checked in there? EDIT: Oh yeah, it appears once you pop up the Profile window from FR
  7. I will use another way to update the guiLabel but, then... How will i use "getAccountData"? and how do i fix the error?
  8. Don't worry, it wont... However right now i'm realizing that it's not necessary to render all. so maybe i'll make a change after i fix this "Member since" problem.
  9. Yes, to get real time stats, i'm willing to add many things in there. that's why.
  10. So guys, i'm creating a profile system which will store data of the player, however i'm having problems getting the player's account. It is associated to other resources so here's where it is. _______________________________________________________________________________________________________ Login System (Server) addEvent("register",true) addEventHandler("register",getRootElement(), function(thePlayer, NameR, PassR, Confirm) if not (NameR == "") then if not (PassR == "") then if not (Confirm == "") then if PassR == Confirm then local account = getAccount (NameR,PassR) if (account == false) then local accountAdded = addAccount(tostring">tostring">tostring">tostring">tostring(NameR),tostring">tostring">tostring(PassR)) if (accountAdded) then outputChatBox ("You've successfully registred! [Name: " .. NameR .. "| Password: " .. PassR .. "]",thePlayer,0,255,0,true ) local time = getRealTime() hours = time.hour minutes = time.minute day = time.monthday month = time.month year = time.year sincehours = hours sinceminutes = minutes sinceday = day sincemonth = month sinceyear = year setAccountData( getPlayerAccount ( thePlayer ), "player.member", sincehours) setAccountData( getPlayerAccount ( thePlayer ), "player.member", sinceminutes) setAccountData( getPlayerAccount ( thePlayer ), "player.member", sinceday) setAccountData( getPlayerAccount ( thePlayer ), "player.member", sincemonth) setAccountData( getPlayerAccount ( thePlayer ), "player.member", sinceyear) setTimer(outputChatBox,800,1,"Try to login now! Remember this information to login!",thePlayer,0,255,0,true ) else outputChatBox ("ERROR: Please use another Name/Password.",thePlayer,255,0,0,true) end else outputChatBox ("ERROR: A player with that name already exist.",thePlayer,255,0,0,true) end else outputChatBox ("ERROR: The passwords don't match.",thePlayer,255,0,0,true) end else outputChatBox ("ERROR: Please confirm your password.",thePlayer,255,0,0,true) end else outputChatBox ("ERROR: Please put a password.",thePlayer,255,0,0,true) end else outputChatBox ("ERROR: Please put a name.",thePlayer,255,0,0,true) end end ) _______________________________________________________________________________________________________ Freeroam (client) --------------------------- -- Profile --------------------------- ProfileW = guiCreateWindow(497,155,345,471,"",false) ProfileN = guiCreateLabel(16,114,300,16,"Name:",false,ProfileW) ProfileMS = guiCreateLabel(16,139,300,16,"Member Since: ",false,ProfileW) Line1 = guiCreateLabel(14,162,317,18,"_____________________________________________",false,ProfileW) guiLabelSetColor(Line1,0,255,0) ProfileK = guiCreateLabel(16,190,300,16,"Kills:",false,ProfileW) ProfileHS = guiCreateLabel(38,215,300,16,"Headshots: ",false,ProfileW) ProfileD = guiCreateLabel(16,239,300,16,"Deaths: ",false,ProfileW) ProfileT = guiCreateLabel(16,294,300,16,"Team: ",false,ProfileW) Line2 = guiCreateLabel(14,264,317,18,"_____________________________________________",false,ProfileW) guiLabelSetColor(Line2,0,255,0) Exp = guiCreateLabel(16,322,300,16,"Experience: ",false,ProfileW) ButtonPX = guiCreateButton(273,435,63,26,"X",false,ProfileW) guiWindowSetSizable(ProfileW,false) local screenW,screenH=guiGetScreenSize() local windowW,windowH=guiGetSize(ProfileW,false) local x,y = (screenW-windowW)/2,(screenH-windowH)/2 guiSetPosition(ProfileW,x,y,false) guiSetVisible(ProfileW, false) function nProfile() if guiGetVisible(ProfileW) == true then guiSetVisible(ProfileW, false) removeEventHandler("onClientRender", root, Data) removeEventHandler("onClientGUIClick", ButtonPX, closeManualP) else guiSetVisible(ProfileW, true) addEventHandler("onClientRender", root, Data) addEventHandler("onClientGUIClick", ButtonPX, closeManualP) end end function closeManualP() guiSetVisible(ProfileW, false) removeEventHandler("onClientRender", root, Data) end function Data() triggerServerEvent("DataS", root, localPlayer) end addEvent("DataC",true) addEventHandler("DataC", root, function( sincehoursT, sinceminutesT, sincedayT, sincemonthT, sinceyearT, exppoints, exppoints ) guiSetText(ProfileMS, "Member Since: " .. sincedayT .. " / " .. sincemonthT .. " / " .. sinceyearT .. " | " .. sincehoursT .. ":" .. sinceminutesT ) guiSetText(Exp, "Experience: " .. exppoints) end ) _______________________________________________________________________________________________________ Freeroam (Server) addEvent("DataS",true) addEventHandler("DataS",root, function(thePlayer) pAccount = getPlayerAccount ( thePlayer ) getAccountData( pAccount, "player.member" ) sincehours = sincehoursT sinceminutes = sinceminutesT sinceday = sincedayT sincemonth = sincemonthT sinceyear = sinceyearT exppoints = exports.exp:addPlayerEXP(thePlayer,5) triggerClientEvent("DataC", root, sincehoursT, sinceminutesT, sincedayT, sincemonthT, sinceyearT, exppoints) end ) _______________________________________________________________________________________________________ Console outputs: "[2012-03-17 14:17:29] WARNING: freeroam\fr_server.lua:528: Bad argument @ 'getPlayerAccount' [Expected element at argument 1, got nil] [2012-03-17 14:17:29] WARNING: freeroam\fr_server.lua:528: Bad argument @ 'getAccountData' [Expected account at argument 1, got boolean]" _______________________________________________________________________________________________________ Debug outputs: "ERROR: freeroam/fr_client.lua:795: attempt to concatenate local 'sinceminutesT' (a nil value)" <--- I know this is obvious _______________________________________________________________________________________________________ I'm also using "Castillos" experience resource... Yes... The script is not all done, i will finish the rest later, but is this, which is being a pain. The problem as obvious as it looks is that the "Member Since" wont render as it has a problem on getting the player's account and i find no solution for this. Please, help! >_<
  11. Weird, cus' im in the train station as for when the train arrives, near the colshapes, but i think i'll have to set colshapes streamables like i did with the train and pilot... don't i?
  12. Hmmm, isn't there a way for the colshape to detect the Train Vehicle element?
  13. Hi there! IIYAMA-san! I tried to freeze it with setElementVelocity before, it didn't seem to work D: But thank you! =) And no sadly the outputChatBox doesn't trigger neither so i think it's a condition problem.
  14. So, i made a big project, which consists in a automatic Train System that goes alla round San andreas, i also asked for help with a friend, but no luck, so we abandon the project. So i wanna re-take it, and see if i can recieve some help on this little problem... So the problem is, that when the train touches the colsphere, it won't stop (the ped wont desaccelerate) Server ---------------------Col---------------------------------------------- LsUnity = createColSphere(1688.4095458984,-1953.9764404297,14.546875,3) LsMarket = createColSphere(783.00677490234,-1337.8107910156,-0.6554099082947,3) SfCanberry = createColSphere(-1945.2680664063,161.08346557617,161.58346557617,6) LvYB = createColSphere(1473.7739257813,2634.1916503906,11.2203125,6) LvLinden = createColSphere(2866.80078125,1245.5402832031,11.2203125,6) ---------------------------------------------------------------------- Train1 = createVehicle(538,1729.6799316406,-1951.4211425781,13.546875) Pass1 = createVehicle(437,1772,-1957,14) createBlipAttachedTo(Train1,42,2) attachElements(Pass1,Train1,0,-14,-1.1) Pilot = createPed(61,1699.9200439453,-1950.8029785156,14.1171875) setVehicleDamageProof (Pass1,true) setTrainDerailable (Train1,false) function TrainSpawn() warpPedIntoVehicle(Pilot, Train1) triggerClientEvent('streamTheTrain',root,Train1,false) triggerClientEvent('streamThePed',root,Pilot,false) setTimer(triggerClientEvent,5000,1,"accel",root, Pilot) end addEvent("onResourceDownloaded",true) addEventHandler("onResourceDownloaded",root,TrainSpawn) function TrainStopLSUnity(hitElement) if hitElement == Train1 then outputChatBox('Attention! The Train has arrived to Unity Station! (LS) You have 1 minutes to buy a ticket before the train leaves!',getRootElement(),200,0,0) setElementFrozen(Pilot,true) setTimer(TrainLeaveLSUnity,10000,1) end end addEventHandler('onColShapeHit',LsUnity,TrainStopLSUnity) function TrainLeaveLSUnity() outputChatBox('The Train has left Unity Station (LS), next stop: Market Station (LS)',getRootElement(),0,200,0) setElementFrozen(Pilot,false) setTimer(triggerClientEvent,5000,1,"accel", root, Pilot) end function TrainStopLSMarket(hitElement) if hitElement == Train1 then destroyElement(Pilot) setTrainSpeed(Train1,0) Pilot = createPed(61,1699.9200439453,-1950.8029785156,14.1171875) warpPedIntoVehicle(Pilot, Train1) outputChatBox('Attention! The Train has arrived to Market Station! (LS) You have 5 minutes to buy a ticket before the train leaves!',getRootElement(),200,0,0) setTimer(TrainLeaveLSMarket,10000,1) end end addEventHandler('onColShapeHit',LsMarket,TrainStopLSMarket) function TrainLeaveLSMarket() outputChatBox('The Train has left Market Station, next stop: Canberry Station (SF)',getRootElement(),0,200,0) setVehicleEngineState(Train1,true) setTimer(triggerClientEvent,5000,1,"accel",root, Pilot) end function TrainStopSfCanberry(hitElement) if hitElement == Train1 then setTrainSpeed(Train,0) outputChatBox('Attention! The Train has arrived to Caberry Station! (SF) You have 5 minutes to buy a ticket before the train leaves!',getRootElement(),200,0,0) setVehicleEngineState(Train1,false) setTimer(TrainLeaveSfCanberry,10000,1) end end addEventHandler('onColShapeHit',SfCanberry,TrainStopSfCanberry) function TrainLeaveSfCanberry() outputChatBox('The Train has left Canberry Station, next stop: Yellow Bell Station (LV)',getRootElement(),0,200,0) setVehicleEngineState(Train1,true) setTimer(triggerClientEvent,5000,1,"accel",root, Pilot) end function TrainStopLVYellowBell(hitElement) if hitElement == Train1 then setTrainSpeed(Train,0) outputChatBox('Attention! The Train has arrived to Yellow Bell Station! (LV) You have 5 minutes to buy a ticket before the train leaves!',getRootElement(),200,0,0) destroyElement(Pilot) local Pilot = createPed(61,1699.9200439453,-1950.8029785156,14.1171875) setVehicleEngineState(Train1,false) setTimer(TrainLeaveLvYellowBell,10000,1) end end addEventHandler('onColShapeHit',LvYB,TrainStopLVYellowBell) function TrainLeaveLvYellowBell() outputChatBox('The Train has left Yellow Bell Station, next stop: Linden Station (LV)',getRootElement(),0,200,0) setVehicleEngineState(Train1,true) setTimer(triggerClientEvent,5000,1, "accel",root, Pilot) end function TrainStopLVLinden(hitElement) if hitElement == Train1 then setTrainSpeed(Train,0) outputChatBox('Attention! The Train has arrived to Linden Station! (LV) You have 5 minutes to buy a ticket before the train leaves!',getRootElement(),200,0,0) destroyElement(Pilot) local Pilot = createPed(61,1699.9200439453,-1950.8029785156,14.1171875) setVehicleEngineState(Train1,false) setTimer(TrainLeaveLvYellowBell,10000,1) end end addEventHandler('onColShapeHit',LvLinden,TrainStopLVLinden) function TrainLeaveLvLinden() outputChatBox('The Train has left Yellow Bell Station, next stop: Unity Station (LS)',getRootElement(),0,200,0) setVehicleEngineState(Train1,true) setTimer(triggerClientEvent,5000,1, "accel",root, Pilot) end Client addEvent('accel', true) addEventHandler('accel', root, function(Pilot) setPedControlState(Pilot,"accelerate",true) end ) addEvent('stop', true) addEventHandler('stop', root, function(Pilot) setPedControlState(Pilot,"brake_reverse",true) end ) addEventHandler("onClientResourceStart",resourceRoot, function() triggerServerEvent("onResourceDownloaded",getLocalPlayer()) end ) addEvent('streamTheTrain', true) addEventHandler('streamTheTrain', root, function(Train1) setElementStreamable ( Train1, false ) end ) addEvent('streamThePed', true) addEventHandler('streamThePed', root, function(Pilot) setElementStreamable ( Pilot, false ) end ) Pardon me if any error you find, this code is old.
  15. That was exactly on my mind, just that i didn't really know how to fix it, as i tried so many ways to update values. Thanks, it works like a charm, Aibo =3 (Your name means "buddy" or "pal" in Japanese by the way, i think... n_n) And, aswell thanks like always... Solid.
  16. I know, thanks Aibo! Solid... Umm i think you didn't quite get me... When "math.random(0,255)" is triggered. IT will just give me 2 colors per 2 timers and repeat itself over and over.
  17. So i'm doing a special garage which will give your vehicle a random color every second aswell for your nametag. All's going good, until we go to the serverside script. It will just give me 2 colors, and i want it to randomize R, G, B as i'm ordering. Any idea why this script is trolling me? Client WTF = createMarker(2610, 1451, 11, "cylinder", 3, 0, 0, 0, root) function randomiseMarkerColor() r = math.random(0,255) g = math.random(0,255) b = math.random(0,255) setMarkerColor( WTF, r, g, b, 255) end addEventHandler("onClientRender",root, randomiseMarkerColor) function WTFEnt( hitPlayer ) if hitPlayer == localPlayer then if not (nyan) then if isPedOnGround( hitPlayer ) then pVehicleSG = getPedOccupiedVehicle( hitPlayer ) if pVehicleSG then fadeCamera( false, 1.0, 0, 0, 0 ) setElementFrozen(pVehicleSG,true) nyan = playSound("nyan.mp3",true) setTimer(fadeCamera, 2000, 1, true, 1.0 ) triggerServerEvent("carCol",root, pVehicleSG) setTimer(setElementFrozen,1300,1,pVehicleSG,false) setTimer(setElementPosition,2000, 1, pVehicleSG, 2611, 1431, 11) setTimer(destroyElement,1000000,1,nyan) end end else outputChatBox("Too much magic for you pal.", 255, 0, 0) end end end addEventHandler("onClientMarkerHit", root, WTFEnt) _____________________________________________________ Server addEvent("carCol",true) addEventHandler("carCol",root, function(pVehicleSG) setTimer(setVehicleColor, 1000, 1000, pVehicleSG, math.random(0,255), math.random(0,255), math.random(0,255)) setTimer(setPlayerNametagColor, 1000, 1000, getVehicleController(pVehicleSG), math.random(0,255), math.random(0,255), math.random(0,255)) end )
  18. WolfPire

    CLEO

    Obviusly with the MTA existing functions. However it is a bit hard to code cleo3 into LUA as it's not a direct translation, it's based in knowledge.
  19. WolfPire

    CLEO

    Actually i DID convert a Cleo3 mod to LUA =P It's called "Night Sky" , a conversion to the mod "Star Sky" xP It's only on my server, it IS posible. If you know how to read the codes and translate them yourself to LUA.
  20. Works like a charm. Thanks!
  21. When i step down of the bike i get this error flooding my debug: "WARNING: VehicleInfo/VI.lua:40: Bad argument @ 'guiSetText' [Expected gui-element at argument 1]"
  22. Well... I'm making a Vehicle Info script which consists in getting the vehicle HP and other stuff and render it in a guiLabel. Weirdly it's trolling me with the HP rendering. Take a look at it please s: i'm getting dizzy~ Client local screenW,screenH=guiGetScreenSize() function values() vehicle = getPedOccupiedVehicle ( localPlayer ) if vehicle then HP = getElementHealth (vehicle) vehname = getVehicleName ( vehicle ) vehID = getElementModel ( vehicle ) end end addEventHandler("onClientRender",root,values) function drawGUI() if vehicle then HPG = guiCreateLabel(0,0,1247.0,328.0,"Health: ", false) NG = guiCreateLabel(0,0,1247.0,303.0,"Vehicle: ".. vehname .." (ID: " .. vehID .. " ) ", false) G = guiCreateLabel(0,0,1247.0,303.0,"Vehicle Info", false) guiSetFont(G,"default-bold-small") guiSetFont(NG,"default-small") guiSetFont(HPG,"default-small") guiLabelSetColor(G,0,200,0) local windowW1,windowH1=guiGetSize(HPG,false) local x1,y1 = (screenW-windowW1)/2,(screenH-windowH1)/2 guiSetPosition(HPG,x1 + 1020,y1 + 40,false) local windowW2,windowH2=guiGetSize(NG,false) local x2,y2 = (screenW-windowW2)/2,(screenH-windowH2)/2 guiSetPosition(NG,x2 + 1020,y2 + 40,false) local windowW3,windowH3=guiGetSize(G,false) local x3,y3 = (screenW-windowW3)/2,(screenH-windowH3)/2 guiSetPosition(G,x3 + 1000,y3 + 10,false) addEventHandler("onClientRender",root,renderHP) end end addEventHandler("onClientPlayerVehicleEnter", root, drawGUI) function renderHP() if HPG then guiSetText(HPG,"Health: ".. math.floor(HP) .."") else removeEventHandler("onClientRender",root,renderHP) end end function doText(command, ...) if command == "showvi" then guiSetVisibility(HPG,true) guiSetVisibility(NG,true) guiSetVisibility(G,true) elseif command == "hidevi" then guiSetVisibility(HPG,false) guiSetVisibility(NG,false) guiSetVisibility(G,false) end end addCommandHandler("showvi", doText) addCommandHandler("hidevi", doText) function deleteGUI() if HPG then destroyElement(HPG) destroyElement(NG) destroyElement(G) end end addEventHandler("onClientVehicleExit",root,deleteGUI)
  23. I not understand. I want the sams to stop shoting if there is no vehicle nearby. E.G: I came in a hydra and it dissapeared after i got off and exploded. Missiles are still spawning.
×
×
  • Create New...