hi breadfish
so mein erstes tutorial ja fangen wir an
zunächst suchen wir nach enum pInfo :
hier stehen einige Varriablen
hierzu fügen wir die Varriable pfirst hinzu (natürlich nur ein Beispiel)
das sah so aus:
pLevel,
pAdmin,
pDonateRank,
gPupgrade,
pConnectTime,
pReg,
pSex,
pAge,
pOrigin,
nun sieht es so aus:
pfirst, // hier ;)
pLevel,
pAdmin,
pDonateRank,
gPupgrade,
pConnectTime,
pReg,
pSex,
pAge,
pOrigin,
ok machen wir weiter
gehen wir zu
public OnPlayerConnect(playerid)
hier finden wir das vor:
(nur ausschnitt)
PlayerInfo[playerid][pAdmin] = 0;
PlayerInfo[playerid][pDonateRank] = 0;
PlayerInfo[playerid][gPupgrade] = 0;
PlayerInfo[playerid][pConnectTime] = 0;
PlayerInfo[playerid][pReg] = 0;
PlayerInfo[playerid][pSex] = 0;
PlayerInfo[playerid][pAge] = 0;
PlayerInfo[playerid][pOrigin] = 0;
PlayerInfo[playerid][pExp] = 0;
hieraus wird:
PlayerInfo[playerid][pfirst] = 0; // hier die neue Varriable
PlayerInfo[playerid][pAdmin] = 0;
PlayerInfo[playerid][pDonateRank] = 0;
PlayerInfo[playerid][gPupgrade] = 0;
PlayerInfo[playerid][pConnectTime] = 0;
PlayerInfo[playerid][pReg] = 0;
PlayerInfo[playerid][pSex] = 0;
PlayerInfo[playerid][pAge] = 0;
PlayerInfo[playerid][pOrigin] = 0;
PlayerInfo[playerid][pExp] = 0;
ok nun auf zu
public OnPlayerRegister(playerid, password[])
hier finden wir diese Werte
format(var, 64, "Level=%d\n",PlayerInfo[playerid][pLevel]);fwrite(hFile, var);
format(var, 64, "AdminLevel=%d\n",PlayerInfo[playerid][pAdmin]);fwrite(hFile, var);
format(var, 64, "DonateRank=%d\n",PlayerInfo[playerid][pDonateRank]);fwrite(hFile, var);
format(var, 64, "UpgradePoints=%d\n",PlayerInfo[playerid][gPupgrade]);fwrite(hFile, var);
format(var, 64, "ConnectedTime=%d\n",PlayerInfo[playerid][pConnectTime]);fwrite(hFile, var);
hieraus wird :
format(var, 64, "first=%d\n",PlayerInfo[playerid][pfirst]);fwrite(hFile, var);
format(var, 64, "Level=%d\n",PlayerInfo[playerid][pLevel]);fwrite(hFile, var);
format(var, 64, "AdminLevel=%d\n",PlayerInfo[playerid][pAdmin]);fwrite(hFile, var);
format(var, 64, "DonateRank=%d\n",PlayerInfo[playerid][pDonateRank]);fwrite(hFile, var);
format(var, 64, "UpgradePoints=%d\n",PlayerInfo[playerid][gPupgrade]);fwrite(hFile, var);
format(var, 64, "ConnectedTime=%d\n",PlayerInfo[playerid][pConnectTime]);fwrite(hFile, var);
ok nun zu:
public OnPlayerUpdate(playerid)
hier macht ihr dasselbe wie bei OnPlayerRegister, bei Problemen einfach posten
ok jetzt zu:
public OnPlayerLogin(playerid,password[])
soo hier finden wir das:
if( strcmp( key , "Level" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pLevel] = strval( val ); }
if( strcmp( key , "AdminLevel" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pAdmin] = strval( val ); }
if( strcmp( key , "DonateRank" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pDonateRank] = strval( val ); }
if( strcmp( key , "UpgradePoints" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][gPupgrade] = strval( val ); }
hieraus wird:
if( strcmp( key , "first" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pfirst] = strval( val ); } // hier ist das neue ;)
if( strcmp( key , "Level" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pLevel] = strval( val ); }
if( strcmp( key , "AdminLevel" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pAdmin] = strval( val ); }
if( strcmp( key , "DonateRank" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pDonateRank] = strval( val ); }
if( strcmp( key , "UpgradePoints" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][gPupgrade] = strval( val ); }
soo nun habt ihr alle möglichkeiten mit eurer neuen Varriable PlayerInfo[playerid][pfirst] dieser einen Individuellen Wert zu geben, sie abzufragen, usw.
abfragen sieht folgendermaßen aus:
if (PlayerInfo[playerid][pfirst] == WERT)
{
des wars ich hoffe ich hab euch geholfen