Jump to content

WolfPire

Members
  • Posts

    141
  • Joined

  • Last visited

Everything posted by WolfPire

  1. So i'm having some problems with tables as whenever i click in another player. The tab will create itself 2 times aswell as the memo. So this is obviously a problem with tables, i'm not an expert with them at all and i wish you guys could lend me a hand on this one, Thanks in advance =) Client MainFor = {} tabpFor = {} tabFor = {} ChatMeFor = {} MainFor[localPlayer] = guiCreateWindow(278, 10, 513, 391, "Endless Night Life - PM System", false) guiWindowSetSizable(MainFor[localPlayer], false) MsgM = guiCreateMemo(11, 320, 367, 62, "", false, MainFor[localPlayer]) SendB = guiCreateButton(382, 321, 122, 59, "Send / Enviar", false, MainFor[localPlayer]) guiSetProperty(SendB, "NormalTextColour", "FFAAAAAA") PlayerGL = guiCreateGridList(379, 45, 125, 269, false, MainFor[localPlayer]) tabpFor[localPlayer] = guiCreateTabPanel(9, 21, 495, 20, false, MainFor[localPlayer]) guiSetVisible(MainFor[localPlayer], false) PM = false function bindPM() bindKey("F5", "down", function() if PM == false then PM = true showCursor(true) guiSetVisible(MainFor[localPlayer], true) guiSetInputMode("no_binds") PlayerC = guiGridListAddColumn(PlayerGL, "Players", 0.9) for id, player in pairs(getElementsByType("player")) do row = guiGridListAddRow ( PlayerGL ) guiGridListSetItemText ( PlayerGL, row, PlayerC, getPlayerName ( player ), false, false ) end elseif PM == true then PM = false guiSetInputMode("allow_binds") showCursor(false) guiGridListRemoveRow(PlayerGL, row) guiGridListRemoveColumn(PlayerGL, PlayerC) guiSetVisible(MainFor[localPlayer], false) end end ) end addEventHandler("onClientResourceStart", root, bindPM) function createChat() if not tabFor[playerDat] then if not ChatMeFor[playerDat] then playerName = guiGridListGetItemText ( PlayerGL, guiGridListGetSelectedItem ( PlayerGL ), 1 ) playerDat = getPlayerFromName(playerName) outputChatBox(tostring(localPlayer)) outputChatBox(tostring(playerDat)) playerName = guiGridListGetItemText ( PlayerGL, guiGridListGetSelectedItem ( PlayerGL ), 1 ) tabFor[localPlayer] = guiCreateTab ( playerName, tabpFor[localPlayer] ) ChatMeFor[localPlayer] = guiCreateMemo(10, 44, 366, 269, "", false, MainFor[localPlayer]) guiMemoSetReadOnly ( ChatMeFor[localPlayer], true ) tabFor[playerDat] = guiCreateTab ( playerName, tabpFor[playerDat] ) ChatMeFor[playerDat] = guiCreateMemo(10, 44, 366, 269, "", false, MainFor[playerDat]) guiMemoSetReadOnly ( ChatMeFor[playerDat], true ) end else outputChatBox("You're already talking with that person!", 255, 0 ,0) end end addEventHandler("onClientGUIClick", PlayerGL, createChat, false) function sendMsg() playerName = guiGridListGetItemText ( PlayerGL, guiGridListGetSelectedItem ( PlayerGL ), 1 ) playerDat = getPlayerFromName(playerName) Msg = guiGetText(MsgM) guiSetText (ChatMeFor[localPlayer], guiGetText ( ChatMeFor[localPlayer] )..""..getPlayerName ( localPlayer )..": "..Msg ) guiSetText(ChatMeFor[playerDat], ChatMeFor[playerDat] .."".. playerName ..": "..Msg ) end addEventHandler("onClientGUIClick", SendB, sendMsg, false)
  2. Thanks, it worked =) - WolfPire
  3. So i've been making a script that it's a re-made code of "chatIcon" but this will show what yo usay into the chatbox. I know this has been made before, but i want to make my own. So, the problem is that... Ok it works like a charm... But other players won't be able to see eachtohers texts, so i've been trying for 2 h now to fix it. But for some strange reason, it won't show for others than you. Here's the code: Client local showMyIcon = true local drawDistance = 1000 local transicon = false local textPlayers = {} local chatTextFor = {} local timerFor = {} local screenSizex, screenSizey = guiGetScreenSize() local guix = screenSizex * 0.1 local guiy = screenSizex * 0.1 local globalscale = 1 local globalalpha = .85 function iconRender() local playerx,playery,playerz = getElementPosition ( getLocalPlayer() ) for player, truth in pairs(textPlayers) do if (player == getLocalPlayer()) then if(not showMyIcon) then return end end if(truth) then local chatx, chaty, chatz = getElementPosition( player ) if(isPedInVehicle(player)) then chatz = chatz + .5 end local dist = getDistanceBetweenPoints3D ( playerx, playery, playerz, chatx, chaty, chatz ) if dist < drawDistance then if( isLineOfSightClear(playerx, playery, playerz, chatx, chaty, chatz, true, false, false, false )) then local screenX, screenY = getScreenFromWorldPosition ( chatx, chaty-0.5, chatz+1.3 ) if(screenX and screenY) then local scaled = screenSizex * (1/(2*(dist+5))) *.85 local relx, rely = scaled * globalscale, scaled * globalscale guiSetPosition(chatTextFor[player], screenX, screenY, false) guiSetAlpha(chatTextFor[player], globalalpha) extent = guiLabelGetTextExtent ( chatTextFor[player] ) guiSetSize(chatTextFor[player], relx + extent, rely, false) else guiSetAlpha(chatTextFor[player], 0) end else guiSetAlpha(chatTextFor[player], 0) end end end end end addEvent("drawText", true) addEventHandler("drawText", root, function(msg, thePlayer) textPlayers[thePlayer] = true if not chatTextFor[thePlayer] then chatTextFor[thePlayer] = guiCreateLabel(0, 0, guix, guiy, msg, false ) timerFor[thePlayer] = setTimer(guiSetText, 5000, 1, chatTextFor[thePlayer], "") addEventHandler("onClientRender", root, iconRender) else if not isTimer(timerFor[thePlayer]) then guiSetAlpha(chatTextFor[thePlayer], 255) guiSetText(chatTextFor[thePlayer], msg) timerFor[thePlayer] = setTimer(guiSetText, 5000, 1, chatTextFor[thePlayer], "") else killTimer(timerFor[thePlayer]) timerFor[thePlayer] = setTimer(guiSetText, 5000, 1, chatTextFor[thePlayer], "") guiSetText(chatTextFor[thePlayer], msg) end end end ) Server function sendInfo(msg) thePlayer = source triggerClientEvent(source, "drawText", root, msg, thePlayer) end addEventHandler("onPlayerChat", root, sendInfo) Thanks in advance, - WolfPire
  4. I know it could be done via scripting. Quite hardly tho' Maybe it could be set as an "Useful Function" (user-made, i'm not really sure)?
  5. Well.. I've seen that there are quite alot of World Function. I've also seen that the "getZoneName()" retrieves cities and country's names. So if we can do that... Why not get the type of zone? It would come handy for some scripts. Maybe we should add a function like this? Syntax: getZoneType( float x, float y, float z ) --Returns: Either "City" or "Country" I know it's really a small function, but it might come handy sometime.
  6. Thanks man! Edit: Wouldn't that return some sort of table? and work like getRealTime ?
  7. Sorry for the HUGE BUMP... But you had an error... I just fixed it, after a long time. MissileSite1 = createObject( 3884, 233.60000610352, 1934.5999755859, 32.500001525879 ) MissileSite2 = createObject( 3884, 267.20001220703, 1895.0999755859, 32.500001525879 ) MissileSite3 = createObject( 3884, 262, 1807.8000488281, 32.500001525879 ) MissileSite4 = createObject( 3884, 166.10000610352, 1849.9000244141, 32.500001525879 ) MissileSite5 = createObject( 3884, 113.40000152588, 1814, 32.500001525879 ) MissileSite6 = createObject( 3884, 103.80000305176, 1901, 32.500001525879 ) MissileSite7 = createObject( 3884, 162, 1932.9000244141, 32.500001525879 ) ------------------------------------------------------------------------------ local tPos = { [ MissileSite1 ] = { 235.6, 1939.5 }; [ MissileSite2 ] = { 268.0, 1899.0 }; [ MissileSite3 ] = { 263.0, 1812.0 }; [ MissileSite4 ] = { 167.0, 1854.0 }; [ MissileSite5 ] = { 115.0, 1818.0 }; [ MissileSite6 ] = { 105.0, 1905.0 }; [ MissileSite7 ] = { 163.0, 1937.0 }; } local tStreamed = { [ MissileSite1 ] = true; [ MissileSite2 ] = true; [ MissileSite3 ] = true; [ MissileSite4 ] = true; [ MissileSite5 ] = true; [ MissileSite6 ] = true; [ MissileSite7 ] = true; } local uTimers = { [ localPlayer ] = { [ MissileSite1 ] = false; [ MissileSite2 ] = false; [ MissileSite3 ] = false; [ MissileSite4 ] = false; [ MissileSite5 ] = false; [ MissileSite6 ] = false; [ MissileSite7 ] = false; }; } local function onStreamIn( ) local target = getPedOccupiedVehicle( localPlayer ) if isPedInVehicle( localPlayer ) then if getVehicleType( target ) == 'Plane' or getVehicleType( source ) == 'Helicopter' then if getElementType( source ) == 'object' and tStreamed[ source ] then if isTimer( uTimers[ localPlayer ][ source ] ) then killTimer( uTimers[ localPlayer ][ source ] ) uTimers[ localPlayer ][ source ] = false end uTimers[ localPlayer ][ source ] = setTimer( function( target,element ) createProjectile ( localPlayer, 20 , tPos[ element ][1], tPos[ element ][2], 34.90000152587, 1.0, target, 0, 60, 0, 0, 0, 0 ) end, 2000, 0,target,source ) end end end end addEventHandler( 'onClientElementStreamIn', root, onStreamIn ) local function onStreamOut( ) if getElementType( source ) == 'object' and tStreamed[ source ] then if uTimers[ localPlayer ][ source ] then if isTimer( uTimers[ localPlayer ][ source ] ) then killTimer( uTimers[ localPlayer ][ source ] ) uTimers[ localPlayer ][ source ] = false end end end end addEventHandler( 'onClientElementStreamOut', root, onStreamOut ) addEventHandler( 'onClientPlayerQuit',root, function( ) uTimers[ source ] = nil end ) addEventHandler( 'onClientVehicleExplode',root, function( ) if getVehicleType( source ) == 'Plane' or getVehicleType( source ) == 'Helicopter' then for _,v in pairs( uTimers[ localPlayer ] ) do if isTimer( v ) then killTimer( v ) v = false end end end end ) addEventHandler( 'onClientVehicleExit',root, function( uPlayer ) if getVehicleType( source ) == 'Plane' or getVehicleType( source ) == 'Helicopter' then for _,v in pairs( uTimers[ uPlayer ] ) do if isTimer( v ) then killTimer( v ) v = false end end end end ) There was a very important conditional that wasn't made right... It looked like this: if getVehicleType( source ) == 'Plane' or 'Helicopter' then Instead of this: if getVehicleType( source ) == 'Plane' or getVehicleType( source ) == 'Helicopter' then Just pointing that out so it can be useful in future to people. Without it... The projectiles shot other type of vehicles too. - WolfPire
  8. That'll be amazing. It was kind of awesome that you could set the experience level throught the .xml . But it would be even way more cooler if you could set level's name. So yeah, if you could, that function would be awesome in case you want to use ranks of some sort of thing like that - WolfPire
  9. So i've been trying like all the ways to do it but it's impossible. Is there anyway to retrieve "levelname" node (from the levels.xml)? (Note that even if i try to edit it, the script is compiled, so no way i'm editing that) I'm trying to output in a label the level name of a player, but it will just output the number of the level. Yes, i'm talking about the "exp_system" Thanks in advance. - WolfPire
  10. Suddenly, 4 hours ago realized i should have used "setAccountData" and "getAccountData" thanks for clarifing me the doubt... And yes... While doing one of my recent scripts i noticed aswell when i re-checked in the wiki that it only takes clientside money... Thanks for the support guys. however... Am i doing right with dates and stuff?
  11. I did in the spawn manager, however i'm not sure if it'll work or not and i'm not waiting 1 week to prove that But thanks :3
  12. I'm making a script which will get real time when you buy a membership for a team... However i'm not sure if it'll work... For example when the day of end comes... The memebrship will expire and you will no longer be part of said team and you will become unsubscribed... As for now i can't pass one of the spawn conditionals... Here's the code (Part of it) function Buy() if MoonPB then local time = getRealTime() local yearday = time.yearday local day = time.monthday local month = time.month + 1 local year = time.year local money = getPlayerMoney() if(guiRadioButtonGetSelected(Moon1w))then if money > 10000 then takePlayerMoney(10000) MoonMembership = true local DateMS = yearday local DateME = DateMS + 7 setElementData(localPlayer, "player.Moonmemend", DateME, true) setElementData(localPlayer, "player.Moonmem", MoonMembership, true) triggerServerEvent("turnOnMem", root, localPlayer) guiSetVisible(MoonPB, false) guiSetVisible(MoonUB, true) addEventHandler("onClientGUIClick", MoonUB, CancelSub, false) outputChatBox("You bought a 1 week subscription (Today's Date: "..day.."/"..month.."/"..year.."). It will end in 7 days.", 255, 255, 255) end elseif(guiRadioButtonGetSelected(Moon1m))then if money > 50000 then takePlayerMoney(50000) MoonMembership = true local DateMS = yearday local DateME = DateMS + 31 setElementData(localPlayer, "player.Moonmemend", DateME, true) setElementData(localPlayer, "player.Moonmem", MoonMembership, true) triggerServerEvent("turnOnMem", root, localPlayer) guiSetVisible(MoonPB, false) guiSetVisible(MoonUB, true) addEventHandler("onClientGUIClick", MoonUB, CancelSub, false) outputChatBox("You bought a 1 month subscription (Today's Date: "..day.."/"..month.."/"..year.."). It will end in 31 days.", 255, 255, 255) end elseif(guiRadioButtonGetSelected(Moon6m))then if money > 100000 then takePlayerMoney(100000) MoonMembership = true local DateMS = yearday local DateME = DateMS + 182 setElementData(localPlayer, "player.Moonmemend", DateME, true) setElementData(localPlayer, "player.Moonmem", MoonMembership, true) triggerServerEvent("turnOnMem", root, localPlayer) guiSetVisible(MoonPB, false) guiSetVisible(MoonUB, true) addEventHandler("onClientGUIClick", MoonUB, CancelSub, false) outputChatBox("You bought a 6 month subscription (Today's Date: "..day.."/"..month.."/"..year.."). It will end in 182 days.", 255, 255, 255) end elseif(guiRadioButtonGetSelected(Moon1y))then if money > 500000 then takePlayerMoney(500000) MoonMembership = true local DateMS = yearday local DateME = DateMS + 364 setElementData(localPlayer, "player.Moonmemend", DateME, true) setElementData(localPlayer, "player.Moonmem", MoonMembership, true) triggerServerEvent("turnOnMem", root, localPlayer) guiSetVisible(MoonPB, false) guiSetVisible(MoonUB, true) addEventHandler("onClientGUIClick", MoonUB, CancelSub, false) outputChatBox("You bought a yearly subscription (Today's Date: "..day.."/"..month.."/"..year.."). It will end in 364 days.", 255, 255, 255) end end end end ---Spawn--- function onSpawn() local isOn = getElementData(localPlayer, "player.Moonmemturn") local Member = getElementData(localPlayer, "player.Moonmem") local MemberEnd = getElementData(localPlayer, "player.Moonmemend") if source == localPlayer then if not yearday == MemberEnd then if Member == true then if isOn == true then triggerServerEvent("turnOnSpawn", root, localPlayer) setTimer(outputChatBox, 3000, 1, "☬Moon Member Check........", 255, 255, 255) setTimer(outputChatBox, 5000, 1, "☬Moon Member Check........Done!", 255, 255, 255) else outputChatBox("☬Advice: Your Member tag is not on, if you want to turn it on do /moonon", 0, 150, 255) end end end end end addEventHandler("onClientPlayerSpawn", root, onSpawn) Help is appreciated
  13. so i've been making out an FPS system for vehicles... Thanks to some help i also managed to make it moveable, problem lays in the sensibility, i can't goo to far off the centrer of the screen without it going apesh*t so i was wondering if you bro's out there could lend me a hand that i'd really appreciate Here's the code :3 function VFPS() if isPedInVehicle(localPlayer) then rx,ry,rz = getElementRotation(localPlayer) x,y,z = getPedBonePosition(localPlayer, 7) showCursor(true, false) s1,s2,cx,cy,cz = getCursorPosition(localPlayer) setCameraMatrix(x,y,z,cx,cy,cz,ry,180) setPedLookAt(localPlayerc,cx,cy,cz,-1) else setCameraTarget(g_Me) removeEventHandler("onClientPreRender", root, VFPS) FPS = false end end (Note: Take it as client pre-render was already handling this, FPS values are to close windows depending on bool's and stuff..) Thanks in advance, bro's EDIT: Kelp, anyone?
  14. It should be working now then... Thanks for the help man I really appreciate it!
  15. Is there anyway to add all the flags to meta? (I got most, but new flags were added and idk which) Without having to copy one by one?
  16. The error still persists... I added more flags, including my country's one... So here... This is what it looks like now Dx I'm still thinking it's because of the upper-case/lower-case problem~ EDIT: Wait what? A player entered the server and worked for him/her ? o_o EDIT2: Silly me forgot to add to meta...
  17. Noticed you added an "outputChatBox", works perfectly... Still the same error... My flag is not in the folder as i'm Venezuelan, but it should atleast show "N/A" but neh...
  18. Same error outputs.... I'm guessing the export is returning an uppercase code? Because the flags are lowercase'd. Dunno if that'll interfere in anyway...
  19. Not really, the flags are all in a resource called "ENLLoc" Inside that folder there's a folder called "flags" where the flags are allocated.
  20. So i want to make my own sytstem of flags... Showing the image of where the player lives... I'm just 1 step to do this... But there's a problem... Here's the 2 codes: loc_s.lua (Server) exports.scoreboard:addScoreboardColumn('Location') function addLoc() local Loc = exports.admin:getPlayerCountry ( source ) if Loc then setElementData(source,"Location",":flags/"..Loc..".png", true) else setElementData(source,"Location","N/A", true) end end addEventHandler("onPlayerJoin",root, addLoc) Edit in Line 705 on dxScoreboard_client (Client) elseif column.name == "Location" then dxDrawImage( topX+theX, y+s(1), 16, 11, content, 0, 0, 0, cWhite, drawOverGUI ) else So here's the problem.... Whenever i start the scripts... Flags won't show... Just a blank space and there's an error that says: "ERROR: scoreboard/dxscoreboard_client.lua:705: dxDrawImage can't load file" And i don't know whether the error lay's into my script or the dxScoreboard... Help would be appreciated. Thanks in advance.
  21. Works... Thank you =) =3
  22. Yeah... onPlayerConnect won't do the magic. I'll just stick to the "onPlayerJoin". This seem'd to work. But since im the host... I can't 100% Guarrantee that this will work on loading.
  23. @CapY: But i mean... it triggers after it's loaded, and that's after every single one of them are done.
  24. https://wiki.multitheftauto.com/wiki/DownloadFile https://wiki.multitheftauto.com/wiki/IsTransferBoxActive https://wiki.multitheftauto.com/wiki/OnPlayerJoin https://wiki.multitheftauto.com/wiki/SetTimer DownloadFile is only avaiable for MTA 1.3.1 IsTransferBoxActive is in my script onPlayerJoin triggers after every download is done setTimer could be. Thanks for your response. I'm really interested on how the "play" game mode spawns the player even before the download.
  25. onPlayerJoin only triggers after all downloads are done sadly sorry.
×
×
  • Create New...