iPrestege Posted December 25, 2012 Posted December 25, 2012 Hi All , How Are You ? Fine ? Hmm .. i want to create script but what should to use ? i want to create a script if player in "team" if player wasted set player in coustom pos ...
Anderl Posted December 25, 2012 Posted December 25, 2012 Notepad or any software for writing in Lua and Lua knowledge is what you need.
iPrestege Posted December 25, 2012 Author Posted December 25, 2012 @ Anderl Hmmm i dont know what should i use to create the script can you help me and tell me what should to use thanks .
TAPL Posted December 25, 2012 Posted December 25, 2012 Event: "onPlayerWasted" getPlayerTeam getTeamName spawnPlayer
iPrestege Posted December 25, 2012 Author Posted December 25, 2012 function Grove ( source ) local team = getTeamName ( source ) local Grove = getPlayerTeam ( source ) if ( Grove ) then spawnPlayer (source, x,y,z Grove) end end addEventHandler ( "onPlayerWasted", getRootElement(), Grove ) Right ?
Anderl Posted December 25, 2012 Posted December 25, 2012 function Grove ( source ) local team = getTeamName ( source ) local Grove = getPlayerTeam ( source ) if ( Grove ) then spawnPlayer (source, x,y,z Grove) end end addEventHandler ( "onPlayerWasted", getRootElement(), Grove ) Right ? No, you have three errors: 1. There's no "source" parameter, source is a predefined variable in the function and it points to the player who died. 2. You didn't check the team name and the "team" and "Grove" variables make totally no sense. 3. Where is "x", "y" and "z" defined? And what's that "Grove" after "z"?
iPrestege Posted December 25, 2012 Author Posted December 25, 2012 function Grove ( source ) local team = getTeamName ( source ) local Grove = getPlayerTeam ( source ) if ( Grove ) then spawnPlayer (source, x,y,z Grove) end end addEventHandler ( "onPlayerWasted", getRootElement(), Grove ) Right ? No, you have three errors: 1. There's no "source" parameter, source is a predefined variable in the function and it points to the player who died. 2. You didn't check the team name and the "team" and "Grove" variables make totally no sense. 3. Where is "x", "y" and "z" defined? And what's that "Grove" after "z"? 1- i read the wiki quick .. 2- i will fix it 3- i saw the example in the wiki like that -_-" And grove = My Team ..
Anderl Posted December 25, 2012 Posted December 25, 2012 (edited) function Grove ( source ) local team = getTeamName ( source ) local Grove = getPlayerTeam ( source ) if ( Grove ) then spawnPlayer (source, x,y,z Grove) end end addEventHandler ( "onPlayerWasted", getRootElement(), Grove ) Right ? No, you have three errors: 1. There's no "source" parameter, source is a predefined variable in the function and it points to the player who died. 2. You didn't check the team name and the "team" and "Grove" variables make totally no sense. 3. Where is "x", "y" and "z" defined? And what's that "Grove" after "z"? 1- i read the wiki quick .. 2- i will fix it 3- i saw the example in the wiki like that -_-" And grove = My Team .. About the 3 - You forgot the "," then. The code should be like this: local g_szTeam = "YOUR_TEAM_NAME"; local g_pPosition = { 0, 0, 0 }; addEventHandler( "onPlayerWasted", root, function( ) local pTeam = getPlayerTeam( source ); if ( pTeam and getTeamName( pTeam ) == g_szTeam ) then spawnPlayer( source, unpack( g_pPosition ) ); setPlayerTeam( source, pTeam ); end end ) Edited December 25, 2012 by Guest
iPrestege Posted December 25, 2012 Author Posted December 25, 2012 @ Anderl @ TAPL Thanks Anderl i will try it and back soon .. Thanks TAPL .
Anderl Posted December 25, 2012 Posted December 25, 2012 Don't forget to change positions and team name in global variables at the top of the script.
iPrestege Posted December 25, 2012 Author Posted December 25, 2012 Don't forget to change positions and team name in global variables at the top of the script. Yes, of course I'will change the team .
iPrestege Posted December 26, 2012 Author Posted December 26, 2012 But there is a problem! i use Play GameMode but when a player Wasted player goes into pos in the code, but go to the exact location in the Play GameMode also . i add some code to anderl code : local g_szTeam = "Police"; local g_pPosition = { -1858.80212, -1612.50281, 21.76415 }; addEventHandler( "onPlayerWasted", root, function( ) local pTeam = getPlayerTeam( source ); if ( pTeam and getTeamName( pTeam ) == g_szTeam ) then spawnPlayer( source, unpack( g_pPosition ) ); setPlayerTeam( source, pTeam ); giveWeapon ( source , 16, 1 ) giveWeapon ( source , 31, 100 ) giveWeapon ( source , 24, 100 ) setPedSkin ( source, 285 ) end end )
TAPL Posted December 26, 2012 Posted December 26, 2012 1- There no need for multiple posts, use edit button. 2- You need to stop resource "play" or edit it. Btw, read the note at the wiki: https://wiki.multitheftauto.com/wiki/SpawnPlayer
iPrestege Posted December 26, 2012 Author Posted December 26, 2012 1- There no need for multiple posts, use edit button.2- You need to stop resource "play" or edit it. Btw, read the note at the wiki: https://wiki.multitheftauto.com/wiki/SpawnPlayer 1- ok Am sorry . 2- thanks ,
AhmadQTR Posted December 26, 2012 Posted December 26, 2012 Read the rules. viewtopic.php?f=91&t=15740
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now