-
Posts
285 -
Joined
-
Last visited
Everything posted by Spajk
-
Hi, I am new to LUA and I tried to make a bit more complicated script and boom it's not working Serverside code: local LSMarker = createMarker( 1686.268, -2331.469, 14.132, "cylinder", 1.5, 255, 0, 0, 100) local SFMarker = createMarker( -1422.733, -288.374, 14.478, "cylinder", 1.5, 255, 0, 0, 100) local LVMarker = createMarker( 1674.72, 1447.909, 10.737, "cylinder", 1.5, 255, 0, 0, 100) function MarkerHit( hitElement, matchingDimension ) if( getElementType( hitElement) == "player" and not isPedInVehicle( hitElement) ) then local city if( source == LSMarker) then city = 1 else if ( source == SFMarker) then city = 2 else if ( source == LVMarker) then city = 3 else return end if( getPlayerWantedLevel( hitElement) > 0 ) then outputChatBox( "Airport security stoped you!", hitElement, 255, 0, 0) return end triggerClientEvent( "OnClientEnterAirport", hitElement, city ) end end addEventHandler( "onMarkerHit", getRootElement(), MarkerHit) Clientside code: local GUI_window = guiCreateWindow(300,146,230,267,"SPAJK AIR",false) local GUI_grid = guiCreateGridList(13,35,203,195,false,GUI_window) guiGridListSetSelectionMode(GUI_grid,0) guiGridListAddColumn(GUI_grid,"Airports:",0.2) local LSR = guiGridListAddRow(GUI_grid) local LVR = guiGridListAddRow(GUI_grid) local SFR = guiGridListAddRow(GUI_grid) guiGridListSetItemText(GUI_grid,0,1,"Los Santos") guiGridListSetItemText(GUI_grid,1,1,"Las Venturas") guiGridListSetItemText(GUI_grid,2,1,"San Fierro") local GUI_label = guiCreateLabel(10,154,185,31,"ALL FLIGHTS COST $2000",false,GUI_window) guiLabelSetColor(GUI_label,255,0,0) guiLabelSetVerticalAlign(GUI_label,"center") guiLabelSetHorizontalAlign(GUI_label,"center",false) GUI_button1 = guiCreateButton(11,238,87,20,"Fly",false,GUI_window) GUI_button2 = guiCreateButton(131,238,87,20,"Close",false,GUI_window) addEvent( "OnClientEnterAirport", true) function Enter(city) guiSetVisible( GUI_window, true) if( city == 1 ) then guiSetVisible( LSR, false) elseif( city == 2 ) then guiSetVisible( SFR, false) elseif( city == 3 ) then guiSetVisible( LVR, false) end showCursor(true) end addEventHandler( "OnClientEnterAirport", getRootElement(), Enter) function Click(button,state) if( button == "left" and state == "down" ) then if( source == GUI_button1 ) if( getPlayerMoney()<2000 ) then OutputChatBox("You don't have enough money for this flight!",255,0,0) else local city = guiGridListGetSelectedItem(GUI_grid) playSound("landing.mp3") SetTimer(GoGoGo,5000,1,city) fadeCamera( true, 1.0) if( city == 1 ) setCameraMatrix(1846.63671875, -2319.6220703125, 56.055404663086, 1898.8486328125, -2428.48046875, 17.950902938843) elseif( city == 2 ) setCameraMatrix(-1303.6181640625, 150.23046875, 102.18531799316, -1354.0478515625, -10.3310546875, 39.475650787354) elseif( city == 3 ) setCameraMatrix(1656.625, 1672.4169921875, 46.536811828613, 1641.220703125, 1646.908203125, 39.581771850586) end showPlayerHudComponent("all", false ) ShowCursor(false) end elseif( source == GUI_button2 ) guiSetVisible(GUI_window,false) ShowCursor(false) end end end function GoGoGo(city) fadeCamera( true, 1.0) setCameraTarget( getLocalPlayer()) if( city == 1 ) setElementPosition ( getLocalPlayer(), 1686.154296875, -2327.875, 13.948606491089 ) elseif( city == 2 ) setElementPosition ( getLocalPlayer(), -1424.5205078125, -290.970703125, 14.650023460388 ) elseif( city == 3 ) setElementPosition ( getLocalPlayer(), 1690.9189453125, 1448.125, 10.736848831177 ) end guiSetVisible(GUI_window,false) ShowCursor(false) takePlayerMoney(2000) end addEventHandler( "onClientGUIClick", getRootElement(), Click ) there's some error outputed to console, but Idk how to fix it
-
doesn't work with timer, but works client side, thanks
-
GTA V will have in-build multiplayer
-
done that, there's no fire at all
-
I made a simple script that should put a ped on fire, but it doesn't work the code: function pedLoad ( name ) local ped = createPed ( 120, 0, 0, 6) if( ped ) then local result = setPedOnFire( ped, true ) if( result ) then outputChatBox("good") else outputChatBox("bad2") end else outputChatBox("bad1") end end addEventHandler ( "onResourceStart", getResourceRootElement(), pedLoad ) ss: http://img684.imageshack.us/img684/7470 ... 165954.png
-
is there anyway to detect when vehicle is being "sprayed" by fire truck's water cannon
-
turf is a gang zone and it can be taken by other gang. I think I can do this addon
-
well it can be made with this expored functions
-
turf system would be a nice addon to this script
-
change col obj size to something smaller col = createColSphere (959, 198, 35, 10 ) --change pos => col = createColSphere (959, 198, 35, 1.5 ) --change pos
-
is there any way to simulate vehicle drowning in water ?
-
what's recommend OS ?
-
So, I need minimal requirements for MTA:SA server
-
I think that I found what I was looking for in https://nightly.multitheftauto.com/
-
Is there any patch to patch my server form 1.0.4 to 1.0.5 or I must reaintall MTA?
-
I give up I will use Solidsnake's gang system
-
Ok, I fixed some bugs, but I have problem with leave cmd [2011-05-17 10:33:56] WARNING: gang\gang.lua:76: Bad argument @ 'getAccountData' [2011-05-17 10:33:56] ERROR: gang\gang.lua:77: attempt to concatenate local 'gangname' (a boolean value) [2011-05-17 10:34:18] WARNING: gang\gang.lua:76: Bad argument @ 'getAccountData' [2011-05-17 10:34:18] ERROR: gang\gang.lua:77: attempt to concatenate local 'gangname' (a boolean value) The new code : http://pastebin.com/NsZHaEb2 @Solidsnake Yes, I am using MTA account system for gang accounts, I could use xml files, but I think this is easier And account name format is gang-gangname
-
ok, I had some "code" errors but I fixed them here's the code http://pastebin.com/zeHH16Yv I still have a lot of bug's so I am asking scripters to try making this thing to work
-
I need someone to test my script function create( playerSource, commandName, name ) local acc = getPlayerAccount ( playerSource ) local gang = getAccountData( acc,"gang") if(gang) then outputChatBox ( "You already have a gang, use /gangleave to leave it!", playerSource ) else if getAccount( "gang-" ..name.."") then outputChatBox ( "Account name alreaady exist.", playerSource ) ` else local money = getPlayerMoney(playerSource) if( money < 1000000 ) then outputChatBox ( "You don't have enough money!", playerSource ) else local accname = getAccountName( acc ) local gangacc = addAccount( "gang-" ..name.."", "nisamkodkucejermiseoce" ) setAccountData ( gangacc,"leader",accname ) setAccountData ( gangacc,"name",name ) setAccountData ( acc,"gang","gang-" ..name.."" ) local team = createTeam(name) setPlayerTeam" class="kw6">setPlayerTeam" class="kw6">setPlayerTeam( playerSource, team ) takePlayerMoney( playerSource, 1000000 ) setAccountData ( gangacc,"members",1 ) outputChatBox ( "Gang "..name.." sucesfully created!", playerSource ) end end end end function invite( playerSource, commandName, name ) local acc = getPlayerAccount ( playerSource ) local gang = getAccountData( acc,"gang") if( gang ) then local gangacc = getAccount(gang) local gangname = getAccountData( gangacc,"name") local gangleader = getAccountData( gangacc,"leader") if(leader==acc) then new player = getPlayerFromName( name ) if(player) then outputChatBox ( "Tou have been invited to join "..gangname.." .use /gangaccept to accept this gang!", player ) local playeracc = getPlayerAccount ( player ) setAccountData(playeracc,"invite","gang-"..name.."") else outputChatBox ( "Player "..name.." doesn't exist", playerSource ) end else outputChatBox ( "You aren't leader of this gang!", playerSource ) end end end function accept( playerSource ) local acc = getPlayerAccount ( playerSource ) local gang = getAccountData( acc,"gang") if(gang) then outputChatBox ( "You already have a gang, use /gangleave to leave it!", playerSource ) else gang = getAccountData( acc,"invite") if(invite) then local gangacc = getAccount(gang) local gangname = getAccountData( gangacc,"name") local members = getAccountData ( gangacc,"members") setAccountData ( acc,"gang",gang ) setPlayerTeam" class="kw6">setPlayerTeam(playerSource,name) members = members + 1 setAccountData (gangacc,"members",members) outputChatBox ( "You joind in gang "..gangname.." !", playerSource ) else outputChatBox ( "You haven't been invited in any gang!", playerSource ) end end end function leave( playerSource ) local acc = getPlayerAccount ( playerSource ) local gang = getAccountData( acc,"gang") local gangacc = getAccount(gang) local gangname = getAccountData( gangacc,"name") if(gang) then outputChatBox ( "You leaved gang "..gangname.."!", playerSource ) local members = getAccountData ( gangacc,"members") members = members - 1 setAccountData (gangacc,"members",members) setAccountData ( acc,"gang","") else outputChatBox ( "You don't have a gang!", playerSource ) end end function kick( playerSource, commandName, name ) local acc = getPlayerAccount ( playerSource ) local gang = getAccountData( acc,"gang") if ( gang ) then local gangacc = getAccount(gang) local gangname = getAccountData( gangacc,"name") local gangleader = getAccountData( gangacc,"leader") if(leader==acc) then new player = getPlayerFromName( name ) if(player) then outputChatBox ( "You have been kicked from gang "..gangname.."!", player ) outputChatBox ( "You kicked "..name.." from gang!", player ) local members = getAccountData ( gangacc,"members") members = members - 1 setAccountData (gangacc,"members",members) setAccountData ( acc,"gang","") else outputChatBox ( "Player "..name.." doesn't exist", playerSource ) end else outputChatBox ( "You aren't leader of this gang!", playerSource ) end end end function onPlayerLogin ( ) local acc = getPlayerAccount ( source ) local gang = getAccountData( acc,"gang") if ( gang ) then local gangacc = getAccount(gang) local gangname = getAccountData( gangacc,"name") local team = getTeamFromName ( gangname ) setPlayerTeam" class="kw6">setPlayerTeam" class="kw6">setPlayerTeam( source, team ) end end addEventHandler ( "onPlayerLogin", getRootElement ( ), onPlayerLogin ) addCommandHandler ( "gangcreate", create ) addCommandHandler ( "ganginvite", invite ) addCommandHandler ( "gangaccept", accept ) addCommandHandler ( "gangleave", leave ) addCommandHandler ( "gangkick", kick )
-
I know that this is a Double post but... Will this event( https://wiki.multitheftauto.com/wiki/OnP ... hicleEnter ) return a nil value for "jacked" if none is jacked ?
-
are you sure that "account" is an account? i mean, maybe you forgot something like "local account = getPlayerAccount(source)" thanks on that too, I forgot to add that
-
thank you very much I don't understand this: --[[>]] setAccountData(account, "rpg.jtime", time) -- is account variable set?
-
Ok, a am new to LUA and I need help. Can someone tell me if I have some "code" mistake function free( player ) setPlayerWantedLevel ( player, 0 ) end function playerDamage ( attacker, weapon, bodypart, loss ) --when a player is damaged if ( bodypart == 7 or bodypart==8 ) then setPedAnimation( source, "ped", "WOMAN_walknorm", 5000) end local swat = getTeamFromName("SWAT") local fbi = getTeamFromName("FBI") local officer = getTeamFromName("Police officer") local tc = getTeamFromName("Traffic control") local team = getPlayerTeam" class="kw2">getPlayerTeam" class="kw2">getPlayerTeam" class="kw2">getPlayerTeam" class="kw2">getPlayerTeam" class="kw2">getPlayerTeam ( source ) If ( weapon == 3 ) then if(team==swat or team==fbi or team==officer or team==tc) then local stars = getPlayerWantedLevel ( source ) local time - stars*10 setAccountData ( account, "rpg.jtime", time ) setTimer(free,time*1000,1,source) end end end function onPlayerQuit ( ) local playeraccount = getPlayerAccount ( source ) if ( playeraccount ) then local playerstars = getPlayerWantedLevel ( source ) setAccountData ( playeraccount, "rpg.wstars", playerstars ) end end function onPlayerLogin ( ) local playeraccount = getPlayerAccount ( source ) if ( playeraccount ) then local playerstars = getAccountData ( playeraccount, "rpg.wstars" ) if ( playerstars ) then setPlayerWantedLevel ( source, playerstars ) end end end function registeracc( playerSource, commandName, user, pass ) local account = getPlayerAccount ( playerSource ) if isGuestAccount ( account ) then If getAccount( user ) outputChatBox ( "Account name alreaady exist.", playerSource ) else addAccount( user, pass ) ` outputChatBox ( "Account" ..user.. "successfully created with password" ..pass.. ".", playerSource ) end else outputChatBox ( "You already have account.", playerSource ) end end addCommandHandler ( "register", registeracc ) addEventHandler ( "onPlayerDamage", getRootElement (), playerDamage ) addEventHandler ( "onPlayerQuit", getRootElement ( ), onPlayerQuit ) addEventHandler ( "onPlayerLogin", getRootElement ( ), onPlayerLogin )
-
please, look at the image in the first post