Hallo, Ich wollte das Fahrzeug system einbauen, und es per Mysql laden. Bekomme aber die compilermeldung
Code
C:\Users\Script\Desktop\script\gamemodes\Script.pwn(576) : warning 213: tag mismatch
C:\Users\Script\Desktop\script\gamemodes\Script.pwn(576) : error 032: array index out of bounds (variable "P_Data")
C:\Users\Script\Desktop\script\gamemodes\Script.pwn(622) : warning 213: tag mismatch
C:\Users\Script\Desktop\script\gamemodes\Script.pwn(622) : error 032: array index out of bounds (variable "P_Data")
C:\Users\Script\Desktop\script\gamemodes\Script.pwn(629) : warning 213: tag mismatch
C:\Users\Script\Desktop\script\gamemodes\Script.pwn(629) : error 032: array index out of bounds (variable "P_Data")
C:\Users\Script\Desktop\script\gamemodes\Script.pwn(828) : warning 213: tag mismatch
C:\Users\Script\Desktop\script\gamemodes\Script.pwn(829) : warning 213: tag mismatch
C:\Users\Script\Desktop\script\gamemodes\Script.pwn(830) : warning 213: tag mismatch
C:\Users\Script\Desktop\script\gamemodes\Script.pwn(831) : warning 213: tag mismatch
C:\Users\Script\Desktop\script\gamemodes\Script.pwn(832) : warning 213: tag mismatch
C:\Users\Script\Desktop\script\gamemodes\Script.pwn(832) : error 032: array index out of bounds (variable "P_Data")
C:\Users\Script\Desktop\script\gamemodes\Script.pwn(833) : warning 213: tag mismatch
C:\Users\Script\Desktop\script\gamemodes\Script.pwn(833) : error 032: array index out of bounds (variable "P_Data")
C:\Users\Script\Desktop\script\gamemodes\Script.pwn(834) : warning 213: tag mismatch
C:\Users\Script\Desktop\script\gamemodes\Script.pwn(835) : warning 213: tag mismatch
Alles anzeigen
Mein code
C
//==============================Includes==============================//
#include <a_samp>
#include <a_mysql>
#include <zcmd>
#include <streamer>
#include <sscanf2>
//==============================Define's==============================//
#define mysql_host ""
#define mysql_db ""
#define mysql_user ""
#define mysql_pass ""
//===============================Farben==============================//
#define Hellrot 0xFF6347AA
#define Rot 0xFF0000AA
#define Hellblau 0x007DFFFF
#define Blau 0x69B4FFAA
#define Hellgrün 0x9ACD32AA
#define Grün 0x00FF11AA
#define Dunkelgrün 0x006600FF
#define Gelb 0xEAFF00AA
#define Orange 0xFFCC00AA
#define Türkis 0x00EBFFFF
#define Pink 0xFF00EAAA
#define Purble 0xBE00FFFF
#define Weiß 0xFFFFFFAA
#define Grau 0x919191AA
#define Braun 0x330000FF
#define Schwarz 0x000000FF
//==============================Enum's==============================//
enum
{
DIALOG_LOGIN,
DIALOG_REGISTER
};
//=============================Tabellen=============================//
//Spieler
enum pInfo
{
peingeloggt,
pPasswort,
pID,
pLevel,
pAdmin
};
//Fahrzeige
enum carEnum{
id_x,
model,
besitzer,
Float:c_x,
Float:c_y,
Float:c_z,
Float:c_r,
db_id
}
//==============================New's==============================//
new P_Data[MAX_PLAYERS][pInfo];
new handle;
new AfterTutorial[MAX_PLAYERS],
TutTime[MAX_PLAYERS];
new Text:Tutorial[MAX_PLAYERS],
Text:Step[MAX_PLAYERS][9];
new cInfo[50][carEnum];
//==============================Forward's==============================//
forward MySQLConnect();
forward OnPlayerLogin(playerid);
forward OnLogin(playerid);
forward UnsetAfterTutorial(playerid);
forward SetPlayerUnjail();
forward LoadTextdraws();
forward carSavedToDB(carid);
//Payday
//==============================MAIN==================================//
main()
{
print("!!!Script geladen!!!");
}
//==============================Public's==============================//
public UnsetAfterTutorial(playerid)
{
if(IsPlayerConnected(playerid))
{
AfterTutorial[playerid] = 0;
}
return 1;
}
public MySQLConnect()
{
handle = mysql_connect(mysql_host, mysql_user, mysql_db, mysql_pass);
if(mysql_errno() != 0)
{
printf("Verbindung zur Datenbank fehlgeschlagen", mysql_db);
SendRconCommand("exit");
}
else
{
printf("Verbindung zur Datenbank ist gelungen", mysql_db, mysql_user);
}
return 1;
}
CMD:tutorial(playerid, params[])
{
new i;
// if(TutTime[i] >= 1)
// {
TutTime[i] += 1;
if(TutTime[i] == 3)
{
TextDrawShowForPlayer(i, Step[i][1]);
TextDrawShowForPlayer(i, Tutorial[i]);
SendClientMessage(i, Weiß, "");
SendClientMessage(i, Weiß, "");
SendClientMessage(i, Weiß, "");
SendClientMessage(i, Weiß, "");
SendClientMessage(i, Weiß, "");
new string[256];
new name[MAX_PLAYER_NAME];
GetPlayerName(i, name, sizeof name);
SetPlayerPos(i, 366.0407,-1892.6018,1.6999);
SetPlayerCameraPos(i, 558.3660,-1964.6206,85.2497);
SetPlayerCameraLookAt(i, 419.0543,-1888.1879,23.8108);
TogglePlayerControllable(i,0);
format(string, sizeof(string), "Salutare, %s! Bun venit pe rpg.test.ro!", name);
SendClientMessage(i, Weiß, string);
SendClientMessage(i, Weiß, "Serverul rpg.test.ro a fost deschis pe 15 septembrie 2014.");
SendClientMessage(i, Weiß, "Sunt 70 case si 35 business-uri pe server, iar in dealership sunt disponibile 101 modele diferite de masini.");
SendClientMessage(i, Weiß, "Daca joci pe rpg.test.ro, ai siguranta ca nu vor fi resetate niciodata datele(wipe) niciodata asa cum se intampla pe alte servere.");
SendClientMessage(i, Weiß, "Se fac updateuri frecvente la server, iar bugurile aparute sunt reparate rapid.");
SendClientMessage(i, Weiß, "Adminii si helperii sunt bine alesi si te pot ajuta cu orice problema.");
SendClientMessage(i, Weiß, "Intrebarile despre server le poti pune pe /n, iar daca ai o problema poti folosi /report.");
SendClientMessage(i, Weiß, "In continuare iti vom prezenta cateva informatii despre joc.");
}
else if(TutTime[i] == 15)
{
TextDrawHideForPlayer(i, Step[i][1]);
TextDrawShowForPlayer(i, Step[i][2]);
SetPlayerPos(i, 1857.4175,-1847.2292,13.5815);
SetPlayerCameraPos(i, 1794.2242,-1819.9382,38.3741);
SetPlayerCameraLookAt(i, 1830.4750,-1840.9551,15.9818);
SendClientMessage(i, Weiß, "");
SendClientMessage(i, Weiß, "");
SendClientMessage(i, Weiß, "");
SendClientMessage(i, Weiß, "");
SendClientMessage(i, Weiß, "");
SendClientMessage(i, Weiß, "");
SendClientMessage(i, Weiß, "Acesta este un magazin 24/7, magazin de unde poti cumpara mai multe lucruri utile:");
SendClientMessage(i, Weiß, "- telefon - dupa ce cumperi un telefon, vei putea suna un player sau ii poti da sms.");
SendClientMessage(i, Weiß, "- agenda telefonica - vei putea afla numerele de telefon ale altor playeri folosind comanda /number.");
SendClientMessage(i, Weiß, "- walkie-talkie - walkie-talkie poate fi folosit pentru a discuta cu un grup de prieteni.");
SendClientMessage(i, Weiß, "Te lasam pe tine sa descoperi ce altceva poti cumpara din magazine.");
}
else if(TutTime[i] == 27)
{
TextDrawHideForPlayer(i, Step[i][2]);
TextDrawShowForPlayer(i, Step[i][3]);
SetPlayerPos(i, 1223.5475,-1881.3280,30.6971);
SetPlayerCameraPos(i, 1199.0161,-1862.7023,46.3864);
SetPlayerCameraLookAt(i, 1220.9999,-1838.0793,29.3740);
SendClientMessage(i, Weiß, "");
SendClientMessage(i, Weiß, "");
SendClientMessage(i, Weiß, "");
SendClientMessage(i, Weiß, "");
SendClientMessage(i, Weiß, "");
SendClientMessage(i, Weiß, "");
SendClientMessage(i, Weiß, "Aici poti da examen pentru a obtine permisul de conducere.");
SendClientMessage(i, Weiß, "Nu stii cum sa ajungi aici? Nicio problema. Poti folosi comanda /gps si vei putea alege 'Los Santos DMV' din lista.");
SendClientMessage(i, Weiß, "Comanda /gps poate fi folosita si pentru a afla unde sunt alte locatii importante de pe server.");
SendClientMessage(i, Weiß, "Dupa ce vei lua examenul vei primi permisul de conducere, vei putea conduce masini, dar nu avioane sau barci.");
SendClientMessage(i, Weiß, "Cand vei face level 3 vei putea cumpara si licenta pentru a putea conduce un avion, o barca sau pentru a cumpara arme."); SendClientMessage(i, Weiß, "Licentele vor expira dupa 40 ore de joc si va trebui sa dai examenele din nou pentru a le obtine.");
}
else if(TutTime[i] == 39)
{
TextDrawHideForPlayer(i, Step[i][3]);
TextDrawShowForPlayer(i, Step[i][4]);
SetPlayerPos(i, 414.1995,-1512.3070,31.5960);
SetPlayerCameraPos(i, 428.3816,-1493.0682,69.4719);
SetPlayerCameraLookAt(i, 338.5612,-1515.7255,45.6690);
SendClientMessage(i, Weiß, "");
SendClientMessage(i, Weiß, "");
SendClientMessage(i, Weiß, "");
SendClientMessage(i, Weiß, "");
SendClientMessage(i, Weiß, "");
SendClientMessage(i, Weiß, "");
SendClientMessage(i, Weiß, "Aici este Dealership-ul, adica locul de unde poti cumpara masini.");
SendClientMessage(i, Weiß, "Pentru a cumpara o masina personala ai nevoie de level 3 si de bani suficienti.");
SendClientMessage(i, Weiß, "Cea mai ieftina masina este Quad 300,000$, iar cea mai scumpa este Infernus si are pretul de 40,000,000$."); SendClientMessage(i, Weiß, "Sunt 45 modele diferite de masini in dealership.");
SendClientMessage(i, Weiß, "Dupa ce vei cumpara o masina personala vei putea incuia usile, o vei putea parca unde vrei si o vei putea localiza.");
SendClientMessage(i, Weiß, "Vei putea deasemenea sa vinzi masina sau sa faci schimb de masini cu un alt player.");
SendClientMessage(i, Weiß, "Poti detine maxim 1 masina personala(2 daca ai premium), 1 barca/avion si 1 motocicleta, iar masinile se spawneaza cu comanda /vehspawn.");
SendClientMessage(i, Weiß, "Pana ajungi la level 3 poti munci la unul in joburile disponibile.");
}
else if(TutTime[i] == 51)
{
TextDrawHideForPlayer(i, Step[i][4]);
TextDrawShowForPlayer(i, Step[i][5]);
SetPlayerPos(i, -35.6509,-1152.9932,1.1770);
SetPlayerCameraPos(i, -74.3290,-1074.9336,18.7807);
SetPlayerCameraLookAt(i, -65.9360,-1128.8743,1.0781);
SendClientMessage(i, Weiß, "");
SendClientMessage(i, Weiß, "");
SendClientMessage(i, Weiß, "");
SendClientMessage(i, Weiß, "");
SendClientMessage(i, Weiß, "");
SendClientMessage(i, Weiß, "");
SendClientMessage(i, Weiß, "Trucker(sofer de tir) este unul din cele 17 joburi disponibile pe serverul nostru.");
SendClientMessage(i, Weiß, "La acest job trebuie sa livrezi marfa dintr-un oras in altul.");
SendClientMessage(i, Weiß, "");
SendClientMessage(i, Weiß, "Pentru a vedea o lista cu joburile de pe server, foloseste comanda /jobs.");
SendClientMessage(i, Weiß, "La toate joburile se castiga la fel de multi bani, cu exceptia jobului de detectiv unde nu se castiga bani."); SendClientMessage(i, Weiß, "Poti testa toate joburile pentru a testa care iti place mai mult.");
SendClientMessage(i, Weiß, "Daca te plictisesti de un job, vei putea folosi comanda /quitjob pentru a renunta la el oricand.");
}
else if(TutTime[i] == 63)
{
TextDrawHideForPlayer(i, Step[i][5]);
TextDrawShowForPlayer(i, Step[i][6]);
SetPlayerPos(i, 1504.0387,-1664.6865,14.0031);
SetPlayerCameraPos(i, 1506.8416,-1697.2029,38.8016);
SetPlayerCameraLookAt(i, 1533.4709,-1680.9561,29.7199);
SendClientMessage(i, Weiß, "");
SendClientMessage(i, Weiß, "");
SendClientMessage(i, Weiß, "");
SendClientMessage(i, Weiß, "");
SendClientMessage(i, Weiß, "");
SendClientMessage(i, Weiß, "");
SendClientMessage(i, Weiß, "Politistii sunt impartiti in 3 factiuni: Los Santos Police Department, FBI, National Guard si Las Venturas Police Department.");
SendClientMessage(i, Weiß, "Vei putea aplica la una din cele 3 factiuni de politisti incepand cu level 5.");
SendClientMessage(i, Weiß, "Pana ajungi la level 3, vei putea aplica la factiunile Taxi, Paramedic, News Reporters, School Instructors incepand cu level 3.");
SendClientMessage(i, Weiß, "La factiunea Hitman Agency sau la una din cele 4 mafii, vei putea aplica incepand cu level 4.");
SendClientMessage(i, Weiß, "Aplicatiile se fac pe forum(www.test.ro).");
SendClientMessage(i, Weiß, "Cei care fac parte din factiuni primesc salarii saptamanale de la liderul factiunii.");
}
else if(TutTime[i] == 75)
{
TextDrawHideForPlayer(i, Step[i][6]);
TextDrawShowForPlayer(i, Step[i][7]);
SetPlayerPos(i, 1463.5978,-1050.0614,24.0156);
SetPlayerCameraPos(i, 1484.4119,-1049.7178,39.7065);
SetPlayerCameraLookAt(i, 1465.3987,-1025.0939,29.2015);
SendClientMessage(i, Weiß, "");
SendClientMessage(i, Weiß, "");
SendClientMessage(i, Weiß, "");
SendClientMessage(i, Weiß, "");
SendClientMessage(i, Weiß, "");
SendClientMessage(i, Weiß, "");
SendClientMessage(i, Weiß, "Aceasta este banca din orasul Los Santos.");
SendClientMessage(i, Weiß, "Banca poate fi folosita pentru a depune si retrage bani sau pentru a transfera bani unui alt player.");
SendClientMessage(i, Weiß, "Pentru banii depusi in banca vei primi dobanda odata pe ora.");
SendClientMessage(i, Weiß, "Banii primiti din payday ajung in contul bancar si va trebui sa mergeti la banca pentru a-i retrage.");
SendClientMessage(i, Weiß, "Te sfatuim sa nu imprumuti bani altor playeri deoarece nu au nicio garantie ca iti vor fi inapoiati.");
SendClientMessage(i, Weiß, "De asemenea, afacerile cu bani reali sau bunuri ce nu tin de joc(conturi steam, conturi pe alte server) sunt interzise."); SendClientMessage(i, Weiß, "Daca cineva iti propune sa cumperi o masina in joc pentru bani reali, te sfatuim sa-l raportezi folosind comanda /report.");
SendClientMessage(i, Weiß, "Playerii ce promit ca iti vor vinde bunuri in joc pentru bani reali nu iti vor da bunurile promise.");
}
else if(TutTime[i] == 87)
{
TextDrawHideForPlayer(i, Step[i][7]);
TextDrawShowForPlayer(i, Step[i][8]);
SetPlayerPos(i, 1093.7021,-1485.0731,15.7074);
SetPlayerCameraPos(i, 1065.9988,-1418.0643,56.6048);
SetPlayerCameraLookAt(i, 1127.9037,-1486.0226,22.7690);
SendClientMessage(i, Weiß, "");
SendClientMessage(i, Weiß, "");
SendClientMessage(i, Weiß, "");
SendClientMessage(i, Weiß, "");
SendClientMessage(i, Weiß, "");
SendClientMessage(i, Weiß, "");
SendClientMessage(i, Weiß, "Aici este CNN Los Santos, adica locul unde poti plasa anunturi pe server.");
SendClientMessage(i, Weiß, "Anunturile sunt vazute de toti playerii de pe server si sunt folosite pentru a vinde/cumpara/schimba bunuri pe server.");
SendClientMessage(i, Weiß, "Anunturile se folosesc doar pentru vanzari, cumparari si schimburi de bunuri.");
SendClientMessage(i, Weiß, "Vei putea scrie un anunt incepand cu level 4.");
SendClientMessage(i, Weiß, "");
SendClientMessage(i, Weiß, "Si pe forumul nostru www.test.ro exista o sectiune de vanzari unde playerii pot posta anunturi.");
}
else if(TutTime[i] == 99)
{
TextDrawHideForPlayer(i, Step[i][8]);
TextDrawHideForPlayer(i, Tutorial[i]);
SendClientMessage(i, Weiß, "");
SendClientMessage(i, Weiß, "");
SendClientMessage(i, Weiß, "");
SendClientMessage(i, Weiß, "");
SendClientMessage(i, Weiß, "");
SendClientMessage(i, Gelb, "Ai ajuns la sfarsitul tutorialului. Daca ai fost atent, ar trebui sa stii cateva lucruri despre joc.");
SendClientMessage(i, Gelb, "Daca ai vreo intrebare legata de joc, foloseste /n si helperii vor incerca sa te ajute.");
SendClientMessage(i, Gelb, "Poti folosi si /help pentru comenzi de baza.");
SendClientMessage(i, Gelb, "Distractie placuta!");
SetPlayerCheckpoint(i, 1219.2703,-1812.4130,16.5938, 4.0);
StopAudioStreamForPlayer(i);
}
else if(TutTime[i] == 101)
{
TutTime[i] = 0;
TogglePlayerControllable(i, 1);
SetCameraBehindPlayer(i);
TogglePlayerSpectating(i, 0);
ResetPlayerMoney(i);
GivePlayerMoney(i,50000);
SetPlayerInterior(i,0);
TogglePlayerControllable(i,true);
}
return 1;
}
public OnGameModeInit()
{
MySQLConnect();
LoadTextdraws();
SetGameModeText("Game-Mode");
return 1;
}
stock LoadTextdraws()
{
new i;
Tutorial[i] = TextDrawCreate(280.000000, 377.000000, "~y~Tutorial");
TextDrawLetterSize(Tutorial[i], 0.420000, 1.500000);
TextDrawSetShadow(Tutorial[i], 0);
TextDrawSetOutline(Tutorial[i], 1);
TextDrawFont(Tutorial[i], 2);
Step[i][1] = TextDrawCreate(282.000000, 390.000000, "~w~Step: ~r~1~w~/~r~8");
TextDrawLetterSize(Step[i][1], 0.470000, 1.500000);
TextDrawSetShadow(Step[i][1], 0);
TextDrawSetOutline(Step[i][1], 1);
TextDrawFont(Step[i][1], 2);
Step[i][2] = TextDrawCreate(282.000000, 390.000000, "~w~Step: ~r~2~w~/~r~8");
TextDrawLetterSize(Step[i][2], 0.470000, 1.500000);
TextDrawSetShadow(Step[i][2], 0);
TextDrawSetOutline(Step[i][2], 1);
TextDrawFont(Step[i][2], 2);
Step[i][3] = TextDrawCreate(282.000000, 390.000000, "~w~Step: ~r~3~w~/~r~8");
TextDrawLetterSize(Step[i][3], 0.470000, 1.500000);
TextDrawSetShadow(Step[i][3], 0);
TextDrawSetOutline(Step[i][3], 1);
TextDrawFont(Step[i][3], 2);
Step[i][4] = TextDrawCreate(282.000000, 390.000000, "~w~Step: ~r~4~w~/~r~8");
TextDrawLetterSize(Step[i][4], 0.470000, 1.500000);
TextDrawSetShadow(Step[i][4], 0);
TextDrawSetOutline(Step[i][4], 1);
TextDrawFont(Step[i][4], 2);
Step[i][5] = TextDrawCreate(282.000000, 390.000000, "~w~Step: ~r~5~w~/~r~8");
TextDrawLetterSize(Step[i][5], 0.470000, 1.500000);
TextDrawSetShadow(Step[i][5], 0);
TextDrawSetOutline(Step[i][5], 1);
TextDrawFont(Step[i][5], 2);
Step[i][6] = TextDrawCreate(282.000000, 390.000000, "~w~Step: ~r~6~w~/~r~8");
TextDrawLetterSize(Step[i][6], 0.470000, 1.500000);
TextDrawSetShadow(Step[i][6], 0);
TextDrawSetOutline(Step[i][6], 1);
TextDrawFont(Step[i][6], 2);
Step[i][7] = TextDrawCreate(282.000000, 390.000000, "~w~Step: ~r~7~w~/~r~8");
TextDrawLetterSize(Step[i][7], 0.470000, 1.500000);
TextDrawSetShadow(Step[i][7], 0);
TextDrawSetOutline(Step[i][7], 1);
TextDrawFont(Step[i][7], 2);
Step[i][8] = TextDrawCreate(282.000000, 390.000000, "~w~Step: ~r~8~w~/~r~8");
TextDrawLetterSize(Step[i][8], 0.470000, 1.500000);
TextDrawSetShadow(Step[i][8], 0);
TextDrawSetOutline(Step[i][8], 1);
TextDrawFont(Step[i][8], 2);
}
public OnGameModeExit()
{
mysql_close(handle);
return 1;
}
public OnPlayerRequestClass(playerid, classid)
{
return 1;
}
public OnPlayerConnect(playerid)
{
new query[100];
AfterTutorial[playerid] = 0;
TutTime[playerid] = 1;
mysql_format(handle, query, sizeof(query), "SELECT * FROM Accounts WHERE Name = '%s'", GetName(playerid));
mysql_tquery(handle, query, "OnPlayerLogin", "i", playerid);
return 1;
}
savePlayer(playerid)
{
if(P_Data[playerid][peingeloggt]==0)return 1;
//Speichern level,money
new query[128];
format(query,sizeof(query),"UPDATE Accounts SET pLevel='%i',money='%i',pAdmin='%i' WHERE id='%i'",P_Data[playerid][pLevel],GetPlayerMoney(playerid),P_Data[playerid][pAdmin],P_Data[playerid][pID]);
mysql_function_query(handle,query,false,"","");
return 1;
}
resetPlayer(playerid)
{
P_Data[playerid][pLevel]=0;
P_Data[playerid][peingeloggt]=0;
P_Data[playerid][pID]=0;
P_Data[playerid][pAdmin]=0;
return 1;
}
public OnPlayerLogin(playerid)
{
new rows, fields;
cache_get_data(rows, fields);
if(rows)
{
SendClientMessage(playerid, Hellblau, "SERVER: {FFFFFF}Wilkommen auf den Server von Laura.");
SendClientMessage(playerid, Hellblau, "SERVER: {FFFFFF}Du hast schon einen Registrierten Account, bitte log dich ein.");
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "SERVER: Login", "Willkommen zurück und viel Spaß!", "Login", "Beenden"); }
else
{
SendClientMessage(playerid, Hellblau, "SERVER: {FFFFFF}Wilkommen auf den Server von Laura.");
SendClientMessage(playerid, Hellblau, "SERVER: {FFFFFF}Du hast dich noch nicht Registriert. Bitte gebe ein Passwort ein und Registriere dich.");
ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "SERVER: Register", "Dein Passwort muss mindestens 1 Zeichen haben!\n\nWillkommen auf den Server von Laura.\n\nBitte geben sie ein Wunsch Passwort ein!", "Registrieren", "Beenden");
}
return 1;
}
public OnLogin(playerid)
{
new rows, fields,temporar[200];
cache_get_data(rows, fields);
if(rows)
{
P_Data[playerid][peingeloggt] = 1;
P_Data[playerid][pPasswort] = cache_get_field_content(0, "Passwort",temporar);
P_Data[playerid][pID] = cache_get_field_content_int(0, "ID");
P_Data[playerid][pLevel] = cache_get_field_content_int(0, "Level",handle);
SetPlayerScore(playerid,P_Data[playerid][pLevel]);
SetPlayerMoney(playerid,cache_get_field_content_int(0,"money",handle));
P_Data[playerid][pAdmin] = cache_get_field_content_int(0,"Admin",handle);
SpawnPlayer(playerid);
//printf("playerid: %i hat das Level: %i",playerid,P_Data[playerid][pLevel]); //überprüfen ob das Levelsystem klappt
}
else
{
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Falsches Passwort", "Bitte geben sie das richtige Passwort ein um weiter zu kommen.", "Login", "Beenden");
}
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
for(new i=0; i<sizeof(cInfo); i++)
{
if(cInfo[i][id_x]==0)continue;
if(cInfo[i][besitzer]!=P_Data[playerid][db_id])continue;
GetVehiclePos(cInfo[i][id_x],cInfo[i][c_x],cInfo[i][c_y],cInfo[i][c_z]);
GetVehicleZAngle(cInfo[i][id_x],cInfo[i][c_r]);
new query[256];
format(query,sizeof(query),"UPDATE autos SET x='%f',y='%f',z='%f',r='%f' WHERE id='%i'",cInfo[i][c_x],cInfo[i][c_y],cInfo[i][c_z],cInfo[i][c_r],cInfo[i][db_id]);
mysql_function_query(handle,query,false,"","");
DestroyVehicle(cInfo[i][id_x]);
cInfo[i][id_x]=0;
}
savePlayer(playerid);
resetPlayer(playerid);
return 1;
}
public OnPlayerSpawn(playerid)
{
TutTime[playerid] = 1;
SetPlayerSkin(playerid, 250);
SetPlayerPos(playerid, 621.0391, -1710.3828, 17.1719);
SetPlayerInterior(playerid,0);
SetPlayerVirtualWorld(playerid, 0);
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 carSavedToDB(carid)
{
P_Data[carid][db_id]=cache_insert_id(handle);
return 1;
}
saveCarToDB(playerid,carid)
{
new query[128];
format(query,sizeof(query),"INSERT INTO Autos (besitzer,model,x,y,z,r) VALUES ('%i','%i','%f','%f','%f','%f')",P_Data[playerid][db_id],P_Data[carid][model],P_Data[carid][c_x],P_Data[carid][c_y],P_Data[carid][c_z],P_Data[carid][c_r]);
mysql_function_query(handle,query,true,"carSavedToDB","i",carid);
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;
}
SetPlayerMoney(playerid,money)
{
ResetPlayerMoney(playerid);
GivePlayerMoney(playerid,money);
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
new query[128], ip[25];
switch(dialogid)
{
case DIALOG_REGISTER:
{
if(!response)
return Kick(playerid);
if(response)
{
if(!strlen(inputtext))
return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "Passwort incorecta!", "Introdu-ti o Passwort pentru a te inregistra pe server! n", "Inregistreaza", "Exit");
GetPlayerIp(playerid, ip, sizeof(ip));
mysql_format(handle, query, sizeof(query), "INSERT INTO Accounts (Name, Passwort, IP) VALUES ('%s', '%e', '%s')", GetName(playerid), inputtext, ip);
mysql_query(handle, query);
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Login", "Bitte gebe dein Passwort ein!", "Login", "Beenden");
}
return 1;
}
case DIALOG_LOGIN:
{
if(!response)
return Kick(playerid);
if(response)
{
if(!strlen(inputtext))
return ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Login", "Bitte gebe dein Passwort ein!", "Login", "Beenden");
mysql_format(handle, query, sizeof(query), "SELECT * FROM Accounts WHERE Passwort = '%e' LIMIT 0,1", inputtext);
mysql_tquery(handle, query, "OnLogin", "i", playerid);
}
return 1;
}
}
return 1;
}
public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
return 1;
}
//==============================Stock's==============================//
stock GetName(playerid)
{
new Name[MAX_PLAYER_NAME];
GetPlayerName(playerid, Name, sizeof(Name));
return Name;
}
//==============================Befehle==============================//
//Fahrzeuge_MYSQL
createPlayerCar(playerid,modelid,Float:x,Float:y,Float:z,Float:r)
{
for(new i=0; i<sizeof(P_Data); i++)
{
if(P_Data[i][id_x]!=0)continue;
GetPlayerName(playerid,P_Data[i][besitzer],MAX_PLAYER_NAME);
P_Data[i][c_x]=x;
P_Data[i][c_y]=y;
P_Data[i][c_z]=z;
P_Data[i][c_r]=r;
P_Data[i][model]=modelid;
P_Data[i][id_x] = CreateVehicle(modelid,x,y,z,r,-1,-1,-1);
new string[128];
format(string,sizeof(string),"Das Auto P_Data[%i] wurde erstellt.",i);
SendClientMessageToAll(Rot,string);
saveCarToDB(playerid,i);
return 1;
}
return 1;
}
//Userbefehle
CMD:pn(playerid,params[])
{
new ID,text[128];
if(sscanf(params,"us[128]",ID,text))return SendClientMessage(playerid,Rot,"INFO: /pn [playerid] [text]");
SendClientMessage(ID,Rot,text);
return 1;
}
CMD:help(playerid,params[])
{
SendClientMessage(playerid,Rot,"Bei Problemen Melde dich bei einem Admin");
return 1;
}
//Adminbefehle
CMD:setadmin(playerid,params[])
{
if(!isAdmin(playerid,4))return SendClientMessage(playerid,Rot,"Dein Adminrang ist zu niedrig.");
new ID,a_level;
if(sscanf(params,"ui",ID,a_level))return SendClientMessage(playerid,Rot,"INFO: /setadmin [playerid] [adminlevel]");
P_Data[pID][pAdmin]=a_level;
savePlayer(ID);
SendClientMessage(ID,Rot,"Dein Adminrang wurde geändert.");
SendClientMessage(playerid,Rot,"Du hast den Adminrang geändert.");
return 1;
}
isAdmin(playerid,a_level)
{
if(P_Data[playerid][pAdmin]>=a_level)return 1;
return 0;
}
CMD:neustart(playerid,params[])
{
if(!isAdmin(playerid,4))return SendClientMessage(playerid,Rot,"Dein Adminrang ist zu niedrig.");
SendRconCommand("gmx");
return 1;
}
//Admin_Fahrzeuge
CMD:delauto(playerid,params[])
{
if(!isAdmin(playerid,2))return SendClientMessage(playerid,Rot,"Dein Adminrang ist zu niedrig.");
if(!IsPlayerInAnyVehicle(playerid))return SendClientMessage(playerid,Rot,"Du bist in keinem Fahrzeug.");
DestroyVehicle(GetPlayerVehicleID(playerid));
return 1;
}
CMD:erstelleauto(playerid,params[])
{
if(!isAdmin(playerid,2))return SendClientMessage(playerid,Rot,"Dein Adminrang ist zu niedrig.");
new mID,ID;
if(sscanf(params,"ui",ID,mID))return SendClientMessage(playerid,Rot,"INFO: /createcar [playerid] [model]");
if(mID<400||mID>611)return SendClientMessage(playerid,Rot,"Ungültiges Model.");
new Float:xc,Float:yc,Float:zc,Float:rc;
GetPlayerPos(pID,xc,yc,zc);
GetPlayerFacingAngle(pID,rc);
createPlayerCar(pID,mID,xc,yc,zc,rc);
return 1;
}
//Testen
CMD:test(playerid,params[])
{
SendClientMessage(playerid,Rot,"Du hast /test eingegeben.");
return 1;
}
Alles anzeigen