mysql es klappt aber es kommt nur luiluiboy014 aber merhr nicht kein admin oder sondt nochwas
Beiträge von luiluiboy014
-
-
könte ihr mir das demonstriren
-
habe ich weg gemacht jetzt kommt
C:\Users\Jeremias Benedikt\Desktop\samp03e_svr_win32\gamemodes\DriftServer2012.pwn(995) : warning 217: loose indentation
C:\Users\Jeremias Benedikt\Desktop\samp03e_svr_win32\gamemodes\DriftServer2012.pwn(998) : error 010: invalid function or declaration
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase1 Error.
-
was muss ich hir machen
if (strcmp(cmdtext, "/admins", true) == 0)
{
if(IsPlayerConnected(playerid))
{
SendClientMessage(playerid,GELB,"------------------------Administratoren------------------------");
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(isPlayerAnAdmin(i,1))
{
new string[128],adminduty[10],adminlevel[64];
switch(GetPVarInt(i,"Adminlevel"))
{
case 1:{adminlevel="{00FF5A}Supporter";}
case 2:{adminlevel="{572B54}Moderator";}
case 3:{adminlevel="{858BBB}Super Moderator";}
case 4:{adminlevel="{0000FF}Admin";}
case 5:{adminlevel="{FF0000}Fulladmin";}
}
format(string, 256, "{FF6E00}%s {FFFFFF}%s",adminlevel,SpielerName(i));
SendClientMessage(playerid,0x00FF00FF,string);
}
}
}
}
return 1; -
ich weiß nicht wie das geht
ich habe eins schon aus getestet es geht nicht er hat kein angetzeigt -
Hallo Leute.
Wie Erstelle ich ein /admins brauche hilfe da drine solte sein
Moderator
Super Moderator
Admin
Fulladmin
Supporterund
server leiterbrauche hilfe
-
Hallo leute wie scripte ich
Ein /admins Befehl der alle Admins auflistet die online sind
so mit denen sachen
ich meine auch mit soModerator
Super Moderator";}
Admin";}
Fulladmin";
und Supporterund server leiter
Danke brauche hilfe
-
ich meine auch mit so
case 2:{adminlevel="{572B54}Moderator
case 3:{adminlevel="{858BBB}Super Moderator";}
case 4:{adminlevel="{0000FF}Admin";}
case 5:{adminlevel="{FF0000}Fulladmin";
und Supporter -
Hallo leute wie scripte ich
Ein /admins Befehl der alle Admins auflistet die online sindDanke brauche hilfe
-
und wo finde ich da
-
Hallo Leute.
Hallo ich Suche Das beste Admin System könnt ihr mich beraten oder helfen bitte
-
-
wie mache ich das GivePlayerMoney(playerid,mysql_GetInt
-
ne eben nich wen ich rein komme o geld normalaweise müste 20000 geld kommen aber s kommt nichts oder wen ich geld mache und ich mich aus logen tuhe speichert der das nicht weil wn ich mich wider ein loge kommt alles 0000
-
[02:44:26]
[02:44:26] ---------------------------
[02:44:26] MySQL Debugging activated (07/02/12)
[02:44:26] ---------------------------
[02:44:26]
[02:44:58] >> mysql_real_escape_string( Connection handle: 1 )
[02:44:58] CMySQLHandler::EscapeString(luiluiboy014323232); - Escaped 18 characters to luiluiboy014323232.
[02:44:58] >> mysql_query( Connection handle: 1 )
[02:44:58] CMySQLHandler::Query(SELECT * FROM `accounts` WHERE `Name` = 'luiluiboy014323232') - Successfully executed.
[02:44:58] >> mysql_store_result( Connection handle: 1 )
[02:44:58] CMySQLHandler::StoreResult() - Result was stored.
[02:44:58] >> mysql_num_rows( Connection handle: 1 )
[02:44:58] CMySQLHandler::NumRows() - Returned 1 row(s)
[02:44:58] >> mysql_free_result( Connection handle: 1 )
[02:44:58] CMySQLHandler::FreeResult() - Result was successfully free'd.
[02:44:58] >> mysql_real_escape_string( Connection handle: 1 )
[02:44:58] CMySQLHandler::EscapeString(luiluiboy014323232); - Escaped 18 characters to luiluiboy014323232.
[02:44:58] >> mysql_query( Connection handle: 1 )
[02:44:58] CMySQLHandler::Query(SELECT * FROM `accounts` WHERE `Name` = 'luiluiboy014323232') - Successfully executed.
[02:44:58] >> mysql_store_result( Connection handle: 1 )
[02:44:58] CMySQLHandler::StoreResult() - Result was stored.
[02:44:58] >> mysql_num_rows( Connection handle: 1 )
[02:44:58] CMySQLHandler::NumRows() - Returned 1 row(s)
[02:44:58] >> mysql_free_result( Connection handle: 1 )
[02:44:58] CMySQLHandler::FreeResult() - Result was successfully free'd.
[02:45:02] >> mysql_real_escape_string( Connection handle: 1 )
[02:45:02] CMySQLHandler::EscapeString(luiluiboy014323232); - Escaped 18 characters to luiluiboy014323232.
[02:45:02] >> mysql_query( Connection handle: 1 )
[02:45:02] CMySQLHandler::Query(SELECT `passwort` FROM `accounts` WHERE `Name` = 'luiluiboy014323232') - Successfully executed.
[02:45:02] >> mysql_store_result( Connection handle: 1 )
[02:45:02] CMySQLHandler::StoreResult() - Result was stored.
[02:45:02] >> mysql_fetch_row_format( Connection handle: 1 )
[02:45:02] CMySQLHandler::FetchRow() - Return: hans
[02:45:02] >> mysql_free_result( Connection handle: 1 )
[02:45:02] CMySQLHandler::FreeResult() - Result was successfully free'd.
[02:45:02] >> mysql_real_escape_string( Connection handle: 1 )
[02:45:02] CMySQLHandler::EscapeString(accounts); - Escaped 8 characters to accounts.
[02:45:02] >> mysql_real_escape_string( Connection handle: 1 )
[02:45:02] CMySQLHandler::EscapeString(Level); - Escaped 5 characters to Level.
[02:45:02] >> mysql_real_escape_string( Connection handle: 1 )
[02:45:02] CMySQLHandler::EscapeString(Name); - Escaped 4 characters to Name.
[02:45:02] >> mysql_real_escape_string( Connection handle: 1 )
[02:45:02] CMySQLHandler::EscapeString(luiluiboy014323232); - Escaped 18 characters to luiluiboy014323232.
[02:45:02] >> mysql_query( Connection handle: 1 )
[02:45:02] CMySQLHandler::Query(SELECT `Level` FROM `accounts` WHERE `Name` = 'luiluiboy014323232') - Successfully executed.
[02:45:02] >> mysql_store_result( Connection handle: 1 )
[02:45:02] CMySQLHandler::StoreResult() - Result was stored.
[02:45:02] >> mysql_fetch_int( Connection handle: 1 )
[02:45:02] CMySQLHandler::FetchRow() - Return: 1
[02:45:02] >> mysql_free_result( Connection handle: 1 )
[02:45:02] CMySQLHandler::FreeResult() - Result was successfully free'd.
[02:45:02] >> mysql_real_escape_string( Connection handle: 1 )
[02:45:02] CMySQLHandler::EscapeString(accounts); - Escaped 8 characters to accounts.
[02:45:03] >> mysql_real_escape_string( Connection handle: 1 )
[02:45:03] CMySQLHandler::EscapeString(Geld); - Escaped 4 characters to Geld.
[02:45:03] >> mysql_real_escape_string( Connection handle: 1 )
[02:45:03] CMySQLHandler::EscapeString(Name); - Escaped 4 characters to Name.
[02:45:03] >> mysql_real_escape_string( Connection handle: 1 )
[02:45:03] CMySQLHandler::EscapeString(luiluiboy014323232); - Escaped 18 characters to luiluiboy014323232.
[02:45:03] >> mysql_query( Connection handle: 1 )
[02:45:03] CMySQLHandler::Query(SELECT `Geld` FROM `accounts` WHERE `Name` = 'luiluiboy014323232') - Successfully executed.
[02:45:03] >> mysql_store_result( Connection handle: 1 )
[02:45:03] CMySQLHandler::StoreResult() - Result was stored.
[02:45:03] >> mysql_fetch_int( Connection handle: 1 )
[02:45:03] CMySQLHandler::FetchRow() - Return: 20000
[02:45:03] >> mysql_free_result( Connection handle: 1 )
[02:45:03] CMySQLHandler::FreeResult() - Result was successfully free'd.
[02:45:03] >> mysql_real_escape_string( Connection handle: 1 )
[02:45:03] CMySQLHandler::EscapeString(accounts); - Escaped 8 characters to accounts.
[02:45:03] >> mysql_real_escape_string( Connection handle: 1 )
[02:45:03] CMySQLHandler::EscapeString(Kills); - Escaped 5 characters to Kills.
[02:45:03] >> mysql_real_escape_string( Connection handle: 1 )
[02:45:03] CMySQLHandler::EscapeString(Name); - Escaped 4 characters to Name.
[02:45:03] >> mysql_real_escape_string( Connection handle: 1 )
[02:45:03] CMySQLHandler::EscapeString(luiluiboy014323232); - Escaped 18 characters to luiluiboy014323232.
[02:45:03] >> mysql_query( Connection handle: 1 )
[02:45:03] CMySQLHandler::Query(SELECT `Kills` FROM `accounts` WHERE `Name` = 'luiluiboy014323232') - Successfully executed.
[02:45:03] >> mysql_store_result( Connection handle: 1 )
[02:45:03] CMySQLHandler::StoreResult() - Result was stored.
[02:45:03] >> mysql_fetch_int( Connection handle: 1 )
[02:45:03] CMySQLHandler::FetchRow() - Return: 0
[02:45:03] >> mysql_free_result( Connection handle: 1 )
[02:45:03] CMySQLHandler::FreeResult() - Result was successfully free'd.
[02:45:03] >> mysql_real_escape_string( Connection handle: 1 )
[02:45:03] CMySQLHandler::EscapeString(accounts); - Escaped 8 characters to accounts.
[02:45:03] >> mysql_real_escape_string( Connection handle: 1 )
[02:45:03] CMySQLHandler::EscapeString(Tode); - Escaped 4 characters to Tode.
[02:45:03] >> mysql_real_escape_string( Connection handle: 1 )
[02:45:03] CMySQLHandler::EscapeString(Name); - Escaped 4 characters to Name.
[02:45:03] >> mysql_real_escape_string( Connection handle: 1 )
[02:45:03] CMySQLHandler::EscapeString(luiluiboy014323232); - Escaped 18 characters to luiluiboy014323232.
[02:45:03] >> mysql_query( Connection handle: 1 )
[02:45:03] CMySQLHandler::Query(SELECT `Tode` FROM `accounts` WHERE `Name` = 'luiluiboy014323232') - Successfully executed.
[02:45:03] >> mysql_store_result( Connection handle: 1 )
[02:45:03] CMySQLHandler::StoreResult() - Result was stored.
[02:45:03] >> mysql_fetch_int( Connection handle: 1 )
[02:45:03] CMySQLHandler::FetchRow() - Return: 0
[02:45:03] >> mysql_free_result( Connection handle: 1 )
[02:45:03] CMySQLHandler::FreeResult() - Result was successfully free'd.
[02:45:45] >> mysql_real_escape_string( Connection handle: 1 )
[02:45:45] CMySQLHandler::EscapeString(accounts); - Escaped 8 characters to accounts.
[02:45:45] >> mysql_real_escape_string( Connection handle: 1 )
[02:45:45] CMySQLHandler::EscapeString(Level); - Escaped 5 characters to Level.
[02:45:45] >> mysql_real_escape_string( Connection handle: 1 )
[02:45:45] CMySQLHandler::EscapeString(Name); - Escaped 4 characters to Name.
[02:45:45] >> mysql_real_escape_string( Connection handle: 1 )
[02:45:45] CMySQLHandler::EscapeString(luiluiboy014323232); - Escaped 18 characters to luiluiboy014323232.
[02:45:45] >> mysql_query( Connection handle: 1 )
[02:45:45] CMySQLHandler::Query(UPDATE `accounts` SET `Level` = '1' WHERE `Name` = 'luiluiboy014323232') - Successfully executed.
[02:45:45] >> mysql_real_escape_string( Connection handle: 1 )
[02:45:45] CMySQLHandler::EscapeString(accounts); - Escaped 8 characters to accounts.
[02:45:45] >> mysql_real_escape_string( Connection handle: 1 )
[02:45:45] CMySQLHandler::EscapeString(Geld); - Escaped 4 characters to Geld.
[02:45:45] >> mysql_real_escape_string( Connection handle: 1 )
[02:45:45] CMySQLHandler::EscapeString(Name); - Escaped 4 characters to Name.
[02:45:45] >> mysql_real_escape_string( Connection handle: 1 )
[02:45:45] CMySQLHandler::EscapeString(luiluiboy014323232); - Escaped 18 characters to luiluiboy014323232.
[02:45:45] >> mysql_query( Connection handle: 1 )
[02:45:45] CMySQLHandler::Query(UPDATE `accounts` SET `Geld` = '20000' WHERE `Name` = 'luiluiboy014323232') - Successfully executed.
[02:45:45] >> mysql_real_escape_string( Connection handle: 1 )
[02:45:45] CMySQLHandler::EscapeString(accounts); - Escaped 8 characters to accounts.
[02:45:45] >> mysql_real_escape_string( Connection handle: 1 )
[02:45:46] CMySQLHandler::EscapeString(Kills); - Escaped 5 characters to Kills.
[02:45:46] >> mysql_real_escape_string( Connection handle: 1 )
[02:45:46] CMySQLHandler::EscapeString(Name); - Escaped 4 characters to Name.
[02:45:46] >> mysql_real_escape_string( Connection handle: 1 )
[02:45:46] CMySQLHandler::EscapeString(luiluiboy014323232); - Escaped 18 characters to luiluiboy014323232.
[02:45:46] >> mysql_query( Connection handle: 1 )
[02:45:46] CMySQLHandler::Query(UPDATE `accounts` SET `Kills` = '0' WHERE `Name` = 'luiluiboy014323232') - Successfully executed.
[02:45:46] >> mysql_real_escape_string( Connection handle: 1 )
[02:45:46] CMySQLHandler::EscapeString(accounts); - Escaped 8 characters to accounts.
[02:45:46] >> mysql_real_escape_string( Connection handle: 1 )
[02:45:46] CMySQLHandler::EscapeString(Tode); - Escaped 4 characters to Tode.
[02:45:46] >> mysql_real_escape_string( Connection handle: 1 )
[02:45:46] CMySQLHandler::EscapeString(Name); - Escaped 4 characters to Name.
[02:45:46] >> mysql_real_escape_string( Connection handle: 1 )
[02:45:46] CMySQLHandler::EscapeString(luiluiboy014323232); - Escaped 18 characters to luiluiboy014323232.
[02:45:46] >> mysql_query( Connection handle: 1 )
[02:45:46] CMySQLHandler::Query(UPDATE `accounts` SET `Tode` = '0' WHERE `Name` = 'luiluiboy014323232') - Successfully executed.
[02:45:46] >> mysql_real_escape_string( Connection handle: 1 )
[02:45:46] CMySQLHandler::EscapeString(accounts); - Escaped 8 characters to accounts.
[02:45:46] >> mysql_real_escape_string( Connection handle: 1 )
[02:45:46] CMySQLHandler::EscapeString(Health); - Escaped 6 characters to Health.
[02:45:46] >> mysql_real_escape_string( Connection handle: 1 )
[02:45:46] CMySQLHandler::EscapeString(Name); - Escaped 4 characters to Name.
[02:45:46] >> mysql_real_escape_string( Connection handle: 1 )
[02:45:46] CMySQLHandler::EscapeString(luiluiboy014323232); - Escaped 18 characters to luiluiboy014323232.
[02:45:46] >> mysql_query( Connection handle: 1 )
[02:45:46] CMySQLHandler::Query(UPDATE `accounts` SET `Health` = '0.000000' WHERE `Name` = 'luiluiboy014323232') - Successfully executed.
der tut es noch nicht mall richtig laden ich kamm rein kamm kein geld
-
habe keinn drien
-
#include <a_samp>
#include <Ocmd>
#include <a_mysql>
#include <farben>
#include <sscanf2>
#define SQL_HOST "127.0.0.1"
#define SQL_USER "root"
#define SQL_PASS ""
#define SQL_DATA "samp_db"#define DIALOG_REGISTER (1)
#define DIALOG_LOGIN (2)enum SpielerDaten
{
pName[MAX_PLAYER_NAME],
pLevel,
pGeld,
pKills,
pTode,
Float:pHealth
}
new SpielerInfo[MAX_PLAYERS][SpielerDaten];main()
{
print("\n----------------------------------");
print(" Blank Gamemode by your name here");
print("----------------------------------\n");
}public OnGameModeInit()
{
Connect_To_Database();
SetGameModeText("Blank Script");
AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
return 1;
}public OnGameModeExit()
{
return 1;
}
public OnPlayerRequestClass(playerid, classid)
{
SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
if(GetPVarInt(playerid,"Eingeloggt") == 0) //Als erstes fragen wir ab ob der Spieler schon eingeloggt ist oder nicht, damit wir nicht bei jeder Skin auswahl uns neu Einloggen müssen.
{
if(mysql_CheckAccount(playerid) == 0)//Wür überprüfen ob der Account Existiert, falls nicht Zeigen wir den Dialog zum Registrieren.
{
SendClientMessage(playerid, 0xFFFFFFFF,"________-> Willkommen auf auf meinem Server <-________");
SendClientMessage(playerid, 0xFFFFFFFF,"Dein Account wurde nicht gefunden, bitte Registriere dich!");
ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_INPUT,"Register","Bitte Gib ein Passwort an:","Register","Exit");
}
else if(mysql_CheckAccount(playerid) == 1)//Falls doch zeigen wir den Dialog zum Einloggen.
{
SendClientMessage(playerid, 0xFFFFFFFF,"________-> Willkommen auf auf meinem Server <-________");
SendClientMessage(playerid, 0xFFFFFFFF,"Dein Account wurde gefunden, bitte Log dich nun ein!");
ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_INPUT,"Login","Bitte gib dein Passwort ein:","Login","Abbrechen");
}
}
return 1;
}public OnPlayerConnect(playerid)
{
return 1;
}public OnPlayerDisconnect(playerid, reason)
{
SavePlayer(playerid);
DeletePVar(playerid,"Eingeloggt");
return 1;
}public OnPlayerSpawn(playerid)
{
return 1;
}public OnPlayerDeath(playerid, killerid, reason)
{
return 1;
}public OnVehicleSpawn(vehicleid)
{
return 1;
}public OnVehicleDeath(vehicleid, killerid)
{
return 1;
}public OnPlayerText(playerid, text[])
{
return 1;
}public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/mycommand", cmdtext, true, 10) == 0)
{
// Do something here
return 1;
}
return 0;
}
ocmd:veh(playerid,params[])
{
new Float:vehx,Float:vehy,Float:vehz;
new vehid,cc1,cc2,string[128];
if(sscanf(params,"iii",vehid,cc1,cc2))return SendClientMessage(playerid, ROT,"Benutzung: /veh [Vehicle ID] [Farbe 1] [Farbe 2]");{
GetPlayerPos(playerid,vehx,vehy,vehz);
new carid = CreateVehicle(vehid,vehx,vehy,vehz,3,cc1,cc2,-1);
SetVehicleNumberPlate(carid,"~>Admin<~");
PutPlayerInVehicle(playerid, carid, 0);
format(string,sizeof(string),"[AdmCmd] Du hast ein Admincar gespawnt! (FahrzeugID :%d)",GetVehicleModel(GetPlayerVehicleID(playerid)));
SendClientMessage(playerid,ROT,string);}
return 1;
}
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
return 1;
}public OnPlayerExitVehicle(playerid, vehicleid)
{
return 1;
}public OnPlayerStateChange(playerid, newstate, oldstate)
{
return 1;
}public OnPlayerEnterCheckpoint(playerid)
{
return 1;
}public OnPlayerLeaveCheckpoint(playerid)
{
return 1;
}public OnPlayerEnterRaceCheckpoint(playerid)
{
return 1;
}public OnPlayerLeaveRaceCheckpoint(playerid)
{
return 1;
}public OnRconCommand(cmd[])
{
return 1;
}public OnPlayerRequestSpawn(playerid)
{
return 1;
}public OnObjectMoved(objectid)
{
return 1;
}public OnPlayerObjectMoved(playerid, objectid)
{
return 1;
}public OnPlayerPickUpPickup(playerid, pickupid)
{
return 1;
}public OnVehicleMod(playerid, vehicleid, componentid)
{
return 1;
}public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
return 1;
}public OnVehicleRespray(playerid, vehicleid, color1, color2)
{
return 1;
}public OnPlayerSelectedMenuRow(playerid, row)
{
return 1;
}public OnPlayerExitedMenu(playerid)
{
return 1;
}public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
return 1;
}public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
return 1;
}public OnRconLoginAttempt(ip[], password[], success)
{
return 1;
}public OnPlayerUpdate(playerid)
{
return 1;
}public OnPlayerStreamIn(playerid, forplayerid)
{
return 1;
}public OnPlayerStreamOut(playerid, forplayerid)
{
return 1;
}public OnVehicleStreamIn(vehicleid, forplayerid)
{
return 1;
}public OnVehicleStreamOut(vehicleid, forplayerid)
{
return 1;
}public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch(dialogid)
{
case DIALOG_REGISTER:
{
if(response)
{
if(strlen(inputtext) == 0)
{
ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_INPUT,"Register","Das angegebene Passwort war zu Kurtz...\nBitte Registrier dich jetzt mit einem Passwort:","Register","Abbrechen");
return 1;
}
else
{
ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_INPUT,"Login","Das Angegebene Passwort war Falsch.\nBitte log dich jetzt mit dem richtigen Passwort ein:","Login","Abbrechen");
CreateAccount(playerid, inputtext);
SetPVarInt(playerid,"Eingeloggt",1);
SpawnPlayer(playerid);
return 1;
}
}
else
{
Kick(playerid);
}
}
case DIALOG_LOGIN:
{
if(response)
{
if(strlen(inputtext) == 0)
{
ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_INPUT,"Login","Das Angegebene Passwort war Falsch.\nBitte log dich jetzt mit dem richtigen Passwort ein:","Login","Abbrechen");
return 1;
}
else
{
new SpielerName[MAX_PLAYER_NAME];
GetPlayerName(playerid, SpielerName, MAX_PLAYER_NAME);
if(!strcmp(inputtext, mysql_ReturnPasswort(SpielerName), true))
{
SetPVarInt(playerid,"Eingeloggt",1);
LoadPlayer(playerid);
SpawnPlayer(playerid);
return 1;
}
else
{
ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_INPUT,"Login","Das war das Falsche Passwort.\nBitte log dich jetzt mit dem richtigen Passwort ein:","Login","Abbrechen");
return 1;
}
}
}
else
{
Kick(playerid);
}
}
}
return 1;
}public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
return 1;
}
stock Connect_To_Database()
{
mysql_connect(SQL_HOST, SQL_USER, SQL_DATA, SQL_PASS); //Wir versuchen mit den Angaben die wir oben im Script gemacht haben uns mit dem MySQL Server zu verbinden.
if(mysql_ping() == 1) //Es wird überprüft ob die Verbindung steht.
{
//Falls ja wird das in die Console geschrieben und die Funktion wird beendet.
print("<-| [MYSQL] Verbindung zur Datenbank wurde erfolgreich hergestellt!");
return true;
}
else
{
//Falls nicht wird erneut versucht eine verbindung aufzubauen.
print("<-| [MYSQL] Es konnte keine Verbindung zur Datenbank hergestellt werden!");
print("<-| [MYSQL] Es wird erneut versucht eine Verbindung zur Datenbank herzustellen!");
mysql_connect(SQL_HOST, SQL_USER, SQL_DATA, SQL_PASS);
if(mysql_ping() == 1)
{
print("<-| [MYSQL] Es konnte im 2 Versuch eine Verbindung hergestellt werden!");
return true;
}
else
{
//Falls das auch nicht Funktioniert wird der Server zur Sicherheit wieder heruntergefahren.
print("<-| [MYSQL] Es konnte keine Verbindung zur Datenbank hergestellt werden!");
print("<-| [MYSQL] Der Server wird nun beendet!");
SendRconCommand("exit");
return true;
}
}
}
stock mysql_CheckAccount(playerid)
{
new Query[128],Name[MAX_PLAYER_NAME],count;
GetPlayerName(playerid, Name, MAX_PLAYER_NAME);
mysql_real_escape_string(Name, Name);
format(Query, sizeof(Query), "SELECT * FROM `accounts` WHERE `Name` = '%s'", Name);
mysql_query(Query);
mysql_store_result();
count = mysql_num_rows();
mysql_free_result();
return count;
}
stock CreateAccount(playerid, pass[])
{
new query[256],Name[MAX_PLAYER_NAME];
GetPlayerName(playerid, Name, MAX_PLAYER_NAME);
mysql_real_escape_string(Name,Name);
mysql_real_escape_string(pass,pass);
format(query, sizeof(query), "INSERT INTO `accounts` (`Name`, `Passwort`) VALUES ('%s', '%s')", Name, pass);
mysql_query(query);
return true;
}
stock mysql_ReturnPasswort(Name[])
{
new query[130], Get[130];
mysql_real_escape_string(Name, Name);
format(query, 128, "SELECT `passwort` FROM `accounts` WHERE `Name` = '%s'", Name);
mysql_query(query);
mysql_store_result();
mysql_fetch_row(Get);
mysql_free_result();
return Get;
}
stock LoadPlayer(playerid)
{
if(IsPlayerConnected(playerid) && !IsPlayerNPC(playerid))
{
GetPlayerName(playerid, SpielerInfo[playerid][pName], MAX_PLAYER_NAME);
SpielerInfo[playerid][pLevel] = mysql_GetInt("accounts", "Level", "Name", SpielerInfo[playerid][pName]);
SpielerInfo[playerid][pGeld] = mysql_GetInt("accounts", "Geld", "Name", SpielerInfo[playerid][pName]);
SpielerInfo[playerid][pKills] = mysql_GetInt("accounts", "Kills", "Name", SpielerInfo[playerid][pName]);
SpielerInfo[playerid][pTode] = mysql_GetInt("accounts", "Tode", "Name", SpielerInfo[playerid][pName]);
}
return 1;
}
stock SavePlayer(playerid)
{
if(IsPlayerConnected(playerid) && !IsPlayerNPC(playerid))
{
if(GetPVarInt(playerid,"Eingeloggt") == 1)
{
mysql_SetInt("accounts", "Level", SpielerInfo[playerid][pLevel], "Name", SpielerInfo[playerid][pName]);
mysql_SetInt("accounts", "Geld", SpielerInfo[playerid][pGeld], "Name", SpielerInfo[playerid][pName]);
mysql_SetInt("accounts", "Kills", SpielerInfo[playerid][pKills], "Name", SpielerInfo[playerid][pName]);
mysql_SetInt("accounts", "Tode", SpielerInfo[playerid][pTode], "Name", SpielerInfo[playerid][pName]);
mysql_SetFloat("accounts", "Health", SpielerInfo[playerid][pHealth], "Name", SpielerInfo[playerid][pName]);
}
}
return 1;
}
stock mysql_GetString(Table[], Field[], Where[], Is[])
{
new query[128], Get[128];
mysql_real_escape_string(Table, Table);
mysql_real_escape_string(Field, Field);
mysql_real_escape_string(Where, Where);
mysql_real_escape_string(Is, Is);
format(query, 128, "SELECT `%s` FROM `%s` WHERE `%s` = '%s'", Field, Table, Where, Is);
mysql_query(query);
mysql_store_result();
mysql_fetch_row(Get);
mysql_free_result();
return Get;
}
stock mysql_GetInt(Table[], Field[], Where[], Is[])
{
new query[128];
mysql_real_escape_string(Table, Table);
mysql_real_escape_string(Field, Field);
mysql_real_escape_string(Where, Where);
mysql_real_escape_string(Is, Is);
format(query, 128, "SELECT `%s` FROM `%s` WHERE `%s` = '%s'", Field, Table, Where, Is);
mysql_query(query);
mysql_store_result();
new sqlint = mysql_fetch_int();
mysql_free_result();
return sqlint;
}
stock mysql_GetFloat(Table[], Field[], Where[], Is[])
{
new query[128], Float:sqlfloat;
mysql_real_escape_string(Table, Table);
mysql_real_escape_string(Field, Field);
mysql_real_escape_string(Where, Where);
mysql_real_escape_string(Is, Is);
format(query, 128, "SELECT `%s` FROM `%s` WHERE `%s` = '%s'", Field, Table, Where, Is);
mysql_query(query);
mysql_store_result();
mysql_fetch_float(sqlfloat);
mysql_free_result();
return sqlfloat;
}
stock mysql_SetInt(Table[], Field[], To, Where[], Where2[])
{
new query[128];
mysql_real_escape_string(Table, Table);
mysql_real_escape_string(Field, Field);
mysql_real_escape_string(Where, Where);
mysql_real_escape_string(Where2, Where2);
format(query, 128, "UPDATE `%s` SET `%s` = '%d' WHERE `%s` = '%s'", Table, Field, To, Where, Where2);
mysql_query(query);
return true;
}
stock mysql_SetString(Table[], Field[], To[], Where[], Where2[])
{
new query[128];
mysql_real_escape_string(Table, Table);
mysql_real_escape_string(Field, Field);
mysql_real_escape_string(To, To);
mysql_real_escape_string(Where, Where);
mysql_real_escape_string(Where2, Where2);
format(query, 128, "UPDATE `%s` SET `%s` = '%s' WHERE `%s` = '%s'", Table, Field, To, Where, Where2);
mysql_query(query);
return true;
}
stock mysql_SetFloat(Table[], Field[], Float:To, Where[], Where2[])
{
new query[128];
mysql_real_escape_string(Table, Table);
mysql_real_escape_string(Field, Field);
mysql_real_escape_string(Where, Where);
mysql_real_escape_string(Where2, Where2);
format(query, 128, "UPDATE `%s` SET `%s` = '%f' WHERE `%s` = '%s'", Table, Field, To, Where, Where2);
mysql_query(query);
return true;
}die verbindung zu datenbank ist erfolgreich das ist erst ein test da sin dkeine fheler driene
-
jup ich habe sogar das script runtergeladen und kopiert warum geht es nicht
-
Hallo ich habe ne Frage wegen Mysql ich habe alles getan was in mysql stand aber der speichert nicht ich habe alles getan was auf der seite stand
[ SCRIPTING ] MySQL (Installation, Zugriff, Einstellungen, Login & Register Beispiel)aber der speichert das nicht warum nicht kann mir das einer erklären
-
Danke hab ess