Jump to content

IIYAMA

Moderators
  • Posts

    6,097
  • Joined

  • Last visited

  • Days Won

    218

Everything posted by IIYAMA

  1. local mycode = "[ ..., code ]" addCommandHandler("send", function(player) triggerLatentClientEvent (player,"enviarClient",10000,player,mycode) end) addCommandHandler("cancel", function(player) local tableHandlers = getLatentEventHandles ( player ) if tableHandlers then local handler = tableHandlers[#tableHandlers] if handler then outputChatBox(tostring(getLatentEventStatus(player, handler)["percentComplete"])) cancelLatentEvent(player, handler ) end end end) Lets do it right. Will cancel the last latency event. But keep in mind that this event can also be from another resource. So I will recommend you to save those handlers inside a table. As example: local playerDataTable = {} addCommandHandler("send", function(player) triggerLatentClientEvent (player,"enviarClient",10000,player,mycode) local tableHandlers = getLatentEventHandles ( player ) if tableHandlers then local handler = tableHandlers[#tableHandlers] if handler then playerDataTable[player] = handler elseif playerDataTable[player] then playerDataTable[player] = nil end end end) addEventHandler("onPlayerQuit",root, -- clean up the memory. function() if playerDataTable[source] then playerDataTable[source] = nil end end)
  2. Client + cancelLatentEvent = no defining player I was thinking you were using it severside.
  3. cancelLatentEvent( player thePlayer, int handle ) check the syntax for serverside
  4. setPedAnimation(source,false)
  5. Projectiles must be added manually. createProjectile I tested it with version: 1.3.5 in the past. Maybe it will be added in the future.
  6. Good job bro, You got more balls then me, I would take those things with me in the grave like they never existed. Just to be sure my time wouldn't be used by unknown people who probably would rip/crush/break and dirty kiss it. (just my opinion) I am going to miss yeh in the DD server. It is a pity that you quite mta.
  7. By cancelling the damage. What is the damage type? and in combination with checking the tasks: https://wiki.multitheftauto.com/wiki/Li ... ayer_tasks
  8. Define the colshape. Line 6.
  9. IIYAMA

    save sys

    function onPlayerQuit ( ) -- when a player leaves, store his current money amount in his account data local playeraccount = getPlayerAccount ( source ) if ( playeraccount ) and not isGuestAccount ( playeraccount ) then -- if the player is logged in local playermoney = getPlayerMoney ( source ) -- get the player money local playerteam = getPlayerTeam ( source ) local playerskin = getPedSkin ( source ) local playerwanted = getPlayerWantedLevel ( source ) local playeroccupation = getElementData ( source, "occupation") local x,y,z = getElementPosition ( source ) setAccountData ( playeraccount, "cg.money", playermoney ) -- save it in his account if playerteam then setAccountData ( playeraccount, "cg.team", getTeamName(playerteam) ) end setAccountData ( playeraccount, "cg.skin", playerskin ) setAccountData ( playeraccount, "cg.wanted", playerwanted ) if playeroccupation then setAccountData ( playeraccount, "cg.occupation", tostring(playeroccupation)) end setAccountData ( playeraccount, "cg.location", x .. "," .. y .. "," .. z ) end end function onPlayerLogin (_, playeraccount ) -- when a player logins, retrieve his money amount from his account data and set it if ( playeraccount ) then local playermoney = tonumber(getAccountData ( playeraccount, "cg.money" )) local playerTeamName = getAccountData ( playeraccount, "cg.team" ) local playerskin = tonumber(getAccountData ( playeraccount, "cg.skin" )) local playerwanted = tonumber(getAccountData ( playeraccount, "cg.wanted" )) local playeroccupation = getAccountData ( playeraccount, "cg.occupation" ) local xyz = getAccountData ( playeraccount, "cg.location" ) if xyz then xyz = split(xyz, string.byte(",")) end -- make sure there was actually a value saved under this key (check if playermoney is not false). -- this will for example not be the case when a player plays the gametype for the first time if ( playermoney ) then setPlayerMoney ( source, playermoney ) outputChatBox ( playermoney, getRootElement()) end if ( playerTeamName ) then local playerteam = getTeamFromName(playerTeamName) if playerteam then setPlayerTeam ( source, playerteam ) --outputChatBox ( playerteam , getRootElement()) end end if ( playerskin ) then setElementModel ( source, playerskin ) --outputChatBox ( playerskin , getRootElement()) end if ( playerwanted ) then setPlayerWantedLevel ( source, playerwanted ) outputChatBox ( playerwanted , getRootElement()) end if ( playeroccupation ) then setElementData ( source, "occupation", tostring(playeroccupation)) --outputChatBox ( playeroccupation ,getRootElement()) end if xyz then spawnPlayer ( source, xyz[1], xyz[2], xyz[3] ) outputChatBox ( tostring(xyz[1]) .. tostring(xyz[2]) .. tostring(xyz[3]) ,getRootElement()) end end end addEventHandler ( "onPlayerQuit", getRootElement ( ), onPlayerQuit ) addEventHandler ( "onPlayerLogin", getRootElement ( ), onPlayerLogin ) ah, then I set it back.
  10. IIYAMA

    save sys

    local marker = getElementByID("lspdmarker") function onPlayerQuit ( ) -- when a player leaves, store his current money amount in his account data local playeraccount = getPlayerAccount ( source ) if ( playeraccount ) and not isGuestAccount ( playeraccount ) then -- if the player is logged in local playermoney = getPlayerMoney ( source ) -- get the player money local playerteam = getPlayerTeam ( source ) local playerskin = getPedSkin ( source ) local playerwanted = getPlayerWantedLevel ( source ) local playeroccupation = getElementData ( source, "occupation") local x,y,z = getElementPosition ( source ) setAccountData ( playeraccount, "cg.money", playermoney ) -- save it in his account if playerteam then setAccountData ( playeraccount, "cg.team", getTeamName(playerteam) ) end setAccountData ( playeraccount, "cg.skin", playerskin ) setAccountData ( playeraccount, "cg.wanted", playerwanted ) if playeroccupation then setAccountData ( playeraccount, "cg.occupation", tostring(playeroccupation)) end setAccountData ( playeraccount, "cg.location", x .. "," .. y .. "," .. z ) end end function onPlayerLogin (_, playeraccount ) -- when a player logins, retrieve his money amount from his account data and set it if ( playeraccount ) then local playermoney = tonumber(getAccountData ( playeraccount, "cg.money" )) local playerTeamName = getAccountData ( playeraccount, "cg.team" ) local playerskin = tonumber(getAccountData ( playeraccount, "cg.skin" )) local playerwanted = tonumber(getAccountData ( playeraccount, "cg.wanted" )) local playeroccupation = getAccountData ( playeraccount, "cg.occupation" ) local xyz = getAccountData ( playeraccount, "cg.location" ) if xyz then xyz = split(xyz, string.byte(",")) end -- make sure there was actually a value saved under this key (check if playermoney is not false). -- this will for example not be the case when a player plays the gametype for the first time if ( playermoney ) then setPlayerMoney ( source, playermoney ) outputChatBox ( playermoney, getRootElement()) end if ( playerTeamName ) then local playerteam = getTeamFromName(playerTeamName) if playerteam then setPlayerTeam ( source, playerteam ) --outputChatBox ( playerteam , getRootElement()) end end if ( playerskin ) then setElementModel ( source, playerskin ) --outputChatBox ( playerskin , getRootElement()) end if ( playerwanted ) then setPlayerWantedLevel ( source, playerwanted ) outputChatBox ( playerwanted , getRootElement()) end if ( playeroccupation ) then local vehicles = getElementsByType("vehicle") local vehicle for i=1,#vehicles do if tostring(vehicles[i]) == playeroccupation then vehicle = vehicles[i] break end end if vehicle then setElementData ( source, "occupation", vehicle) else setAccountData ( playeraccount, "cg.occupation",false) end --outputChatBox ( playeroccupation ,getRootElement()) end if xyz then spawnPlayer ( source, xyz[1], xyz[2], xyz[3] ) outputChatBox ( tostring(xyz[1]) .. tostring(xyz[2]) .. tostring(xyz[3]) ,getRootElement()) end end end addEventHandler ( "onPlayerQuit", getRootElement ( ), onPlayerQuit ) addEventHandler ( "onPlayerLogin", getRootElement ( ), onPlayerLogin ) Team fixed/ saved using it's name. The vehicle is saved using it's userdata. After refreshing the vehicles they will be gone. If you want to save vehicles, you must save everything of them. Position/rotation/mode/etc.
  11. IIYAMA

    save sys

    function onPlayerQuit ( ) -- when a player leaves, store his current money amount in his account data local playeraccount = getPlayerAccount ( source ) if ( playeraccount ) and not isGuestAccount ( playeraccount ) then -- if the player is logged in local playermoney = getPlayerMoney ( source ) -- get the player money local playerteam = getPlayerTeam ( source ) local playerskin = getPedSkin ( source ) local playerwanted = getPlayerWantedLevel ( source ) local playeroccupation = getElementData ( source, "occupation") local x,y,z = getElementPosition ( source ) setAccountData ( playeraccount, "cg.money", playermoney ) -- save it in his account if playerteam then setAccountData ( playeraccount, "cg.team", getTeamName(playerteam) ) end setAccountData ( playeraccount, "cg.skin", playerskin ) setAccountData ( playeraccount, "cg.wanted", playerwanted ) if playeroccupation then setAccountData ( playeraccount, "cg.occupation", tostring(playeroccupation)) end setAccountData ( playeraccount, "cg.location", x .. "," .. y .. "," .. z ) end end function onPlayerLogin (_, playeraccount ) -- when a player logins, retrieve his money amount from his account data and set it if ( playeraccount ) then local playermoney = tonumber(getAccountData ( playeraccount, "cg.money" )) local playerTeamName = getAccountData ( playeraccount, "cg.team" ) local playerskin = tonumber(getAccountData ( playeraccount, "cg.skin" )) local playerwanted = tonumber(getAccountData ( playeraccount, "cg.wanted" )) local playeroccupation = getAccountData ( playeraccount, "cg.occupation" ) local xyz = getAccountData ( playeraccount, "cg.location" ) if xyz then xyz = split(xyz, string.byte(",")) end -- make sure there was actually a value saved under this key (check if playermoney is not false). -- this will for example not be the case when a player plays the gametype for the first time if ( playermoney ) then setPlayerMoney ( source, playermoney ) outputChatBox ( playermoney, getRootElement()) end if ( playerTeamName ) then local playerteam = getTeamFromName(playerteam) if playerteam then setPlayerTeam ( source, playerteam ) --outputChatBox ( playerteam , getRootElement()) end end if ( playerskin ) then setElementModel ( source, playerskin ) --outputChatBox ( playerskin , getRootElement()) end if ( playerwanted ) then setPlayerWantedLevel ( source, playerwanted ) outputChatBox ( playerwanted , getRootElement()) end if ( playeroccupation ) then local vehicles = getElementsByType("vehicle") local vehicle for i=1,#vehicles do if tostring(vehicles[i]) == playeroccupation then vehicle = vehicles[i] break end end if vehicle then setElementData ( source, "occupation", vehicle) else setAccountData ( playeraccount, "cg.occupation",false) end --outputChatBox ( playeroccupation ,getRootElement()) end if xyz then spawnPlayer ( source, xyz[1], xyz[2], xyz[3] ) outputChatBox ( tostring(xyz[1]) .. tostring(xyz[2]) .. tostring(xyz[3]) ,getRootElement()) end end end addEventHandler ( "onPlayerQuit", getRootElement ( ), onPlayerQuit ) addEventHandler ( "onPlayerLogin", getRootElement ( ), onPlayerLogin ) local normalvehicle = { [1] = {713,-528,16,"checkpoint",2.0,1,1,1,255}, } normalvehiclemarkers = createMarker(unpack(normalvehicle[math.random(#normalvehicle)]))
  12. IIYAMA

    save sys

    line 16 incorrect. setAccountData ( playeraccount, "cg.location", x,y,z ) setAccountData ( playeraccount, "cg.location", x .. "," .. y .. "," .. z ) local contentTable = split(content, string.byte('/')) line 28 incorrect. local x,y,z = getAccountData ( playeraccount, "cg.location" ) local xyz = getAccountData ( playeraccount, "cg.location" ) if xyz then xyz = split(xyz, string.byte(",")) end line 51 incorrect. if ( x,y,z ) then if xyz then Line 52 incorrect. setElementPosition ( source, x, y, z) setElementPosition ( source, xyz[1], xyz[2], xyz[3]) Line 53 incorrect. outputChatBox ( x,y,z ,getRootElement()) outputChatBox ( tostring(xyz[1]) .. tostring(xyz[2]) .. tostring(xyz[3]) ,getRootElement()) Use your debugscript fool, all errors are visible.
  13. IIYAMA

    Bug Problem

    You(all) have to use string.match not string.find, to make this code working correctly. Last time I am saying it.
  14. IIYAMA

    Bug Problem

    use string.match in stead of string.find if string.match(getPlayerName(source), "-|SxG|-") then String find will return things when the letters do match, which isn't want you want. You want to match words.
  15. Well I tried it and it didn't work for me at server too O_o. The only strange thing is that it did send true back, but there was no result. Client side did work on the other hand. But the biggest mystery is that I debugged the code(bone_attach) till the end and should work perfect.
  16. bone_attach resource isn't running?
  17. Where do you need it client or server side? Which will be the main filter of the functions you can use and can't use.
  18. np.
  19. function securityCheck() setTimer(function() -- line 2 local sPlayer = getElementsByType("player") local ruleCheck = false for i,thePlayer in ipairs(sPlayer) do if getPedOccupiedVehicle(thePlayer) == "425" then kickPlayer(thePlayer,"h4x0r hunter") ruleCheck = true end end if not ruleCheck then outputDebugString("nobody broke a vehicle rule") end end,10000,0) -- line 12 end securityCheck() you messed up with the ) and end. They are not the same.
  20. @ADCX Pardon? Incorrect information? Shut your big mouth. I didn't said that you noob, go read better. @ Shinigami As I said before, let the server know when the client is loaded.
  21. Simply by checking if the client is loaded. When the client is loaded this event will be triggered at his pc. "onClientResourceStart" After that you can send the data to that player, which will be 99% chance that the client will be able to accept the data.
  22. because serverside start first. Which means the server is already sending data before the client has been loaded. Which can be the problem. Are you sure clientside is starting?
  23. shaders. IIYAMA can't help you with that.
  24. IIYAMA

    about skin

    Wiki knowns everything. So start there instead of here. and don't start with: me don't know lua, me don't know scripting, me no English speaking, please help me with writing my code Because then you are at the wrong section mate.
  25. In 1.3. https://wiki.multitheftauto.com/wiki/Multi_Theft_Auto But I am not 100% sure. Because before cache there was protected="true", which still works and does the same as cache="false". Also I don't know which version had the linux fix, when this option came out it didn't work for linux yet. So yes it all depends on that and when they actually made it working.
×
×
  • Create New...