DiGiTal Posted June 21, 2017 Share Posted June 21, 2017 (edited) Hi, i've upload one skin for my premuim members, explaine;if he see as a premuim player, he will got the skin 150, if not all will get skin 200) ERROR: [13:53:37] Starting userpanel [13:53:37] SCRIPT ERROR: userpanel\c_server.lua:2322: unexpected symbol near 'then' [13:53:37] ERROR: Loading script failed: userpanel\c_server.lua:2322: unexpected symbol near 'then' [13:53:39] userpanel restarted successfully function skindonator(thePlayer) if isGuestAccount(account) then return end if getAccountData(account,"donatorEnabled") == 1 then setElementModel(thePlayer, 150 ) then outputChatBox ("Enjoy your premuim skin") else setElementModel(thePlayer, 189 ) end end addEventHandler("onPlayerLogin",getRootElement(),skindonator) thx Edited June 21, 2017 by Ridden Link to comment
DiGiTal Posted June 21, 2017 Author Share Posted June 21, 2017 3 minutes ago, Deeze said: Remove the "then" on line 5 @Deeze can you please explaine me why? Link to comment
Deeze Posted June 21, 2017 Share Posted June 21, 2017 (edited) 7 minutes ago, Ridden said: @Deeze can you please explaine me why? Sure thing! "then" in LUA is only used in conjuction with an if-statement. An if-statement works like this: local apples = 5 if (apples == 5) then outputChatBox("I have 5 apples!") outputChatBox("And i really love them!") end As you can see, we simply set a variable called 'apples' to the value of 5 and then, in our if statement, we simply check if the value of apples is equal to 5, and if it is, we execute the code between "then" and "end" (the two outputChatBox function calls). We do not need to write "then" between the two outputChatBox's because that is not how LUA syntax works. You could check the MTA/LUA wiki for better explanation if my explanation wasn't clear enough Edited June 21, 2017 by Deeze 1 Link to comment
S3Nn4oX Posted June 21, 2017 Share Posted June 21, 2017 (edited) function skindonator(thePlayer) local account = getPlayerAccount (thePlayer) if isGuestAccount(account) then return end if getAccountData(account,"donatorEnabled") == 1 then setElementModel(thePlayer, 150 ) outputChatBox ("Enjoy your premuim skin") else setElementModel(thePlayer, 189 ) end end end addEventHandler("onPlayerLogin",getRootElement(),skindonator) You forgot to define theplayer account Edited June 21, 2017 by S3Nn4oX 1 Link to comment
DiGiTal Posted June 21, 2017 Author Share Posted June 21, 2017 function skindonator(thePlayer) local account = getPlayerAccount (thePlayer) if isGuestAccount(account) then return end if getAccountData(account,"donatorEnabled") == 1 then setElementModel(thePlayer, 150 ) outputChatBox ("Enjoy your premuim skin") else setElementModel(thePlayer, 189 ) end end addEventHandler("onPlayerLogin",getRootElement(),skindonator) you have added one "end" :p, anyway thx for who posted . Link to comment
Slim Posted June 28, 2017 Share Posted June 28, 2017 Funny you add this 1 day after we released ours. 1 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