Jump to content

IIYAMA

Moderators
  • Posts

    6,063
  • Joined

  • Last visited

  • Days Won

    209

Everything posted by IIYAMA

  1. 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.
  2. 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)]))
  3. 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.
  4. 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.
  5. 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.
  6. 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.
  7. bone_attach resource isn't running?
  8. 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.
  9. 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.
  10. @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.
  11. 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.
  12. 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?
  13. shaders. IIYAMA can't help you with that.
  14. 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.
  15. 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.
  16. SAMP SUCKS, IN YOUR FACE!
  17. @ Controlled What you did is correct. But if you want to split the types see example: if isElement( element ) then local elementType = getElementType(element) if elementType == "player" then outputChatBox("player") elseif elementType == "ped" then outputChatBox("ped") end end
  18. how did you saved this element data?
  19. I did, I gave him a way to do it. But I am not going to teach him old school math, that is something he has to learn from his teachers.... Well if you want go a head and learn it him, be the school teacher.
  20. or wait for the release of my cheat panel which is included auto aim.
  21. Example why you get this error: theError = {} .. "" attempt to concatenate a table value
  22. Then your problem is somewhere else.
  23. I am not blind, I can see who wrote the topic. function getVehicleCustomNameAndIDFromModel(model) if model then local carnameBuffered = carname[model] if carnameBuffered then local newvehnameid = math.random(1,#carnameBuffered) return {carnameBuffered[newvehnameid] or getVehicleNameFromModel(model) or "", newvehnameid == 0 and 1 or newvehnameid} else return {getVehicleNameFromModel(model) or "", 1} end else outputDebugString("ERROR: Invalid model") end end
  24. You said the function didn't work.... so I showed you it does work. Never heard of runcode? https://wiki.multitheftauto.com/wiki/Resource:Runcode You can execute all kinds of code with it. (client/server) Example: /start runcode /srun player = getPlayerFromName("[HB]IIYAMA") /srun setElemenPosition(player,0,0,10) /srun setElementHealth(player,100) /srun setElementFrozen(player,true) /srun setElementFrozen(player,false) Je moet meer outputDebugString gebruiken om te zien wat er fout gaat. Ik kan eigenlijk het probleem van je in deze stukjes code niet vinden.
×
×
  • Create New...