• This is a read only backup of the old Emudevs forum. If you want to have anything removed, please message me on Discord: KittyKaev

Something's wrong with my player script

Status
Not open for further replies.

Zadax

Enthusiast
Good morning/afternoon/night, sirs. I'm sorry to bother you with another thread that might just be caused because I'm doing something wrong, but, well, this's the problem:

I created this script:
Code:
print "Loading Languages"
function Languages (player, event)
    player:GetTeam();
    if GetTeam() == 0 then
         player:LearnSpell(669);
         player:LearnSpell(668);
    elseif GetTeam() == 1 then
         player:LearnSpell(668);
         player:LearnSpell(668);
    else
    end
end

RegisterServerHook (3, Languages)

I even tested it on a LUA engine to check if there was any error (0 errors found), but, after I added it and tried to use it, my worldserver doesnt share my opinion, and it just says "TC> scripts\Languages.lua:3: attempt to index local 'player' (a number value)". I dont really know what does that error mean, but, if any of you know the reason of why my script doesnt work, I'd be pleased to learn how to fix it
 
Last edited by a moderator:

Tommy

Founder
I put your code in the code tags so I could see it better. Also, commenting on you bothering us: You aren't bothering anyone, you can post anything you'd like if you're having issues with it, don't be embarrassed. :D

About your code, you're using the OnLogin hook I see, but you aren't using the arguments correctly. Instead of:

Code:
(player, event)

It should be: (In lime green)

Code:
print "Loading Languages"
function Languages [COLOR=#00ff00](event, player)[/COLOR]
    player:GetTeam();
    if GetTeam() == 0 then
         player:LearnSpell(669);
         player:LearnSpell(668);
    elseif GetTeam() == 1 then
         player:LearnSpell(668);
         player:LearnSpell(668);
    else
    end
end

RegisterServerHook (3, Languages)

For further advice, you can look at the wiki on server hooks here (http://wiki.emudevs.com/doku.php?id=eluna_hooks_registerserverhook). On the side, you will see the correct arguments for the hook.
 
Status
Not open for further replies.
Top