AE. Posted September 11, 2016 Share Posted September 11, 2016 addEventHandler("onPlayerLogin", root, function(_, account) if not getAccountData(account, "FirstTime") then outputChatBox("You're playing for the first time!", source, 0, 255, 0) startResource ( skinnew ) setElementPosition ( source, 1254.50049, -790.40015, 92.03018 ) setAccountData(account, "FirstTime", true) else outputChatBox("This is not the first time for you!", source, 255, 0, 0) end end) it do every thing right and working but the resource won't start and i added the script on admin group in the acl .. still don't work Link to comment
aka Blue Posted September 11, 2016 Share Posted September 11, 2016 ¿Why you need to start a resource every time that a player has logged in? Link to comment
draobrehtom Posted September 11, 2016 Share Posted September 11, 2016 For a starting resource from another resource, you need to set a permission for you resource "startResource" "true" in acl.xml. Link to comment
AE. Posted September 11, 2016 Author Share Posted September 11, 2016 3 minutes ago, aka Blue said: ¿Why you need to start a resource every time that a player has logged in? it's just if the player logged in for the first time 1 minute ago, draobrehtom said: For a starting resource from another resource, you need to set a permission for you resource "startResource" "true" in acl.xml. i already add the script in console so .. i'am sure that console can startResource Link to comment
draobrehtom Posted September 11, 2016 Share Posted September 11, 2016 2 minutes ago, 3laa33 said: it's just if the player logged in for the first time i already add the script in console so .. i'am sure that console can startResource But you need to log in with Console permission too, I think. Link to comment
AE. Posted September 11, 2016 Author Share Posted September 11, 2016 Just now, draobrehtom said: But you need to log in with Console permission too, I think. why the fuck? then i have to give every player login in server console? Link to comment
aka Blue Posted September 11, 2016 Share Posted September 11, 2016 Well, add this in your resource meta: <aclrequest> <right name="function.startResource" access="true" /> </aclrequest> After execute: aclrequest allow resource_name all 1 Link to comment
draobrehtom Posted September 11, 2016 Share Posted September 11, 2016 (edited) 4 minutes ago, 3laa33 said: why the fuck? then i have to give every player login in server console? It's for a security reason and more easily structure of acl (grouping rights and types of the rights, you need to read about it on the Wiki - acl.xml article). Edited September 11, 2016 by draobrehtom Link to comment
AE. Posted September 11, 2016 Author Share Posted September 11, 2016 4 minutes ago, aka Blue said: Well, add this in your resource meta: <aclrequest> <right name="function.startResource" access="true" /> </aclrequest> After execute: aclrequest allow resource_name all didn't work bad argument @ 'startResource' [Expected resource-data at argument 1, got nil] maybe this help Link to comment
aka Blue Posted September 11, 2016 Share Posted September 11, 2016 Try this: addEventHandler( "onPlayerLogin", root, function( ) local account = getPlayerAccount( source ) if ( account ) then if ( not isGuestAccount( account ) ) then if ( getAccountData( account, "FirstTime" ) ) then outputChatBox("You're playing for the first time!", source, 0, 255, 0) startResource ( skinnew ) setElementPosition ( source, 1254.50049, -790.40015, 92.03018 ) setAccountData(account, "FirstTime", true) else outputChatBox("This is not the first time for you!", source, 255, 0, 0) end end end end ) And do what i post, cleaning the acl.xml Link to comment
draobrehtom Posted September 11, 2016 Share Posted September 11, 2016 (edited) Test this example with added aclrequest to meta.xml and give us results, please: function startTheResource ( thePlayer, command, resourceName ) if ( resourceName ) then -- Check if they specified a resource name local resource = getResourceFromName ( resourceName ) -- Get the resource local start = startResource ( resource ) -- Start the resource if ( start ) then -- If it was successfully started... outputChatBox ( resourceName .. " was started successfully.", thePlayer, 255, 0, 0 ) else -- If it wasn't successfully started... outputChatBox ( "This resource doesn't exist.", thePlayer, 255, 0, 0 ) end else -- If they didn't put a resource name... outputChatBox ( "Please specify a resource to start.", thePlayer, 255, 0, 0 ) end end addCommandHandler ( "resource-start", startTheResource ) -- Make it trigger when somebody types "/resource-start" Edited September 11, 2016 by draobrehtom Link to comment
AE. Posted September 11, 2016 Author Share Posted September 11, 2016 2 minutes ago, aka Blue said: Try this: addEventHandler( "onPlayerLogin", root, function( ) local account = getPlayerAccount( source ) if ( account ) then if ( not isGuestAccount( account ) ) then if ( getAccountData( account, "FirstTime" ) ) then outputChatBox("You're playing for the first time!", source, 0, 255, 0) startResource ( skinnew ) setElementPosition ( source, 1254.50049, -790.40015, 92.03018 ) setAccountData(account, "FirstTime", true) else outputChatBox("This is not the first time for you!", source, 255, 0, 0) end end end end ) And do what i post, cleaning the acl.xml i didn't get it, cleaning the acl ? why Link to comment
draobrehtom Posted September 11, 2016 Share Posted September 11, 2016 9 minutes ago, 3laa33 said: didn't work bad argument @ 'startResource' [Expected resource-data at argument 1, got nil] maybe this help Firstly, get the resource from name by getResourceFromName ( resourceName ) Link to comment
AE. Posted September 11, 2016 Author Share Posted September 11, 2016 1 minute ago, 3laa33 said: i didn't get it, cleaning the acl ? why i did it but whenever i make new account it says 'this is not the first time' ... Link to comment
draobrehtom Posted September 11, 2016 Share Posted September 11, 2016 (edited) 2 minutes ago, 3laa33 said: i did it but whenever i make new account it says 'this is not the first time' ... It is because you have already account data on the guest account in database mta. Edited September 11, 2016 by draobrehtom Link to comment
AE. Posted September 11, 2016 Author Share Posted September 11, 2016 this is mindfuck ! 2 minutes ago, draobrehtom said: It is because you have already account data on the guest account in database mta. so how i make sure it work for the new players >>?? Link to comment
draobrehtom Posted September 11, 2016 Share Posted September 11, 2016 3 minutes ago, 3laa33 said: this is mindfuck ! so how i make sure it work for the new players >>?? I'm sorry for this, I was wrong: ` Quote ]Data stored in a guest account is not stored after the player has left the server. As a consequence, this function will check if a player is logged in or not. Try this, It was edited: addEventHandler( "onPlayerLogin", root, function( ) local account = getPlayerAccount( source ) if ( account ) then if ( not isGuestAccount( account ) ) then if ( not getAccountData( account, "FirstTime" ) ) then outputChatBox("You're playing for the first time!", source, 0, 255, 0) startResource ( skinnew ) setElementPosition ( source, 1254.50049, -790.40015, 92.03018 ) setAccountData(account, "FirstTime", true) else outputChatBox("This is not the first time for you!", source, 255, 0, 0) end end end end ) Link to comment
AE. Posted September 11, 2016 Author Share Posted September 11, 2016 7 minutes ago, draobrehtom said: I'm sorry for this, I was wrong: ` Try this, It was edited: addEventHandler( "onPlayerLogin", root, function( ) local account = getPlayerAccount( source ) if ( account ) then if ( not isGuestAccount( account ) ) then if ( not getAccountData( account, "FirstTime" ) ) then outputChatBox("You're playing for the first time!", source, 0, 255, 0) startResource ( skinnew ) setElementPosition ( source, 1254.50049, -790.40015, 92.03018 ) setAccountData(account, "FirstTime", true) else outputChatBox("This is not the first time for you!", source, 255, 0, 0) end end end end ) still don't start the resource .. Link to comment
draobrehtom Posted September 11, 2016 Share Posted September 11, 2016 Just now, 3laa33 said: still don't start the resource .. Every time if you get error in scripting, you need to tell us, which error are you have or in which statements you are getting this error. Because I even don't know have you a logic error or something else. Link to comment
AE. Posted September 11, 2016 Author Share Posted September 11, 2016 it warp me and it do every thing but still the resource = "skinnew" don't start this replace skin 23 with anthor skin and i'am still getting debugbad argument @ 'startResource' [Expected resource-data at argument 1, got nil] Link to comment
draobrehtom Posted September 11, 2016 Share Posted September 11, 2016 (edited) 2 minutes ago, 3laa33 said: it warp me and it do every thing but still the resource = "skinnew" don't start this replace skin 23 with anthor skin and i'am still getting debugbad argument @ 'startResource' [Expected resource-data at argument 1, got nil] Can you post all code with the part getResourceFromName and also give a names of your two resources? Maybe it's a typo error, you know. Edited September 11, 2016 by draobrehtom Link to comment
John Smith Posted September 11, 2016 Share Posted September 11, 2016 (edited) Jesus... replace startResource ( skinnew ) with startResource(getResourceFromName("skinnew")) Edited September 11, 2016 by John Smith 1 Link to comment
AE. Posted September 11, 2016 Author Share Posted September 11, 2016 1 minute ago, John Smith said: Jesus do you guys even know how to script? replace startResource ( skinnew ) with startResource(getResourceFromName("skinnew")) sorry master of programming it's working Link to comment
John Smith Posted September 11, 2016 Share Posted September 11, 2016 Glad to hear that ^^ Link to comment
AE. Posted September 11, 2016 Author Share Posted September 11, 2016 1 minute ago, John Smith said: Glad to hear that ^^ there's another thing master ... can i make the resource start for one player .? well looks like the master don't know ... Link to comment
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