Jump to content

why doesnt this work ?


destunter

Recommended Posts

<"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

Link to comment
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

Link to comment

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

Link to comment

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...