New MySQL Errors for old mysql
#8

Quote:
Originally Posted by TheLeech
Посмотреть сообщение
What do I change this to cache_get_data for

Код:
forward OnForumAccountCheck(playerid);
public OnForumAccountCheck(playerid)
{
	new rows, fields;
	cache_get_data(rows, fields, mysql);
	if(rows)
	{
	    new String[150];
	    new pName[24];
	    GetPlayerName(playerid, pName, 24);
	    GiveNameSpace(pName);
		cache_get_value_name(0, "Password", PlayerInfo[playerid][Password], mysql, 129);
		PlayerInfo[playerid][ID] = cache_get_value_name_int(0, "ID");
		//printf("%s", PlayerInfo[playerid][Password]);

		format(String, sizeof(String), "{FFFFFF}Welcome back, %s.\n\n{0099FF}This account is already registered.\n\
		{0099FF}Please, input your password below to proceed to the game.\n\n", pName);
		ShowPlayerDialog(playerid, LoginDialog, DIALOG_STYLE_PASSWORD, "Login System", String, "Login", "Leave");
	}
	else
	{
		new String[150];
        new pName[24];
	    GetPlayerName(playerid, pName, 24);
	    GiveNameSpace(pName);

		format(String, sizeof(String), "{FFFFFF}Welcome %s.\n\n{0099FF}This account is not registered.\n\
		{0099FF}Please, input your password below to proceed.\n\n", pName);
 		ShowPlayerDialog(playerid, RegisterDialog, DIALOG_STYLE_PASSWORD, "Registration System", String, "Register", "Leave");
	}
	return 1;
}
Maybe in mySQL 4.1, you must put cache_get into variable like:
cache_get_value_int(0, "pID", PlayerInfo[playerid][pID]);

