Jump to content

Wojak

Members
  • Posts

    321
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by Wojak

  1. In the file: ctvspawnscreen.lua in a function: onCTVSpawnMapStart after: varTeam1 = createTeam ( tostring(team1name), team1col1, team1col2, team1col3 ) varTeam2 = createTeam ( tostring(team2name), team2col1, team2col2, team2col3 ) varTeam3 = createTeam ( tostring(team3name), team3col1, team3col2, team3col3 ) varTeam4 = createTeam ( tostring(team4name), team4col1, team4col2, team4col3 )
  2. for the coordinates you can create a EDF and add them using map editor, yours script will read it from the map file. to made it full server side you need to attach vehicle to an obiect and move the obiect, it will be synced but it will ignore the world physics. example: using controlle states on element syncer client is a better way(moving element on syncer client wil synchronize it for all clients). example: Both methods require the creation of simple AI, obstacle detection is a different story...
  3. Wojak

    Ped don't move

    if you want to use the controle states- cteate ped serverside, and use the syncer client to move it https://wiki.multitheftauto.com/wiki/GetElementSyncer https://wiki.multitheftauto.com/wiki/TriggerClientEvent
  4. unfortunately nothing better can be found at the moment
  5. Wojak

    Respawn

    not all numbers between 0 and 200 are valid skin id's https://wiki.multitheftauto.com/wiki/Character_Skins
  6. https://community.multitheftauto.com/index.php?p= ... ils&id=461
  7. There is nothing to fix in your's code - it is a random copying from the wiki. One can only rewrite it using some logic... The goal is to "ask the server for accountData" serverside function greetingHandler ( ) account = getPlayerAccount(source) if not isGuestAccount (account ) then local cash = getAccountData ( account, "data.cash" ) local deaths = getAccountData ( account, "data.deaths" ) local adminlevel = getAccountData ( account, "data.adminlevel" ) triggerClientEvent(source,"SendAccountData",source,cash,deaths,adminlevel) end end addEvent( "onGreeting", true ) addEventHandler( "onGreeting", getRootElement(), greetingHandler ) clientside function greetingCommand ( ) triggerServerEvent ( "onGreeting", getLocalPlayer()) end addCommandHandler ( "greet", greetingCommand ) addEvent( "SendAccountData", true ) addEventHandler( "SendAccountData", getRootElement(), function(cash,deaths,adminlevel) outputChatBox ( "Money: ".. tostring( cash ) ) outputChatBox ( "Deaths: ".. tostring( deaths) ) outputChatBox ( "Adminlevel: ".. tostring( adminlevel ) ) end)
  8. I hope you understand how it works, and that some people learned something and stop spreading "single copmuter - server is the only true way - SAMP type of thinking" PS: this may be esential: server addEventHandler ( "onPlayerQuit", getRootElement(),function() helmlist[source] = nil end ) client addEventHandler( "onClientPlayerQuit", getRootElement(), function() helmart[source] = nil destroyElement(helm[source]) helm[source] = nil end )
  9. try this, i did not test it with other players, there probably sgould be some garbage colecting on player quit server addEvent("onHelmCommand", true) addEvent("onFileDownload",true) helmlist = {} addEventHandler("onHelmCommand",getRootElement(),function(helmart) helmlist[source] = helmart triggerClientEvent(getRootElement(),"onHelmSyncedCommand",source,helmart) end) addEventHandler("onFileDownload",getRootElement(),function() for i,h in pairs(helmlist) do if isElement(i) then triggerClientEvent(source,"onHelmSyncedCommand",i,h) end end end) client addEvent("onHelmSyncedCommand",true) helm = {} helmart = {} function stahlhelm() players = getElementsByType("player") for i,p in pairs(players) do if isElement(p) and isElement(helm[p]) then rz = getPedRotation (p) px, py, pz = getPedBonePosition(p,8) px = px+( ( math.cos ( math.rad ( rz ) ) ) * 0.02 ) - math.sin ( math.rad ( rz ) ) * 0.007 py = py+( ( math.sin ( math.rad ( rz ) ) ) * 0.02 ) + math.cos ( math.rad ( rz ) ) * 0.007 if (helmart[p] == 1) or (helmart[p] == 2) then setElementPosition (helm[p], px, py, pz+0.1 ) setElementRotation (helm[p], 0,0,(rz-180) ) else setElementPosition (helm[p], px, py, pz+0.112 ) setElementRotation (helm[p], 0,0,(rz-180) ) end end end end addEventHandler ( "onClientPreRender", getRootElement(), stahlhelm ) addEventHandler("onHelmSyncedCommand", getRootElement(),function(helmart_) helmart[source] = helmart_ if isElement (helm[source]) then destroyElement(helm[source]) end if (helmart_ == 1) then outputChatBox ( "Stahlhelm 1" ) helm[source] = createObject (2052, 0,0,0 ) -- tommy setObjectScale(helm[source], 0.85) setElementDoubleSided ( helm[source], true ) setElementData ( getLocalPlayer(), "helmeted", true ) elseif (helmart_ == 2) then outputChatBox ( "Stahlhelm 2" ) helm[source] = createObject (2053, 0,0,0 ) -- jerry setObjectScale(helm[source], 0.85) setElementDoubleSided ( helm[source], true ) setElementData ( getLocalPlayer(), "helmeted", true ) elseif (helmart_ == 3) then outputChatBox ( "Offiziersmütze" ) helm[source] = createObject (2054, 0,0,0 ) -- officer setObjectScale(helm[source], 0.85) setElementDoubleSided ( helm[source], true ) setElementData ( getLocalPlayer(), "helmeted", true ) end end) addCommandHandler("stahl", function(com, helmart_) outputChatBox ( "?" ) if tonumber(helmart_) == 0 or tonumber(helmart_) == 1 or tonumber(helmart_) == 2 or tonumber(helmart_) == 3 then triggerServerEvent("onHelmCommand", getLocalPlayer(),tonumber(helmart_)) else outputChatBox ( "Valid numbers are 0,1,2 and 3." ) end end) outputChatBox("Stahlhelm by Einheit-101 loaded", 245,0,0) triggerServerEvent("onFileDownload", getLocalPlayer()) btw: "Make Client-side Object Visible Server-side" thinking is wrong imo
  10. https://wiki.multitheftauto.com/wiki/WarpPedIntoVehicle works with players
  11. you doing it clientside (read my post) you using the server to retrive the data frome one client (player who enter the command), and send the data back to all clients (basic MP stuff) player is pased as source in handler function, and you may pass command arguments as arguments in the event
  12. I don't like whot you people are doing in here keep it simple and 99% clientside helm should be a table clientside indexed by players when player enter a comand - client send information to serwer (event on loacl player), then the server should send the information back to all players (event on root element), and create a helmet clientside and store it in a table helm function starthelm should be for all players players = geteEementsByType("player") for i,p in pairs(players) do if helm[p] then ... end end
  13. Wojak

    Alpha Set :D

    Did you set the default alpha? guiSetAlpha(wndShop, 0.6)) after wndShop cteation also try to secure the condition more if getAlpha <= 0.1 then setTimer(setMajorAlpha, 500, 6) elseif getAlpha >= 0.6 then setTimer(setMinorAlpha, 500, 6) end
  14. this is youre lucky day, I needed that conwerter recently function guiLabelSetHexColor (theelement, color) local hexTodecim = {["0"]=0,["1"]=1,["2"]=2,["3"]=3,["4"]=4,["5"]=5,["6"]=6,["7"]=7,["8"]=8,["9"]=9,["a"]=10,["b"]=11,["c"]=12,["d"]=13,["e"]=14,["f"]=15} local red = (hexTodecim[string.lower(string.sub(color, 2, 2))]*16) + hexTodecim[string.lower(string.sub(color, 3, 3))] local green = (hexTodecim[string.lower(string.sub(color, 4, 4))]*16) + hexTodecim[string.lower(string.sub(color, 5, 5))] local blue = (hexTodecim[string.lower(string.sub(color, 6, 6))]*16) + hexTodecim[string.lower(string.sub(color, 7, 7))] guiLabelSetColor(theelement,red,green,blue) end paste the function somewhere in youre script and use guiLabelSetHexColor (theelement, hexcode) instead of guiLabelSetColor(theelement,red,green,blue)
  15. why not add a mapeditor suport? it is pasiple, and will be user friendly... http://img219.imageshack.us/img219/6213 ... 202038.jpg
  16. he did not explain whot this sctipt should do: source: viewtopic.php?f=124&t=32039
  17. Śmiem twierdzić że wiesz jedyne jak zrobić by pokazywało graczy którzy byli na serwerze w chili gdy skrypt załadował się na twoim cliencie Uwagi: -lista powinna się odświeżać przy każdym wpisaniu komendy (usuwanie starej listy i tworzenie nowej) -pobieranie pozycji local playera i tworzenie colschepa musi się odbywać przed stworzeniem listy, przy każdym wpisaniu komendy -po stworzeniu komendy colshape należy usunąć
  18. You are using a translator? hmm... so there is a matker attached to a vehicle, and when you ger out of the wehicle, stand in this matker and type /barrel it should give you a barrel? i dont understand this line... Skin = { [280]=true } try Skin = 280 WT... if Skin[getElementModel(player)] then cancelEvent() i think it should be: if Skin == getElementModel(player) then is it possible to cancel the command? and why to do it? objects[player] = createObject ( 1228, x, y, z+1, rotx, roty, rotz ) where is the objects table? you are missing: objects = {} on the begining of yours script... and the fatal reason: you can only attach visual part of the marker to a moving element (vehicle), the marker collshape will always stay in the creation position (it will not work if you move the vehicle)
  19. maybe try: newZombieLimit = tonumber(newZombieLimit) or 50 -- if newZombieLimit is not convertible use the default value (idk what it is i'm guessing 50) if (table.getn( allzombies )+pacecount < newZombieLimit ) and (ZombieStreaming == 1) then
  20. open the resource meta.xml and change the settings access modifiers (change # (or @) to *) https://wiki.multitheftauto.com/wiki/Settings_system
  21. gdyby nie komentarz moderatora w sekcji Scripting, że przenosi temat do sekcji niemieckiej, to bym tego dziełu nie zauważył jakoś nie często zaglądam na spód forum... @dzek może znalazł byś w sygnie miejsce na link do tej sekcji, w końcu najwięcej się tu udzielasz i twoje postu trudno przegapić
  22. You should write a resource that will enter the command for you, when you log in: https://wiki.multitheftauto.com/wiki/Exe ... andHandler i thing that this kind of resource will need permissions in acl.xml, and of course you will need do add it to server startup in the mtaserver.conf
  23. this don't need to be done from scratch... There is a nice core resource design for that: https://wiki.multitheftauto.com/wiki/Res ... ssiontimer
  24. You can also create a resource whit all you're functions that exports them (a library resource), and upload it to community
  25. Wojak

    GetMapName()

    mapname = call(getResourceFromName("mapmanager"),"getRunningGamemodeMap")) or mapname = exports.mapmanager:getRunningGamemodeMap() all is described in the links dzek given you, it will work if resource mapmanager is running (an its almost always is for most gamemodes)
×
×
  • Create New...