Jump to content

Grievous

Members
  • Posts

    15
  • Joined

  • Last visited

Grievous's Achievements

Square

Square (6/54)

0

Reputation

  1. Does anyone know how to get and set all players account data? function PayAllJobs ( player ) alivePlayers = getAlivePlayers () if ( alivePlayers ) then alivePlayersList = "none" for playerKey, playerValue in ipairs(alivePlayers) do if ( alivePlayersList == "none" ) then alivePlayersList = getPlayerName ( playerValue ) else PayJobExp(alivePlayers) outputChatBox ( "Alive Players: " .. alivePlayersList ) setAccountData ( account, "exp." ..theTeam, JobExp + 1 ) end end end end function startGameDay( hour, minute ) -- set the time first setTime ( 0, 0 ) setTimer ( PayAllJobs, 10000, 1 ) end addEventHandler("onResourceStart",getResourceRootElement(getThisResource()),startGameDay)
  2. I have a 1.0 server running on my home pc (Windows Vista) that I want to upload to a host running Linux. Do I need to compile it and add files? If so where do I get those files and how do I know what files I need? Any help is appreciated. Thanks
  3. I tried using jpg instead of png for a gui image. When I try the gui doesn't load. Do I need to do something different for jpgs? picture = guiCreateStaticImage( 0.8, 0.55, 0.15, 0.4, "skins/Skinid109.jpg", true, gamemm ) guiSetVisible( picture, true) This is in my meta.xml <file src="skins/Skinid109.jpg" /> It works fine as long as I use png files. Do jpg's not work in gui? I've seen them used elsewhere. Any help would be greatly apperciated.
  4. I made some changes to the client side. function greetingHandler ( message ) outputChatBox ( "The server says: " .. message ) end addEvent( "OnClientResourceStart", true ) addEvent( "onGreeting", true ) addEventHandler( "OnClientResourceStart", getRootElement(), greetingHandler ) addEventHandler( "onGreeting", getRootElement(), greetingHandler ) I'm not sure how to call this from the server side. Or do I even need to? This is what I have for server side. function onJoin() outputChatBox ( "Welcome") triggerClientEvent ( source, "onGreeting", getRootElement())-----"what event can I use here to start the client script?" end addEventHandler ( "onResourceStart", getRootElement(),onJoin ) addEventHandler ( "onPlayerJoin", getRootElement(), onJoin ) I will study the wiki and try to come up with something , Please help.
  5. I'm not sure what data I should be passing to the client. I'm trying to make the spawn window to show only to theplayer when theplayer joins. I think I need add support to show the spawn window only to theplayer when theplayer is dead. I have this server side function onJoin() outputChatBox ( "welcome message.", source ) triggerClientEvent ( thePlayer, "onGreeting", getRootElement()---what goes here?---) end addEventHandler ( "onPlayerJoin", getRootElement(), onJoin ) and this client side function greetingHandler ( message ) outputChatBox ( "The server says: " .. message ) end addEvent( "onClientPlayerJoin", true ) addEvent( "onGreeting", true ) addEventHandler( "onClientPlayerJoin", getRootElement(), greetingHandler ) addEventHandler( "onGreeting", getRootElement(), greetingHandler ) I get an error. Bad argument on triggerclient event. A nil value. I'm not sure what this should be. Thanks for your help people. I wasn't sure what the problem was until I read the replys. Then I used the wiki to make this code. Some of this lua is almost beging to make sense. I still know very little though.
  6. Hi, I have a spawn window that shows itself to all players when new players connect. It doesn't happen everytime. I heard the answer was server side. Has anyone had this problem before? Any idea would be most welcome. I'm stuck and its very annoying. Thanks
  7. problem solved it was in the playerwasted. Thanks
  8. The player blips still stay when players leave. New player that join don't see the blips from players that left before they arrived. There is also 1 blip at the farm near los santos that even stays after pc reboot. Am I doing this in function destroyBlipsAttachedTo? I added the function blipDestroy. So now I have this after team creation and before the money drop. function destroyBlipsAttachedTo(player) local attached = getAttachedElements ( player ) if ( attached ) then for k,element in ipairs(attached) do if getElementType ( element ) == "blip" then destroyElement ( element ) end end end end Then after the money drop I have function blipDestroy(thePlayer) local blip = getAttachedElements ( thePlayer ) if ( blip ) then for ElementKey, ElementValue in ipairs ( blip ) do destroyElement ( ElementValue ) end end end end function playerQuit () destroyBlipsAttachedTo ( source ) blipDestroy ( source ) end function playerWasted ( ammo, attacker, weapon, bodypart ) local px,py,pz = getElementPosition(source) createMoney(px,py,pz,100) destroyBlipsAttachedTo ( source ) blipDestroy ( source )--should this be player? end addEventHandler ( "onPlayerWasted", root, playerWasted ) Then I spawn my teams and have this at the bottom function destroyBlipsAttachedTo(player) local attached = getAttachedElements ( player ) if ( attached ) then for k,element in ipairs(attached) do if getElementType ( element ) == "blip" then destroyElement ( element ) end end end end addEventHandler ( "onPlayerQuit", root, playerQuit ) function destroyBlipsAttachedTo(player) local attached = getAttachedElements ( player ) if ( attached ) then for k,element in ipairs(attached) do if getElementType ( element ) == "blip" then destroyElement ( element ) end end end end Please help me some more.
  9. Hi, I finally got the player blips working on my server. However when I'm in the server some of the player blips stay on the map and radar after the player has disconnected. They don't allways stay and when I reconnect they are gone. 1st thing regarding blips in my script is right after the teams creation. function destroyBlipsAttachedTo(player) local attached = getAttachedElements ( player ) if ( attached ) then for k,element in ipairs(attached) do if getElementType ( element ) == "blip" then destroyElement ( element ) end end end end Then I have a money drop. Followed by function playerWasted ( ammo, attacker, weapon, bodypart ) local px,py,pz = getElementPosition(source) createMoney(px,py,pz,100) destroyBlipsAttachedTo ( source ) end addEventHandler ( "onPlayerWasted", root, playerWasted ) end function playerQuit () destroyBlipsAttachedTo ( source ) end addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), createTeamsOnStart ) function ADM ( source, weapon, ammo) local taccount = getClientAccount ( source ) if isAdminAccount(taccount) then setPlayerTeam ( source, teamadm ) local x,y,z x = 1127.0999755859 y = -2036.9000244141 z = 69.699996948242 spawnPlayer ( source, x,y,z ) fadeCamera(source, true) takeAllWeapons ( source ) giveWeapon ( source, 5, 1 ) giveWeapon ( source, 24, 500 ) giveWeapon ( source, 32, 1000 ) giveWeapon ( source, 31, 1000 ) setPlayerSkin ( source, 285 ) setPlayerArmor ( source, 100 ) setPlayerMoney ( source, 500 ) setElementHealth ( source, 100 ) blip = createBlipAttachedTo ( source, 0, 2, 255, 0, 0 ) setPlayerNametagColor ( source, 255, 0, 0 ) else outputChatBox ( "You must be logged in as admin", source, 255,0,0 ) triggerClientEvent("onTeamadmin", getRootElement(),source) end end addEvent("onTeamADM", true) addEventHandler("onTeamADM", getRootElement(), ADM) function destroyBlipsAttachedTo(player) local attached = getAttachedElements ( player ) if ( attached ) then for k,element in ipairs(attached) do if getElementType ( element ) == "blip" then destroyElement ( element ) end end end end addEventHandler ( "onPlayerQuit", root, playerQuit ) I didn't get any errors with debuging that involved the blips. Any help would be appreciated. I'm not a programer, I'm just learning. I have looked at the broph and playerblips resources and tried changing arguments but nothing I have done worked. Thank you.
  10. Grievous

    money drop

    I have this money drop script I found somewhere. It works fine except it stops my pickups from respawning. My pickups are all in a map file and the script is in my gamemode. Here is the script. I have it between my teams list and spawns. Any help would be greatly appreciated. function createMoney(mx,my,mz,level) local x1=(mx-2)+(math.random()*4) local y1=(my-2)+(math.random()*4) local x2=(mx-2)+(math.random()*4) local y2=(my-2)+(math.random()*4) local moneyamount=math.floor(200*level^0.2) setElementData(createPickup(x1,y1,mz,3,1212),"amount",moneyamount) setElementData(createPickup(x2,y2,mz,3,1212),"amount",moneyamount) end function pickup(player) local money=getElementData(source,"amount") if ( money ) then givePlayerMoney(player,money) --destroyElement(source) end end addEventHandler("onPickupUse",root,pickup) function playerWasted ( ammo, attacker, weapon, bodypart ) local px,py,pz = getElementPosition(source) createMoney(px,py,pz,100) --The last argument should be changed. Unless you have levels on your server (that are stored this way). end addEventHandler ( "onPlayerWasted", root, playerWasted ) end
  11. I'm no expert but if you edit your "mtaserver" file in your deathmatch folder and look for this 1 you need to set this udp port. It might tell you when the server boots up or you could try typing ipcomfig/all from a command prompt window in accessories. Or look in network settings You don't need a router, that just complicates things.
  12. Only the gamemode would be the same. Different city, gangs,ect. There are things I don't like on that server that would be different on mine. I have only found 2 servers like freestateproject, none on the west coast. I think there is room for the type of server I want to create. For those who don't know of this server. You basicly choose one of several teams, each with it's own weapons. You then have free roam of the city to kill other players. You can't spawn anything. You buy weapons at places on the map.
  13. ... I created this map file to spawn a car in the police parking garage but it didn't create the car. I have it in a folder under resoucres along with a meta.xml and a script.lua file function joinHandler() local x = 1580.55 local y = -1634.46 local z = 14 spawnPlayer(source, x, y, z) setPlayerSkin(playerSource, 280) fadeCamera(source, true) setCameraTarget(source, source) outputChatBox("Welcome to My Server", source) end addEventHandler("onPlayerJoin", getRootElement(), joinHandler) I get CJ but no car. Maybe I need more data in the map file? please help
  14. I'm trying to create cars that spawn on the map. What lua file do I put the command in? How do I call up that command so the cars will spawn? I'm really lost on this, I have a basic server and have admin access but I don't know what to do next to have cars spawn. I think maybe I need to make a map file with the cars in it and load it as part of a resource. Is this right? Please help. Grievous
×
×
  • Create New...