Jump to content

Cant solve out an error


Recommended Posts

post full script dude!

all i can say seeing these lines:

- you are giving bad argument when using getPlayerAccount (source == bad argument)

- you are giving bad argument when using isGuestAccount (account == bad argument)

but..

its same as:

Bad argument @ getPlayerAccount

Bad argument @ isGuestAccount

isnt it?

Link to comment

Well, here is the full script, as you wanted:

function triggerTimer()
setTimer(makeAccount, 2000, 1)
end
addEventHandler("onPlayerJoin", getRootElement(), triggerTimer)
 
function makeAccount()
local account = getPlayerAccount(source)
if isGuestAccount(account) then
addAccount(getPlayerName(source), getPlayerName(source))
outputChatBox("Your account has been created!", source, 0, 255, 0)
end
end
addCommandHandler("makeaccountforme", makeAccount)

Link to comment

btw: are you sure you blocked "register" "login" and "logout" in ACL?

if not - your script is extremly easy to hack and login as other user...

oh well.. its still easy - just changing nickname..

whatever..

only script fix, not logical fix, cause your logic is totally broken

function triggerTimer()
setTimer(makeAccount, 2000, 1. source)
end
addEventHandler("onPlayerJoin", getRootElement(), triggerTimer)
 
function makeAccount(playerSource)
local account = getPlayerAccount(playerSource)
if (account) then
if isGuestAccount(account) then
addAccount(getPlayerName(playerSource), getPlayerName(playerSource))
outputChatBox("Your account has been created!", source, 0, 255, 0)
end
else
addAccount(getPlayerName(playerSource), getPlayerName(playerSource))
outputChatBox("Your account has been created!", source, 0, 255, 0)
end
end
addCommandHandler("makeaccountforme", makeAccount)

and suggestion:

spend some time on reading wiki, and learning lua, not just merging random code snippets from somewhere - this will bring you nowhere..

https://wiki.multitheftauto.com/wiki/Scripting_Introduction

https://wiki.multitheftauto.com/wiki/Debugging

https://wiki.multitheftauto.com/wiki/Resources

https://wiki.multitheftauto.com/wiki/Client_Scripting_Functions

https://wiki.multitheftauto.com/wiki/Server_Scripting_Functions

https://wiki.multitheftauto.com/wiki/Client_Scripting_Events

https://wiki.multitheftauto.com/wiki/Server_Scripting_Events

or just

https://wiki.multitheftauto.com/

Link to comment
EDIT: The meaning of this script is to make an account if the joined player doesnt have one.

creating it with same password as username is at least stupid..

creating accounts based on nickname too..

I'm also using the MTA default auto-login thing.

autologin is based on serial, your script on nickname..

i dont know much about autologin but.. isnt it creating accounts automatically?

I'll upload my auto-registering and auto-logging script to community.

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