12.07.2009, 17:05
I have created mysql based Register/Login and i'm using enum to store the information about the player.. And there is a strange bug with enum or smth.... When i assign my values to enum ....... code examples:
everything works fine this way, but if i try to assign the value to array like that :
i get an error:
I didin't needed to do this when i did the system on seperate arrays, not on enum.
I can't compare them like:
returns me an error about array sizes..
So what should i do so that my life become easier and i can use them simply as normal array, or give me an advice how to use enum...
------------------------------------------------------------------------------------------------------
Also another question is, what's wrong here:
Timer is set OnGameModeInit, but it doesn't return me any message, either true or false one... Is the code valid?
Код:
enum player_info { id, nickname[MAX_PLAYER_NAME], password[32], ipaddress[16], level[1], oskin[3], jskin[3], job[20], cmoney[9], bmoney[10], gender[6], blocked[1], blockedr[30] };
Код:
new playerinfo[MAX_PLAYERS][player_info]; new playerinfoquery[256]; new getplayerinfo[12][128]; GetPlayerName(playerid, playerinfo[playerid][nickname], MAX_PLAYER_NAME); format(playerinfoquery, sizeof(playerinfoquery), "SELECT id,password,ipaddress,level,oskin,jskin,job,cmoney,bmoney,gender,blocked,blockedr FROM `users` WHERE `nickname` = '%s' LIMIT 1", playerinfo[playerid][nickname]); samp_mysql_query(playerinfoquery); samp_mysql_store_result(); if (samp_mysql_num_rows() == 1) { samp_mysql_fetch_row(playerinfoquery); split(playerinfoquery, getplayerinfo, '|'); playerinfo[playerid][id] = strval(getplayerinfo[0]); playerinfo[playerid][password] = strval(getplayerinfo[1]); playerinfo[playerid][ipaddress] = strval(getplayerinfo[2]); playerinfo[playerid][level] = strval(getplayerinfo[3]); playerinfo[playerid][oskin] = strval(getplayerinfo[4]); playerinfo[playerid][jskin] = strval(getplayerinfo[5]); playerinfo[playerid][job] = strval(getplayerinfo[6]); playerinfo[playerid][cmoney] = strval(getplayerinfo[7]); playerinfo[playerid][bmoney] = strval(getplayerinfo[8]); playerinfo[playerid][gender] = strval(getplayerinfo[9]); playerinfo[playerid][blocked] = strval(getplayerinfo[10]); playerinfo[playerid][blockedr] = strval(getplayerinfo[11]);
Код:
playerinfo[playerid][blocked] = getplayerinfo[10];
Код:
C:\Kita\Deivido\Samp\Naujas\gamemodes\ruined.pwn(627) : error 047: array sizes do not match, or destination array is too small
I can't compare them like:
Код:
if (playerinfo[playerid][job] == 'Smth') {
So what should i do so that my life become easier and i can use them simply as normal array, or give me an advice how to use enum...
------------------------------------------------------------------------------------------------------
Also another question is, what's wrong here:
Код:
public isPlayerInLeaveCityZone() { new Float:x, Float:y, Float:z; for (players=0; players < MAX_PLAYERS; players++) { GetPlayerPos(players, x, y, z); if (x <= 2128.6323 && x >= 2125.6035 && y <= 46.8678 && y >= 36.4518) { new warningmessage[128]; format (warningmessage, sizeof(warningmessage), "Tau dar nelaikas palikti рб miestа, liko dar daug ko nuveikti."); SendClientMessage(players, COLOR_SERVER, warningmessage); } else { new warningmessage[128]; format (warningmessage, sizeof(warningmessage), "Test"); SendClientMessage(players, COLOR_SERVER, warningmessage); } } return 1; }