- script Sample FAKE_NPC,{
OnInit:
detachrid();
.cdtime = 24*60*60;
for (set .accid, 2000009; .accid<=2000030 ; .accid++)
end;
OnPCLoginEvent:
attachrid(.accid);
if (#gotone + .cdtime> gettimetick(2)) {
dispbottom "Daily reward have been distributed";
end;
}
else {
dispbottom "An apple a day takes the doctor away.";
getitem Apple,20;
#gotone = gettimetick(2);
end;
}
}
Thanks for trying to help the OP. However, this script isn’t written correctly.Code:- script Sample FAKE_NPC,{ OnInit: detachrid(); .cdtime = 24*60*60; for (set .accid, 2000009; .accid<=2000030 ; .accid++) end; OnPCLoginEvent: attachrid(.accid); if (#gotone + .cdtime> gettimetick(2)) { dispbottom "Daily reward have been distributed"; end; } else { dispbottom "An apple a day takes the doctor away."; getitem Apple,20; #gotone = gettimetick(2); end; } }
how about random account id's?- script Sample FAKE_NPC,{
OnInit:
detachrid();
.cdtime = 24*60*60;
for (set .accid, 2000009; .accid<=2000030 ; .accid++)
end;
OnPCLoginEvent:
attachrid(.accid);
if (#gotone + .cdtime> gettimetick(2)) {
dispbottom "Daily reward have been distributed";
end;
}
else {
dispbottom "An apple a day takes the doctor away.";
getitem Apple,20;
#gotone = gettimetick(2);
end;
}
}
Code:- script Sample FAKE_NPC,{ OnInit: detachrid(); .cdtime = 24*60*60; for (set .accid, 2000009; .accid<=2000030 ; .accid++) end; OnPCLoginEvent: attachrid(.accid); if (#gotone + .cdtime> gettimetick(2)) { dispbottom "Daily reward have been distributed"; end; } else { dispbottom "An apple a day takes the doctor away."; getitem Apple,20; #gotone = gettimetick(2); end; } }
how about random account id's?
and if its possible it is also a random item to the random players that will be rewarded.
getitem Apple, 20, rand(2000009, 2000030);
Thanks for this Sir, Can u share the correct one? The one that will work. Newbie here. Thanks for the help in advance!Thanks for trying to help the OP. However, this script isn’t written correctly.
The OnInit label inherently does not have an attached RID, using detachrid() is pointless.
You then use a for loop without any defined action: syntax for(index set; condition; increment) { action }
Note that you are missing the action portion of the for loop.
The OnPCLoginEvent label inherently DOES have an RID attached (namely, the player that just logged in). There is no need to use attachrid here.
If you were to fix all of the issues I listed above, your script would distribute the items to all accounts as you have not implemented any check to ensure the account ID is within the specified range described by the OP.
We use essential cookies to make this site work, and optional cookies to enhance your experience.