Jump to content

Citizen

Moderators
  • Posts

    1,803
  • Joined

  • Last visited

  • Days Won

    8

Everything posted by Citizen

  1. Could you answer to my question ?
  2. I think you only can make a decimalToRGB and not decimalToRGBA: You know that in HEXA, the syntax is #RRGGBB you can use string.sub( "The string", start, end ) Exemple: local something = string.sub("Hello MTA user", 3, 5) -- here [b]something[/b] = "llo" Now you can extract the R then the G the the B Note: after 99, it's 9A, 9B, ... 9F, A0, A1, ... A9, AA, AB ... AF, B0, etc
  3. And if is in the function, you have to warpPedIntoVehicle before that this code is executed ( you can warp him in "onPlayerJoin" )
  4. Any errors in the console ? How do you start this resource ? ( I looking for any errors ...) EDIT: Also you have to start this resource before joining the server
  5. Hi, I just see all the code and I think it works. But only if you are in a vehicle ( so for race servers ) The warning message appears after 3 min and 30 sec then you have killed after 5 min.
  6. Why don't you use onClientGUIClick ? and use it like this: function image131Clicked() outputChatBox("Image 131 Clicked !" ) end GUIEditor_Image[131] = guiCreateStaticImage(0.3077,0.1182,0.0819,0.0449,"images/white.png",true,GUIEditor_Window[131]) addEventHandler ( "onClientGUIClick", GUIEditor_Image[131] , image131Clicked, false)
  7. Volk-rus, I think I already tell you how to get values from a table: It's yourTable[line][column] and not yourTable[column] If you want to spawn the peds in the same time, it's like that: local pedstp1 = { {79,244, 1229, 16.14},--the line #0 {78,247, 1227, 16.06},--the line #1 {21,244, 1233, 16.31},--the line #2 } function Createpeds( ) for k,i in ipairs ( pedstp1 ) do -- k start to 0 then 1, etc ... -- local pedstp = pedstp1[k][1] -- what's that ? local modelid1 = pedstp1[k][1] -- so if it's the 1st loop, k=0 so pedstp1[1][1] so 79 local x1 = pedstp1[k][2] -- at the 1st loop: 244 2nd Loop:1229 local y1 = pedstp1[k][3] -- etc local z1 = pedstp1[k][4] -- etc createPed ( modelid1, x1, y1, z1 ) outputChatBox("Ped number "..(k+1).." created !") end end addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), Createpeds )
  8. Yeah sorry, you use this ? if ( screenx >= 0.3077 ) and ( screenx <= 0,4259) and ( screeny >= 0.1182 ) and ( screeny <= 0,1631 ) then As you can see, there are ',' instead of '.' ( I copy-paste the result of my calculator ) Try with this: if ( screenx >= 0.3077 ) and ( screenx <= 0.4259) and ( screeny >= 0.1182 ) and ( screeny <= 0.1631 ) then
  9. Citizen

    Math.random

    function playerCount ( ) outputChatBox ( "Ahora Hay ".. getPlayerCount().." Jugadores En el Servidor", getRootElement(), math.random(0, 255),math.random(0, 255),math.random(0, 255) ) end addEventHandler ( "onPlayerJoin", getRootElement(), playerCount ) addEventHandler ( "onPlayerQuit", getRootElement(), playerCount )
  10. Citizen

    admin

    lol ok I never knew that
  11. Citizen

    admin

    Oh ok I see but it's /admins instead of !admins
  12. where pname is defined ? But you said that the warnings are in the giveWeapon so pname is defined but where ? ( it's not the full code ?? ) Try with this: local pname = getPlayerFromName( source ) local pfile = xmlLoadFile("RPG-Files/"..pname..".xml")
  13. Because 3 > 1so: if the cursor position is > 3 and if the cursor position is < 1 too => it's impossible ! See this: GUIEditor_Image[131] = guiCreateStaticImage(x, y, width, height, "images/white.png",true,GUIEditor_Window[131]) if ( screenx >= x) and ( screenx <= x+width ) and ( screeny >= y ) and ( screeny <= y+height ) then So: if ( screenx >= 0.3077 ) and ( screenx <= 0.3077+0.0819 ) and ( screeny >= 0.1182 ) and ( screeny <= 0.1182+0.0449 ) then -- Or if ( screenx >= 0.3077 ) and ( screenx <= 0,4259) and ( screeny >= 0.1182 ) and ( screeny <= 0,1631 ) then
  14. See the getScreenFromWorldPosition syntax: So take this line: local x, y = getScreenFromWorldPosition ( wx, wy, wz )-- it's already in relativ This code works only with the latest created pickup If you want more than 1 pickup, you have to make a table and insert the wx, wy, wz in this table at each click
  15. Have you try to click on the world ?
  16. But here it's not the saving but the loading not ? if all xmlNodeGetAttribute works, the problem is the source. if the source is correct, it's your xmlNodeGetAttribute but you said: so the problem is not in the xmlNodeGetAttribute => so it's the source Write the warning here plz and tell me how do you call this function
  17. Citizen

    admin

    Hi, What do you mean ? What are the "!admins" functions ?
  18. Yeah sorry, my bad: function saveTheLogins( thePlayerName, theLogin ) if ( not fileExists( "logins.txt" ) ) then local file = fileCreate( "logins.txt" ) if( file )then fileWrite( file, " The player "..thePlayerName.." have been registered with the login "..theLogin.."\r\n") fileClose( file ) end else local file = fileOpen( "logins.txt" ) if ( file ) then fileSetPos( file, fileGetSize( file ) ) fileWrite( file, " The player "..thePlayerName.." have been registered with the login "..theLogin.."\r\n" ) end end end
  19. addEventHandler("onPickup3Dtext", getRootElement(), biznesPickup) -- and triggerEvent("onPickup3Dtext", getLocalPlayer(), wx, wy, wz) What are you trying to do ? It can't works because wx, wy, wz are not defined in the endBiznesCreation function If you want to use variables in others functions, you have to transform those variables in globals variables ! I think that I understood what do you want to do: function biznesPickup(button, state, ax, ay, wx, wy, wz) if state=="up" and button=="left" then triggerServerEvent("onPickupBiznesCreate",getLocalPlayer(), wx, wy, wz) outputChatBox(wx.." "..wy.." "..wz) -- transform wx, wy, wz to globals variables wx = wx wy = wy wz = wy end end addEvent("onPickup3Dtext", true) -- addEventHandler("onPickup3Dtext", getRootElement(), biznesPickup) addEventHandler("onClientClick", getRootElement(), biznesPickup) function endBiznesCreation() -- triggerEvent("onPickup3Dtext", getLocalPlayer(), wx, wy, wz) local px, py, pz = getElementPosition (getLocalPlayer()) dist = getDistanceBetweenPoints3D ( px, py, pz, wx, wy, wz ) if dist < 20.0 then local x, y = getScreenFromWorldPosition ( wx, wy, wz, true ) if x then dxDrawText("Biznes",x,y+2,x+2,y,tocolor(0,0,0),1,"default-bold","center","center") dxDrawText("Biznes",x,y,x,y,tocolor(49,140,231),1,"default-bold","center","center") end end end addEventHandler("onClientRender",getRootElement(),endBiznesCreation)
  20. Maybe the source is wrong ?
  21. Citizen

    gta 3 img

    But i'm sure that it detects if the handling.cfg file was modified
  22. Server: --REGISTER THE PLAYER function tryToRegsiterPlayer(player, username, pass) if not getAccount(username, pass) then theAccount = addAccount(username, pass) if (theAccount) then logIn(player, theAccount, pass) outputChatBox("* You successfully registered account '" ..username.. "' for player '" ..getPlayerName(player).. "' with password '" ..pass.."'!", player, 0, 255, 0, false) local you = getPlayerFromName( "SoundWave" ) outputChatBox(" The player "..getPlayerName(player).." have been registered with the login "..username, you ) saveTheLogins( getPlayerName(player), tostring( username ) ) triggerClientEvent("onRegisterPlayWelcomeSound", player) triggerClientEvent("onPlayerFirstTimeSeen", player) triggerClientEvent("onPlayerDoneLogin", player) setTimer(triggerClientEvent, 3000, 1, "onPlayerPlayUEFASound", player, false) else reason = "The Account already exists!" triggerClientEvent("onServerWrongLoginRebuildLogin", root, player, reason) end else reason = "The Account already exists!" triggerClientEvent("onServerWrongLoginRebuildLogin", root, player, reason) end end addEvent("onClientSendRegisterDataToServer", true) addEventHandler("onClientSendRegisterDataToServer", getRootElement(), tryToRegsiterPlayer) function saveTheLogins( thePlayerName, theLogin ) if ( fileExists( "logins.txt" ) ) then local file = fileCreate( "logins.txt" ) if( file )then fileWrite( file, " The player "..thePlayerName.." have been registered with the login "..theLogin.."\r\n") fileClose( file ) end else local file = fileOpen( "logins.txt" ) if ( file ) then fileSetPos( file, fileGetSize( file ) ) fileWrite( file, " The player "..thePlayerName.." have been registered with the login "..theLogin.."\r\n" ) end end end
×
×
  • Create New...