-
Posts
2,947 -
Joined
-
Last visited
Everything posted by JR10
-
Do you want to just create a car and warp him in it? If so: function vehicleFBITruck() if ( getPlayerMoney (source) >= 3000 ) then takePlayerMoney(source, 3000) outputChatBox("You have bought Sd.Kfz.222 vehicle.",source) local x,y,z = getElementPosition(source) local veh = createVehicle(601,x,y,z+5) warpPedIntoVehicle(source, veh) else outputChatBox('You dont have enough money to buy this Vehicle.', source, 255, 0, 0 ) end end addEvent("onVehicleBought", true) addEventHandler("onVehicleBought", getRootElement(), vehicleFBITruck)
-
Your code checks if the teams exist, but does not check which one the player is in. You need getPlayerTeam for that. addEventHandler( "onPlayerWasted", getRootElement( ), function( ) local team = getPlayerTeam(source) local ballassT = getTeamFromName("The Ballas") local groT = getTeamFromName("Grove Street Families") if (team == groT) then spawnPlayer (source, 3190.1435546875, -1885.5627441406, 24.918750762939) setPlayerSkin (source, 106 ) giveWeapon(source, 31, 1000) giveWeapon(source, 34, 1000) giveWeapon(source, 17, 1000) giveWeapon(source, 24, 1000) elseif (team == ballassT) then spawnPlayer (source, 3217.451171875, -1917.2902832031, 30.864063262939) setPlayerSkin ( source, 104 ) giveWeapon(source, 31, 1000) giveWeapon(source, 34, 1000) giveWeapon(source, 17, 1000) giveWeapon(source, 24, 1000) end end) Another way would be to use getTeamName(getPlayerTeam(source)) == "The Ballas"
-
Maybe just maybe because your code only takes the money away? Is this the full code?
-
What doesn't work exactly? You need to tell us if there is any errors in /debugscript 3, and what happens and what doesn't.
-
Why would this help? He wants to destroy vehicles that are near a certain world position, you're just destroying all the vehicles.
-
It's setPlayerNameTagText, the s is small. Why is there a comma after the function name. The player argument should not be a string. And no, you can't do that, you have to specify a new name tag text.
-
Post the full current code. This way, when someone wants to help you he can test it himself.
-
In getScreenFromWorldPosition, your edgeTolerence is 500, but it's expecting it to be relative to the screen. float float getScreenFromWorldPosition ( float x, float y, float z, [ float edgeTolerance=0, bool relative=true ] ) So, the fifth argument should be false. Also, 500 is kinda far from the object, you might want to decrease it. If this doesn't work, please post your updated code.
-
addEventHandler ( "onClientPlayerDamage", localPlayer, function(attacker, weapon, bodypart, loss) if getElementData(localPlayer,"admin") == "true" then cancelEvent() end end) function admin () local team = getPlayerTeam(source) local teamName = team and getTeamName ( team ) or "" if ( teamName == "Staff" ) then setElementData(source,"admin","true") else removeElementData(source,"admin") end end addEventHandler("onPlayerChangeTeam",root,admin) If it doesn't work, post the code where you trigger the event, along with any errors in /debugscript 3.
-
Are you for real? You think that no one's replying because they hate you? They have nothing to say, easy as that. Just because I viewed the topic doesn't mean I'll comment. Also, why didn't you upload it to the community? It's encouraged that you do so, people can find it easily.
-
A possible cause is that you never send the rotation argument. You only send the 3 coordinates, so the check in moveThePlayer always returns false.
-
This is wrong. You have to pass a team userdata variable to getTeamName, not a player variable. function admin () local team = getPlayerTeam(source) local teamName = team and getTeamName ( team ) or "" if ( teamName == "Staff" ) then setElementData(source,"admin",true) else setElementData(source,"admin",false) end end addEventHandler("onPlayerChangeTeam",root,admin)
-
If you're talking about created objects then this will loop through all the objects with model == 2754: for index, element in pairs(getElementsByType("object")) do if (getElementModel(element) == 2754) then --Do smth end end
-
It doesn't have to be inside the create gui function. The only reason it doesn't work is that it's executed before the functions are even declared.
-
Post the current code that you have.
-
It doesn't "read" the file, it only returns the root node that you can use with the other functions.
-
This is why I separated my answer, so that you don't get confused, I guess it didn't help. Now 'source' will not refer to the player, you need to use 'client'. If what you posted is your current client code then this should work: function exchangeOption1() local playerCoins = tonumber(getPlayerCoins(client)) if (playerCoins > 99) then givePlayerMoney(client, 1) takePlayerCoins(client, 100) else outputChatBox("You don't have enough coins!", client, 255, 255, 0) end end addEvent("exchangeOption1", true) addEventHandler("exchangeOption1", getRootElement(), exchangeOption1)
-
My bad, I forgot to remove the parameter. Try this: function exchangeOption1() local playerCoins = tonumber(getPlayerCoins(source)) if (playerCoins > 99) then givePlayerMoney(source, 1) takePlayerCoins(source, 100) else outputChatBox("You don't have enough coins!", source, 255, 255, 0) end end addEvent("exchangeOption1", true) addEventHandler("exchangeOption1", getRootElement(), exchangeOption1)
-
Don't show seconds, you'll have to update element data each second for every player in the server, so useless yet so costly. You already have hours and minutes, just construct a string out of them.
-
Probably not. And this is not a correct way to ask question here, read this please: viewtopic.php?f=91&t=47897
-
You never send a player argument, you just specify it as a source element. function exchangeOption1() local playerCoins = tonumber(getPlayerCoins(source)) if (playerCoins > 99) then givePlayerMoney(source, 1) takePlayerCoins(source, 100) else outputChatBox("You don't have enough coins!", source, 255, 255, 0) end end addEvent("exchangeOption1", true) addEventHandler("exchangeOption1", getRootElement(), exchangeOption1) This should fix your current problem. However, it's vulnerable to event faking. You should replace thePlayer from triggerServerEvent with root, and then use 'client' on the server. Read more here: https://wiki.multitheftauto.com/wiki/TriggerServerEvent
-
If http://localhost redirects you to xampp's home page then it's working.
-
This looks promising. You might wanna provide documentation on how to contribute, the structure and how the code is laid out. This will surely invite contributors. Good luck! On topic, this debate is purely opinion based, most players will just mention the server they play on even though they never tried anything else.
