A3kri
-
Posts
84 -
Joined
-
Last visited
Posts posted by A3kri
-
-
Hellow ..
I made gui and i can make it visible using the F7. I want it to be visible using triggerClientEvent ..
so I make onPlayerSpawn and the event gets triggered
addEventHandler("onClientResourceStart", resourceRoot, function() GUIEditor.window[1] = guiCreateWindow(166, 96, 545, 402, "credits", false) guiWindowSetSizable(GUIEditor.window[1], false) guiSetVisible(GUIEditor.window[1],false) GUIEditor.staticimage[1] = guiCreateStaticImage(16, 31, 152, 127, "banshee.png", false, GUIEditor.window[1]) end ) bindKey('F7','down', function () guiSetVisible ( GUIEditor.window[1],not guiGetVisible ( GUIEditor.window[1] ) ); showCursor ( guiGetVisible ( GUIEditor.window[1] ) ) end )
this is the client sided.
function player_Spawn ( posX, posY, posZ, spawnRotation, theTeam, theSkin, theInterior, theDimension ) triggerClientEvent ( "onGreeting", getRootElement(), "Hello World!" ) --wiki end addEventHandler ( "onPlayerSpawn", getRootElement(), player_Spawn )
and this is the server sided
I used wiki but couldn't get it.
-
You can send the arguments to the second function.Also, if you don't have 'local' in the function, it will be stored as a global variable.
thanks, what I did was i set them to nil then re set them to a value which made it possible =)
-
Hello ..
I have an if statement inside function1 which has two variables, source and source2.
is it possible to store these to variable for use in function2?
function 1 ( ) if ( xxx == 1) then outputChatBox (getPlayerName(source1) .. "< source1 " .. getPlayerName(source2) .. "< source2 ", getRootElement (), 255, 170, 0 ) toggleControl (source1, "fire", false ) end end function 2( ) givePlayerMoney(source1, 10000) end
is it possible?^
-
getAttachedElements returns a table.
addEventHandler ( "onClientMarkerHit", myMarker, function ( p ) if ( p == localPlayer ) then local attachedElements = getAttachedElements (p) for _,v in ipairs ( attachedElements ) detachElements ( v, p ) end outputChatBox ( " hi " .. getPlayerName(p), 100, 100, 100, true ) end end)
yes i solved it x.x but you answered before i edit lol
thanks very much
-
Arguments for outputChatBox are different on client side,
local myMarker = createMarker ( -710.25555419922, 962.29443359375, 12.410507202148, "cylinder", 1.5, 255, 0, 0, 255 ) addEventHandler ( "onClientMarkerHit", myMarker, function ( p ) if ( p == localPlayer ) then outputChatBox ( " hi " .. getPlayerName(p), 100, 100, 100, true ) end end)
thanks, it's fine.
-
I know this may sound stupid but Idk why it doesn't work x.x
local myMarker = createMarker ( -710.25555419922, 962.29443359375, 12.410507202148, "cylinder", 1.5, 255, 0, 0, 255 ) addEventHandler ( "onClientMarkerHit", myMarker, function () outputChatBox ( " hi " .. getPlayerName(getLocalPlayer()), getRootElement(), 100, 100, 100, true ) end)
nothing happens while it should print
hi xxxxx
-
السلام عليكم ..
رمضان كريم ..
عندي عصا الغولف الي رقمها 2 golfclub
وبغيت لين ضربت إبها شخص player
يصير ..
outputChatBox ( player .. was hit with a goldclub. LOOL, source )
أتمنى فهمتون عليي
-
-
Not like this.
can you tell me how?
-
A "nightstick" isn't a fire arm, so how could it "fire"?
oh, so I cant make when I hit a car with nightstick it blows up ?
-
Hello ..
addEventHandler ( 'onClientWeaponFire', getLocalPlayer(), function ( weapon, ammo, ammoInClip, hitX, hitY, hitZ, hitElement ) if ( weapon == 3 ) and ( getElementType ( hitElement ) == 'vehicle' ) then blowVehicle ( hitElement ) end end )
it should blow ay vehicle i hit by my nightstick ..
but nothing happens
-
local Marker = createMarker ( 2244.4313964844, -1665.2449951172, 15.4765625, "arrow", 1.5, 255, 255, 0, 255 ) addEventHandler ( "onClientMarkerHit", Marker, function ( hitElement ) if ( hitElement == localPlayer ) then setElementInterior ( hitElement, 6, 297.4460, -109.680, 1001.5160 ) end end )
thanks, my problem was in the "6" x.x
-
Post your script.
local Marker = createMarker ( 2244.4313964844, -1665.2449951172, 15.4765625, "arrow", 1.5, 255, 255, 0, 255 ) addEventHandler("onClientMarkerHit",Marker, function() setElementPosition ( getLocalPlayer(), 297.4460, -109.680, 1001.5160 ) end)
this is it.
-
Hello ..
I made a marker and with setElemeentPosition I want the player to transfer to the ammu shop
ID 6: Ammu-Nation 3 297.4460 -109.9680 1001.5160
when I set the coordinates in the setElementPosition it transfer me to another place not the ammu place
-
You'll need a GUI first of all... Then, make the marker create on the client side, and when he hits the server triggers a default MTA event called "onClientMarkerHit."Use the function below:
thanks both, the error I had was i used onMarkerHit and i should've used onClientMarkerHit
-
You can look up interior coordinates on Google.
Oh, I found them ..
https://wiki.multitheftauto.com/wiki/Interior_IDs
thanks =)
-
Hi ..
I made an arrow .. I want when i go to the arrow by setelementposition to transfer me to the skin shop/clothes shop inside.
What is the coordinates of the clothe shop ?
Im not sure but i think something called interior is related, i have a mod called interior in my mods.
-
Hello ..
I made a cylinder
local myMarker = createMarker ( 2244.4313964844, -1665.2449951172, 15.4765625, "cylinder", 1.5, 255, 255, 0, 255 )
now how do I make when I get inside the cylinder a gui I made shows up?
now i can bring it up by a commandhandler
addCommandHandler("ss", skintime, false, false)
how do I make it by entering the cylinder ?
*note that it's in my client side
-
function lookright ( ) local skin = getElementModel ( client ) local playerTeam = getPlayerTeam ( client ) if ( playerTeam and getTeamName ( playerTeam ) == "ekri" ) then setElementModel ( client, skin + 1 ) else setElementModel ( client, 50 ) end end addEvent ( "right", true ) addEventHandler ( "right", getRootElement(), right )
it's working great, thanks.
-
Hello ..
I'm a biggener lua developer, I'm having a problem in one of my scripts I'm trying to build.
function lookright() local skin = getPedSkin(client) local playerTeam = getPlayerTeam(client) if (playerTeam = getTeamName(ekri)) then if (client) then setPedSkin(client, skin+1) end else setPedSkin(client, 50) end end addEvent("right", true) addEventHandler("right", getRootElement(), right)
the problem is in
if (playerTeam = getTeamName(ekri)) then
is it right? I want if the player team is ekri then ... atm the skin of the player always become 50 .. so that means that knowing if the player is in ekri team is wrong thats why the script goes to the else function which sets the skin to 50 not +1
----------
also this doesn't work,
outputChatBox (getPlayerTeam(client), client )
it should output a messsage with the player's team ..
-
Hello ..
I'm a biggener lua developer, I'm having a problem in one of my scripts I'm trying to build.
function lookright() local skin = getPedSkin(client) local playerTeam = getPlayerTeam(client) if (playerTeam = getTeamName(ekri)) then if (client) then setPedSkin(client, skin+1) end else setPedSkin(client, 50) end end addEvent("right", true) addEventHandler("right", getRootElement(), right)
the problem is in
if (playerTeam = getTeamName(ekri)) then
is it right? I want if the player team is ekri then ...
-
Hello ..
I'm a beginner lua developer, but I have a background in javascript.
I want when the player types health his health becomes 100% and he gets 150 taken freom his money, else if he don't have 150 his health doesn't become 100% but an outputChatBox gets printed.
this is what I ended up to
local money = getPlayerMoney(thePlayer) if (money > 150) then takePlayerMoney ( thePlayer, tonumber(150) ) setElementHealth ( thePlayer, getElementHealth(thePlayer) + 100 ) else outputChatBox("You need 150coins.", thePlayer) end
sorry for my noobishness x.x
-
Give me the IP of your server so I can some in and probably permaban him.
You can't, his server gone.
it's not =)
-
none worked ..
I tried both .. fiendly.lua
and in the meta I imported them as server
trigger client event from server
in Scripting
Posted
thnx, I used your serversided function, that what I needed x.x
I used F7 to show/~ the gui