Give rewards to player below certain account id

Harmony

New member
Messages
32
Points
0
Hello! I want to give players who registered early a reward but the problem is I don't know how to include sql database in my scripts. Can someone help me out with this? 

 

 
if you only want to compare account ID then there is no need to use SQL at all

if (!(#REG_REWARD & (1 << 0)) && getcharid(CHAR_ID_ACCOUNT) < 3000000) {
getitem(TIER_1_ITEM, 1);
#REG_REWARD |= 1 << 0;
}

if (!(#REG_REWARD & (1 << 1)) && getcharid(CHAR_ID_ACCOUNT) < 2800000) {
getitem(TIER_2_ITEM, 1);
#REG_REWARD |= 1 << 1;
}

if (!(#REG_REWARD & (1 << 2)) && getcharid(CHAR_ID_ACCOUNT) < 2500000) {
getitem(TIER_3_ITEM, 1);
#REG_REWARD |= 1 << 2;
}

if (!(#REG_REWARD & (1 << 3)) && getcharid(CHAR_ID_ACCOUNT) < 2200000) {
getitem(TIER_4_ITEM, 1);
#REG_REWARD |= 1 << 3;
}

if (!(#REG_REWARD & (1 << 4)) && getcharid(CHAR_ID_ACCOUNT) < 2050000) {
getitem(TIER_5_ITEM, 1);
#REG_REWARD |= 1 << 4;
}

if (!(#REG_REWARD & (1 << 5)) && getcharid(CHAR_ID_ACCOUNT) < 2005000) {
getitem(TIER_6_ITEM, 1);
#REG_REWARD |= 1 << 5;
}

if (!(#REG_REWARD & (1 << 6)) && getcharid(CHAR_ID_ACCOUNT) < 2001000) {
getitem(TIER_7_ITEM, 1);
#REG_REWARD |= 1 << 6;
}

if (!(#REG_REWARD & (1 << 7)) && getcharid(CHAR_ID_ACCOUNT) < 2000300) {
getitem(TIER_8_ITEM, 1);
#REG_REWARD |= 1 << 7;
}




Just change TIER_X_ITEM to whatever item you want to give. This script uses the first 8 bits (1 byte) of the #REG_REWARD integer variable so you can use the last 3 bytes to store other data if you wish.

 
Last edited by a moderator:
Back
Top