Jump to content

Citizen

Moderators
  • Posts

    1,803
  • Joined

  • Last visited

  • Days Won

    8

Everything posted by Citizen

  1. No you loose And it's not a joke: triggerClientEvent(player, "selectSkill", skillsID) The selectSkill function in client-side get only the skillsID. And when you are in the good client, then use getLocalPlayer()
  2. Ok, I found two errors: 1- The function is function getSkillFunc(player,Levelids) so why you made getSkillFunc(1,source) it's getSkillFunc(source,1) 2-Why your 'tonumber's are empty ? function getSkillFunc(player,Levelids) if ( Levelids ) then local skillsID = tonumber( Levelids ) triggerClientEvent(source, "selectSkill", source,skillsID) return true else return false end end And like Solidsnake, I don't understand what do you want to do exactly
  3. Maybe you forgot to load you script in the meta.xml ? And why a colCircle ? because if a plane flies over the circle, it will activate the gate so I you advice to use createColSphere
  4. Citizen

    mysql query

    If you want to set 'AUTO_INCREMENT' on a column, you have to set this column as a primary key: mysql_query(handler, "CREATE TABLE tc_exemple (id INT NOT NULL AUTO_INCREMENT ,PRIMARY KEY ( id ))" ) If it don't work, maybe the handler is wrong or you don't have the sufficient rights to create the table.
  5. a jel se more disableovat chatbox What ? it's an english forum ! You can hide the MTA chatbox with this function: showChat The you can create another one like you want. Also, you can get the information of a player's chatbox ( like the size, the color, ... ) with this function: getChatboxLayout
  6. @diegofkda: This is a double post, click on the EDIT buton ( you just added the link )
  7. Because the source of this event is the marker hited so rename your variable for exemple: ( EDIT: it's onMarkerHit for the server-side ! ) amarker = createMarker ( -1992.8759765625, 287.905334, 33, "cylinder", 1.5, 255, 0, 0, 0 ) function MarkerHit ( thePlayer ) setCameraMatrix(thePlayer, -2018, 159, 95, -1981, 229, 170, 0, 0) end addEventHandler ( "onMarkerHit", amarker, MarkerHit ) If is in client side, you don't need the player: amarker = createMarker ( -1992.8759765625, 287.905334, 33, "cylinder", 1.5, 255, 0, 0, 0 ) function MarkerHit ( ) setCameraMatrix( -2018, 159, 95, -1981, 229, 170, 0, 0) end addEventHandler ( "onClientMarkerHit", amarker, MarkerHit )
  8. No you can make like that You have to create a folder "YourResourceName" ( don't use any spaces in your resource name ! ) Then put in it your test.lua and your meta.xml And replace this:
  9. Sorry my bad retry with this: function respawnTheVehicle( ) setTimer(respawnVehicle, 5000, 1, source ) end addEventHandler ( "onVehicleExplode", getRootElement(), respawnTheVehicle)
  10. Yeah but here is the Proracer's script so he can't have the same
  11. Citizen

    GPS system

    I fix it ( by some tests ), at the begining this function is for the ped rotation ( it's not the same as the object rotation ): function findRotation(x1,y1,x2,y2) local X = math.abs( x2 - x1 ) local Y = math.abs( y2 - y1 ) Rotm = math.deg( math.atan2( Y , X ) ) if ( x2 >= x1 ) and ( y2 > y1 ) then -- north-east Rotm = 90 - Rotm elseif ( x2 <= x1 ) and ( y2 > y1 ) then -- north-west Rotm = 270 + Rotm elseif ( x2 >= x1 ) and ( y2 <= y1 ) then -- south-east Rotm = 90 + Rotm elseif ( x2 < x1 ) and ( y2 <= y1 ) then -- south-west Rotm = 270 - Rotm end return (630-Rotm) end local x, y, z = 0, 0, 0 function showArrow(player, seat, jacked) if ( player == getLocalPlayer() ) then local px, py, pz = getElementPosition(player) arrow = createObject(1318, px, py, pz) setElementCollisionsEnabled(arrow, false) addEventHandler("onClientPreRender", getRootElement(), rotArrow) end end addEventHandler("onClientVehicleEnter", getRootElement(), showArrow) function rotArrow() local vehicle = getPedOccupiedVehicle(getLocalPlayer()) local px, py, pz = getElementPosition(vehicle) local rotX, rotY, rotZ = getElementRotation(vehicle) local rot = findRotation(px, py, x, y) setElementPosition(arrow, px, py, pz+2) setElementRotation(arrow, 0, 90, rot) end And it works !
  12. Lol this part of the forum is not for sharing scripts !! Steal scripts in this part of the forum is forbidden !
  13. Try this: function respawnTheVehicle( ) setTimer(respawnVehicle, 5000, 1, source ) end addEventHandler ( "onVehicleExplode", getRootElement(), respawnVehicles )
  14. Citizen

    Money Trasfer

    At the moment I can see just one error here: if not getMoney == "" then local getMoney = guiGetText(GUIEditor_Edit[3]) you use the getMoney variable before their declaration; so: local getMoney = guiGetText(GUIEditor_Edit[3]) if not getMoney == "" then local selectedPlayer = guiGridListGetItemText(GUIEditor_Grid[3], guiGridListGetSelectedItem(GUIEditor_Grid[3]), 1) triggerServerEvent("onMoneyTrasfer", getLocalPlayer(), getLocalPlayer(), getPlayerFromName(selectedPlayer), getMoney) else outputChatBox( "#ccf7fcYou must insert an import!", getLocalPlayer(), 255,255,255,true) end And here make some tonumber ( just for security ^^ ): addEvent("onMoneyTrasfer", true) function gotPlayerFromName(theSender, theReiciver, theMoney) local getSenderCash = tonumber( getElementData(theSender, "Money") ) local getReiciverCash = tonumber( getElementData(theReiciver, "Money") ) theMoney = tonumber( theMoney ) if ( theMoney <= getSenderCash ) then setElementData(theSender, "Money", getSenderMoney - theMoney) setElementData(theReiciver, "Money", getReiciverCash + theMoney) outputChatBox( "#ccf7fcMoney Trasfer: #ffffff"..getPlayerName(theSender).." #9ACD32gave you #43CD80$"..tonumber(money).."#9ACD32!", theSender, 255,255,255,true) else outputChatBox( "#ccf7fcShop: #9ACD32You have not enough money!", theSender, 255,255,255,true) end end addEventHandler("onMoneyTrasfer", getRootElement(), gotPlayerFromName)
  15. Hahahaha, I forgot again this: return playerName2 instead of return playerName
  16. Citizen

    GPS system

    function findRotation(x1,y1,x2,y2) local X = math.abs( x2 - x1 ) local Y = math.abs( y2 - y1 ) Rotm = math.deg( math.atan2( Y , X ) ) if ( x2 >= x1 ) and ( y2 > y1 ) then -- north-east Rotm = 90 - Rotm elseif ( x2 <= x1 ) and ( y2 > y1 ) then -- north-west Rotm = 270 + Rotm elseif ( x2 >= x1 ) and ( y2 <= y1 ) then -- south-east Rotm = 90 + Rotm elseif ( x2 < x1 ) and ( y2 <= y1 ) then -- south-west Rotm = 270 - Rotm end return (360-Rotm) end Not tested ( it's an adaptation for your script )
  17. And this is your book ^^: https://wiki.multitheftauto.com/wiki/Main_Page
  18. Hi, SetVehicleRespawnDelay
  19. yeah sorry, I just see that in my mind: "#ff00ffAcitanoX" so it can find Acitanox whithout the gsub ^^ The new code: function getPlayer(thePlayerName) for id, player in ipairs(getElementsByType("player")) do local playerName = getPlayerName(player) local playerName2 = playerName:gsub("#%x%x%x%x%x%x", "") if ( string.find( tostring( thePlayerName ), tostring( playerName2 ) ) then return playerName else return false end end end It's almost the same as the SolidSnake code, I just added a missed end
  20. Ok I understood your function and I modify it like if I have to make this function myself ( almost the same ): Your function fixed: function getPlayer(thePlayerName) for id, player in ipairs(getElementsByType("player")) do local playerName = getPlayerName(player) --local playerName2 = playerName:gsub("#%x%x%x%x%x%x", "") -- not needed if ( string.find( tostring( thePlayerName ), tostring( playerName ) ) then return playerName else return false end end end My function ( optimized ): function getPlayer(thePlayerName) for id, player in ipairs(getElementsByType("player")) do if ( string.find( tostring( thePlayerName ), tostring( getPlayerName(player) ) ) then return getPlayerName(player) else return false end end end
  21. And you said that the 0.4 works ?
  22. Don't say sorry, I will not kill you for that ^^
  23. Ok like you want dude so I can't help you more except that:
  24. Praracer are you sure ? : addEventHandler ( 'br', fixPlayerVeh ) It's better like that no ? addCommandHandler( 'br', fixPlayerVeh )
×
×
  • Create New...