Everything works fine, but the upgrades are saved only after disconnect/retry. You forgot to add the load/save functions on connect/disconnect, so I'm not sure if I added them the right way:
PHP Code:
public client_connect(id)
{
LoadData(id)
get_user_authid(id , g_szAuthID[id] , charsmax(g_szAuthID[]))
}
public client_disconnect(id)
SaveData(id)
PS: Am I using these correctly:
1. Add all upgrades to the menu:
PHP Code:
for(new i = 0; i < sizeof(g_Upgrades); i++)
{
iPrice = g_Upgrades[UpgradeTypes:i][iValue]
formatex(szKey, charsmax(szKey), "%i", i)
formatex(szItem, charsmax(szItem), "%s%s \r[\y%i Alien Cells\r]", PlayerHasUpgrade(id , UpgradeTypes:i) ? "\y" : furien_get_aliencells(id) >= iPrice ? "\w" : "\d", g_Upgrades[UpgradeTypes:i][szDescription], iPrice)
menu_additem(upgrademenu, szItem, szKey, 0)
}
2. The message:
PHP Code:
formatex(szMsg, charsmax(szMsg), "%s %s", g_szPrefix, g_Upgrades[UpgradeTypes:iKey][szMessage])
I will also need a native to check whether a player has an upgrade, so I made this, but it doesn't work:
PHP Code:
public _furien_get_upgrade(id, iUpgrade)
return PlayerHasUpgrade(id , UpgradeTypes:iUpgrade)
//Edit: I figured out the native part.