enum PDATA //We name our enumerator as PDATA (which stands for PlayerDATA). You can name it however you want.
{
pBANNED,
pBANNEDfor[20], // The reason for being banned?
pBANNEDby[MAX_PLAYER_NAME], // The ADMIN who banned this player
pBANNEDtime, // the timestamp of being banned. Not necessary but useful for showing stuff.
pUNBANtime
}
public OnAccountLoad(playerid)
{
pInfo[playerid][Admin] = cache_get_field_content_int(0, "Admin"); //we're getting a field 4 from row 0. And since it's an integer, we use cache_get_row_int
pInfo[playerid][VIP] = cache_get_field_content_int(0, "VIP"); //Above
pInfo[playerid][Money] = cache_get_field_content_int(0, "Money");//Above
pInfo[playerid][posX] = cache_get_field_content_float(0, "PosX");//Above. Since player's position is a float, we use cache_get_field_content_float
pInfo[playerid][posY] = cache_get_field_content_float(0, "PosY");//Above
pInfo[playerid][posZ] = cache_get_field_content_float(0, "PosZ");//Above
pInfo[playerid][pBANNEDfor] = cache_get_row(0, "pBANNEDfor");//THIS ONE!!!
pInfo[playerid][pBANNEDby] = cache_get_row(0, "pBANNEDby");//THIS ONE!!!!
pInfo[playerid][pUNBANtime] = cache_get_field_content_int(0, "pUNBANtime");
pInfo[playerid][pBANNEDtime] = cache_get_field_content_int(0, "pBANNEDtime");
pInfo[playerid][pBANNED] = cache_get_field_content_int(0, "pBANNED");
GivePlayerMoney(playerid, pInfo[playerid][Money]);
SendClientMessage(playerid, -1, "Successfully logged in"); //tell them that they have successfully logged in
return 1;
}
public OnAccountLoad(playerid)
{
pInfo[playerid][Admin] = cache_get_field_content_int(0, "Admin"); //we're getting a field 4 from row 0. And since it's an integer, we use cache_get_row_int
pInfo[playerid][VIP] = cache_get_field_content_int(0, "VIP"); //Above
pInfo[playerid][Money] = cache_get_field_content_int(0, "Money");//Above
pInfo[playerid][posX] = cache_get_field_content_float(0, "PosX");//Above. Since player's position is a float, we use cache_get_field_content_float
pInfo[playerid][posY] = cache_get_field_content_float(0, "PosY");//Above
pInfo[playerid][posZ] = cache_get_field_content_float(0, "PosZ");//Above
cache_get_field_content(0,"pBANNEDfor",pInfo[playerid][pBANNEDfor],max_length);//change the max_length thing!
cache_get_field_content(0,"pBANNEDby",pInfo[playerid][pBANNEDby],max_length);
pInfo[playerid][pUNBANtime] = cache_get_field_content_int(0, "pUNBANtime");
pInfo[playerid][pBANNEDtime] = cache_get_field_content_int(0, "pBANNEDtime");
pInfo[playerid][pBANNED] = cache_get_field_content_int(0, "pBANNED");
GivePlayerMoney(playerid, pInfo[playerid][Money]);
SendClientMessage(playerid, -1, "Successfully logged in"); //tell them that they have successfully logged in
return 1;
}
Important Note You have to provide the size (max_len) by yourself if you use an enum-array as destination. |
error 035: argument type mismatch (argument 4)
error 035: argument type mismatch (argument 4)
cache_get_field_content(0,"pBANNEDfor",pInfo[playerid][pBANNEDfor],name);//change the max_length thing!
cache_get_field_content(0,"pBANNEDby",pInfo[playerid][pBANNEDby],name);
cache_get_field_content(0, "pBANNEDfor", pInfo[playerid][pBANNEDfor], mysql, 129);
cache_get_field_content(0, "pBANNEDby", pInfo[playerid][pBANNEDby], mysql, 129);
enum pInfo
{
pBANNEDfor[64],
pBANNEDby[24]
}
new pInfo[MAX_PLAYERS][pInfo];
public OnAccountLoad(playerid)
{
pInfo[playerid][Admin] = cache_get_field_content_int(0, "Admin"); //we're getting a field 4 from row 0. And since it's an integer, we use cache_get_row_int
pInfo[playerid][VIP] = cache_get_field_content_int(0, "VIP"); //Above
pInfo[playerid][Money] = cache_get_field_content_int(0, "Money");//Above
pInfo[playerid][posX] = cache_get_field_content_float(0, "PosX");//Above. Since player's position is a float, we use cache_get_field_content_float
pInfo[playerid][posY] = cache_get_field_content_float(0, "PosY");//Above
pInfo[playerid][posZ] = cache_get_field_content_float(0, "PosZ");//Above
cache_get_field_content(0,"pBANNEDfor",pInfo[playerid][pBANNEDfor]);//now just ignore the max_length you already defined in your enum.
cache_get_field_content(0,"pBANNEDby",pInfo[playerid][pBANNEDby]);
pInfo[playerid][pUNBANtime] = cache_get_field_content_int(0, "pUNBANtime");
pInfo[playerid][pBANNEDtime] = cache_get_field_content_int(0, "pBANNEDtime");
pInfo[playerid][pBANNED] = cache_get_field_content_int(0, "pBANNED");
GivePlayerMoney(playerid, pInfo[playerid][Money]);
SendClientMessage(playerid, -1, "Successfully logged in"); //tell them that they have successfully logged in
return 1;
}