Jump to content

Cant solve out an error


Recommended Posts

Posted

I get these errors:

Bad argument @ getPlayerAccount

Bad argument @ isGuestAccount

when executing this:

local account = getPlayerAccount(source)
if isGuestAccount(account) then

i checked the script 10 times but sitll cant figure it out. Please help.

Posted

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?

Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online!

programista php rzeszów

Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting.

Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!

Posted

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)

Posted

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/

Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online!

programista php rzeszów

Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting.

Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!

Posted

MaddDogg notice he is running this funcion also on onPlayerJoin handler o_O

Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online!

programista php rzeszów

Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting.

Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!

Posted

This script is still in the debugging stage. I'm trying to make it better, i started making it today.

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

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

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

Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online!

programista php rzeszów

Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting.

Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!

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