Just an example here.....
PHP код:
forward OnPlayerLogin(playerid);
public 
OnPlayerLogin(playerid)
{
    new 
found 0;
    new 
pName[24], str[256];
    static 
a,b,c,d;
    
cache_get_value_name_int(0"Admin"a);
    
cache_get_value_name_int(0"PassedRPTest"b);
    
cache_get_value_name_int(0"CharacterMade"c);
    
cache_get_value_name_int(0"AppMade"d);
    
SetPVarInt(playerid"Admin"a);
    
SetPVarInt(playerid"PassedRPTest"b);
    
SetPVarInt(playerid"CharacterMade"c);
    
SetPVarInt(playerid"AppMade"d);
    
PlayerInfo[playerid][LoggedIn] = true;
    new 
fetch[256];
       
cache_get_value_name(0"AdminName"fetch);
    
format(PlayerInfo[playerid][AdminName], 256fetch);
    for(new 
1MAX_APPLICATIONSi++)
    {
        if(
ApplicationInfo[i][SentIn] == 1)
        {
            
found++;
        }
    }
    if(
GetPVarInt(playerid"Admin") >= || IsPlayerAdmin(playerid))
    {
        if(
found 0)
        {
            
format(strsizeof(str), "Server: There are currently (%d) applications waiting approval. (/applications)"found);
            
SendClientMessage(playeridCOLOR_ORANGEstr);
        }
    }
    if(
GetPVarInt(playerid"CharacterMade") == 0)
    {
        if(
GetPVarInt(playerid"PassedRPTest") == 0)
        {
            if(
GetPVarInt(playerid"AppMade") == 1) {
                
SendClientMessage(playeridCOLOR_ORANGE"Server: It looks like you have already done an application to join our server.");
                
SendClientMessage(playeridCOLOR_ORANGE"We are sorry it's taking so long for you to be reviewed, Please have patients, Thanks.");
                
SendClientMessage(playeridCOLOR_ORANGE"Would you like to take a multi-choice test?");
                
ShowPlayerDialog(playeridTakeMultiChoiceDIALOG_STYLE_MSGBOX"Take a different test?""Would you like to take the multiple choice test?""Yes""No");
                
                static 
apid;
                
cache_get_value_name_int(0"AppID"apid);
                
PlayerInfo[playerid][AppID] = apid;
                
ApplicationInfo[PlayerInfo[playerid][AppID]][PlayerID] = playerid;
            }
            if(
GetPVarInt(playerid"AppMade") == 0) {
                
AdminsOnline(playerid);
                
SetPVarInt(playerid"Questions"1);
            }
            
SetSpawnInfo(playerid03051494.85891306.481093.2953269.1500000);
            
SetPlayerInterior(playerid,3);
            
SetPlayerVirtualWorld(playeridplayerid+1);
            
SpawnPlayer(playerid);
            
SetPlayerSkin(playerid305);
            
TogglePlayerSpectating(playerid0);
            
TextDrawShowForPlayer(playerid,MoneyDraw[playerid]);
            return 
1;
        }
        else {
            
SendClientMessage(playeridCOLOR_ORANGE"Server: Logged in, please make your character.");
            
SetSpawnInfo(playerid03051494.85891306.481093.2953269.1500000);
            
SetPlayerInterior(playerid,3);
            
SetPlayerVirtualWorld(playeridplayerid+1);
            
SpawnPlayer(playerid);
            
SetPlayerSkin(playerid305);
            
ShowCreateCharacterMenu(playerid);
            
TogglePlayerSpectating(playerid0);
            
TextDrawShowForPlayer(playerid,MoneyDraw[playerid]);
            return 
1;
        }
    }
    static 
e,f,j,k,l,m,n,Float:o,Float:p,Float:q,Float:r;
    
cache_get_value_name_int(0"Skin"e);
    
cache_get_value_name_int(0"Sex"f);
    
cache_get_value_name_int(0"Age"j);
    
cache_get_value_name_int(0"Cash"k);
    
cache_get_value_name_int(0"Bank"l);
    
cache_get_value_name_int(0"Interior"m)
    
cache_get_value_name_int(0"VirtualWorld"n)
    
cache_get_value_name_int(0"PosX"o)
    
cache_get_value_name_int(0"PosY"p)
    
cache_get_value_name_int(0"PosZ"q)
    
cache_get_value_name_int(0"PosA"r)
    
//Why you need this instead just using var?
    
SetPVarInt(playerid"Skin"e);
    
SetPVarInt(playerid"Sex"f);
    
SetPVarInt(playerid"Age"j);
    
SetPVarInt(playerid"Cash"k);
    
SetPVarInt(playerid"Bank"l);
    
SetPVarInt(playerid"Interior"m);
    
SetPVarInt(playerid"VirtualWorld"n);
    
SetPVarFloat(playerid"PosX"o);
    
SetPVarFloat(playerid"PosY"p);
    
SetPVarFloat(playerid"PosZ"q);
    
SetPVarFloat(playerid"PosA"r);
    
GetPlayerName(playeridpName24);
    
GiveNameSpace(pName);
    
format(strsizeof(str), "Server: Welcome back %s, Thank you for being part of the community."pName);
    
SendClientMessage(playeridCOLOR_ORANGEstr);
    
SetSpawnInfo(playerid0GetPVarInt(playerid"Skin"), GetPVarFloat(playerid"PosX"), GetPVarFloat(playerid"PosY"), GetPVarFloat(playerid"PosZ"), GetPVarFloat(playerid"PosA"), 00000);
     
SetPlayerInterior(playeridGetPVarInt(playerid"Interior"));
      
SetPlayerVirtualWorld(playeridGetPVarInt(playerid"VirtualWorld"));
       
SpawnPlayer(playerid);
       
SetCameraBehindPlayer(playerid);
       
SetPlayerSkin(playeridGetPVarInt(playerid"Skin"));
       
PlayerInfo[playerid][AppID] = -1;
       
TogglePlayerSpectating(playerid0);
       
TextDrawShowForPlayer(playerid,MoneyDraw[playerid]);
       
SetPlayerMoneyEx(playeridGetPVarInt(playerid"Cash"));
    return 
1;

You can try getting mysql cache with PlayerInfo variabel.
Reply


Messages In This Thread
New MySQL Errors for old mysql - by TheLeech - 17.01.2019, 12:45
Re: New MySQL Errors for old mysql - by DarkMythHunter - 17.01.2019, 12:50
Re: New MySQL Errors for old mysql - by TheLeech - 17.01.2019, 13:18
Re: New MySQL Errors for old mysql - by B3x7K - 17.01.2019, 13:27
Re: New MySQL Errors for old mysql - by TheLeech - 17.01.2019, 13:37
Re: New MySQL Errors for old mysql - by B3x7K - 17.01.2019, 14:28
Re: New MySQL Errors for old mysql - by TheLeech - 17.01.2019, 14:34
Re: New MySQL Errors for old mysql - by B3x7K - 17.01.2019, 15:05
Re: New MySQL Errors for old mysql - by TheLeech - 17.01.2019, 15:28

Forum Jump:


Users browsing this thread: 1 Guest(s)