Jump to content

why doesnt this work ?


destunter

Recommended Posts

Posted
<"script />
 
addEventHandler("onPlayerJoin", getRootElement(),
function ()
	local x = 1959.55
	local y = -1714.46
	local z = 10
	local pname = GetPlayerName( source )
	spawnPlayer(source, x, y, z)
	fadeCamera(source, true)
	setCameraTarget(source, source)
	outputChatBox("Welcome to Gaalaxy Stunting", source)
	outputChatBox ( pname.. "++ Has joined Galaxy Stunting!" )
	setElementData( source, "deaths", 0 );
    setElementData( source, "kills", 0 );
end
)
 
-- Events
 
addEventHandler("onPlayerWasted",getRootElement(),
function (totalAmmo, killer, killerWeapon, bodypart)
   local pname = getPlayerName( source )
   local pname2 = getPlayerName( killer )
   outputChatBox(pname2.. " has Killed " ..pname)
   setElementData( source, "deaths", getElementData( source, "deaths" ) + 1 );
   setElementData( killer, "kills", getElementData( killer, "kills" ) + 1 );
end
)
 
-- Commands
 
addCommandHandler( "stats",
   function( plr )
      outputChatBox( "Your current stats:  " .. getElementData( plr, "kills" ) .. "/" .. getElementData( plr, "deaths" ), plr );
      outputChatBox( "Kills:  " .. getElementData( plr, "kills" ), plr );
      outputChatBox( "Deaths:  ".. getElementData( plr, "deaths" ), plr );
   end
)
 
addCommandHandler ( "killme",
function ( plr )
	local pname = GetPlayerName( plr )
	SetPlayerHealth( plr, 0 )
	outputChatBox( pname.. "Has Killed Himself")
end
)

ok this is my whole lua script. i am using the MTA Script Editor. so when i start the server and it loads the script but it doesn't because none of this is working and its loading vehicles and other stuff i never added D=

can someone please help me

Posted

you see broken colors on your code?

what did you do actually?

you have to put your code in separate files, then add them to meta.xml

you wanted to add it like in HTML or something..

read about meta.xml and basics of scripting on the https://wiki.multitheftauto.com/

Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online!

programista php rzeszów

Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting.

Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!

Posted
I will not tell you the same thing multiple times but GetPlayerName does NOT exist, there is getPlayerName...

Forget about SA-MP. ALL MTA's function names start with lower case letters.

Yea, I come from samp to so I'm used to the pawn functions. I've had a couple of issues because of this lower case allready :P

Posted

ok i fixed the getPlayerName but i am still not seeing my server and idk how to get any of this working

i start mta server then i join it but i see stuff i never added and the commands do not work i attached the meta.xml and script.lua to this post

Posted

start your resource?

Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online!

programista php rzeszów

Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting.

Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...