What is wrong with this code?

kukayasko

New member
Messages
44
Points
0
-    script    hourlypoints    FAKE_NPC,{
OnPCLoginEvent:    
if (getgmlevel() == 99){
initnpctimer;
end;
}

OnTimer1000:
    getitem 20172,1;
    stopnpctimer;
    end;
    
OnPCLogoutEvent:
stopnpctimer;
}
 
Last edited by a moderator:
firstly, you should describe what you are trying to achieve in the future when seeking support.

When OnTimer is triggered, there is no player attached, so its trying to getitem without player attached.
better to use addtimer/deltimer for this function

also you dont need to stop the timer when they logout, since the data gets erased at that point anyway

 
Alright.

Im trying to make a hourly reward.

Sorry, lost what I had described when edited this topic.

So how I attache a player to this code? Thought that just "get item" will be enough

 
You are using the wrong timer command.

*addtimer(<ticks>, "NPC::OnLabel")
*deltimer("NPC::OnLabel")
*addtimercount("NPC::OnLabel", <ticks>)

These commands will create, destroy, and delay a countdown timer - 
addtimer() to create, deltimer() to destroy and addtimercount() to delay
it by the specified number of ticks. For all three cases, the event label 
given is the identifier of that timer. The timer runs on the character 
object that is attached to the script, and can have multiple instances. 
When the label is run, it is run as if the player that the timer runs on 
has clicked the NPC.

 
Back
Top