Guten Tag
Ich habe Folgenes Problem, ich habe bei Mogly tutorial video angeschaut zum scripten und verstehe selber nicht voran das legt.
ich habe keine error und keine warnning aber nach registrerung kommt nicht.
das ist der code:
// Kevin-Script
#include <a_samp>
#include <a_mysql>
#include <md5>
#define MYSQL_HOST "127.0.0.1"
#define MYSQL_USER "root"
#define MYSQL_DATA "kevin-script"
#define MYSQL_PASS ""
#define Green 0xFF000FF
#define weiss 0xFFFFFFFF
new Handle;
enum playerInfo{
db_id,
pEingeloggt,
pNeuling,
pAlter,
pGeschlecht,
pSkin,
Float:pRussi,
Float:pLeben
}
new pInfo[MAX_PLAYERS][playerInfo];
#define DIALOG_REGISTER 1
#define DIALOG_CHAR1 2
#define DIALOG_CHAR2 3
#define DIALOG_CHAR3 4
#define DIALOG_LOGIN 5
main()
{
print("\n----------------------------------");
print(" Kevin-Script");
print("----------------------------------\n");
}
public OnGameModeInit()
{
SetGameModeText("Kevin-Script");
Handle=mysql_connect(MYSQL_HOST,MYSQL_USER,MYSQL_DATA,MYSQL_PASS);
if(mysql_errno() < 1)print("MYSQL: Die Verbindung wurde erfolgreich hergestellt."),
mysql_log(LOG_ALL);else print("MYSQL: Die Verbindung zum MYSQL Server konnte nicht hergestellt werden.| Server wird herundergefahren.");
return 1;
}
public OnGameModeExit()
{
return 1;
}
public OnPlayerRequestClass(playerid, classid)
{
SetSpawnInfo(playerid,0,0,0,0,0,0,0,0,0,0,0,0);
SpawnPlayer(playerid);
return 1;
}
public OnPlayerConnect(playerid)
{
new query[256];
mysql_format(Handle, query, sizeof(query),"SELECT * FROM user WHERE Username='%e'",Spielername(playerid));
mysql_tquery(Handle,query,"UserCheck","i",playerid);
ClearChat(playerid);
TogglePlayerSpectating(playerid,1);
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
return 1;
}
public OnPlayerSpawn(playerid)
{
SetPlayerVirtualWorld(playerid,0);
SetCameraBehindPlayer(playerid);
TogglePlayerControllable(playerid,1);
if(pInfo[playerid][pNeuling]==1)
{
ClearChat(playerid);
SendClientMessage(playerid,Green,"Es hallt:'Willkommen Am LS-Airport wir wünschen ihnen ein schönen aufenhalt'");
SetPlayerPos(playerid,1641.8796,-2333.6069,13.5469);
SetPlayerFacingAngle(playerid,1.0462);
pInfo[playerid][pNeuling]=0;
pInfo[playerid][pLeben]=100;
if(pInfo[playerid][pGeschlecht]==1)
{
SetPlayerSkin(playerid,60);
}
else
{
SetPlayerSkin(playerid,40);
}
GameTextForPlayer(playerid,"~y~Willkommen ~n~auf ~n~Den Besten ~g~ Server",6000,40);
}
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;
}
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[])
{
if(dialogid == DIALOG_REGISTER)
{
if(!response) return Kick(playerid);
SetPVarString(playerid,"passwortvar",inputtext);
if(strlen(inputtext) >= 4)
{
ShowPlayerDialog(playerid,DIALOG_CHAR1,DIALOG_STYLE_MSGBOX,"{00FFFA}Charackter 1/3","{FFFFFF}Welche Geschlecht bist du?","{00FFFA}Männlich","{00FFFA}Weiblich");
}
else
{
ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_PASSWORD,"{00FFFA}Neuanfang","{00FFFA}Herzlich Willkommen{FFFFFF},\n{FF0023}Fehler:{FFFFFF} Eingabe ist Falsch \n auf unserem Kevin-Script server bitte gebe ein Password für diessen Account an.","{00FFFA}Weiter","{00FFFA}Abbrechen");
}
}
if(dialogid == DIALOG_CHAR1)
{
if(response)
{
//männ
pInfo[playerid][pGeschlecht]=1;
ShowPlayerDialog(playerid,DIALOG_CHAR2,DIALOG_STYLE_LIST,"{00FFFA}Charackter 2/3","{00AFFF}Hast du die Regeln gelesen?\n{00FF14}Ja\n{FF002D}Nein\n{F000FF}Was es gibt Regeln?","{00FFFA}Weiter","{00FFFA}Abbrechen");
}
else
{
//weib
pInfo[playerid][pGeschlecht]=2;
ShowPlayerDialog(playerid,DIALOG_CHAR2,DIALOG_STYLE_LIST,"{00FFFA}Charackter 2/3","{00AFFF}Hast du die Regeln gelesen?\n{00FF14}Ja\n{FF002D}Nein\n{F000FF}Was es gibt Regeln?","{00FFFA}Weiter","{00FFFA}Abbrechen");
}
}
if(dialogid == DIALOG_CHAR2)
{
if(response)
{
if(listitem==0)
{
ShowPlayerDialog(playerid,DIALOG_CHAR2,DIALOG_STYLE_LIST,"{00FFFA}Charackter 2/3","{00AFFF}Hast du die Regeln gelesen?\n{00FF14}Ja\n{FF002D}Nein\n{F000FF}Was es gibt Regeln?","{00FFFA}Weiter","{00FFFA}Abbrechen");
}
if(listitem==1)
{
Kick(playerid);
}
if(listitem==2)
{
Kick(playerid);
}
if(listitem==3)
{
ShowPlayerDialog(playerid,DIALOG_CHAR3,DIALOG_STYLE_INPUT,"{00FFFA}Charackter 3/3","{FFFFFF}Gebe nun dein alter an","{00FFFA}Weiter","{00FFFA}Abbrechen");
}
}
else
{Kick(playerid);}
}
if(dialogid == DIALOG_CHAR3)
{
if(response)
{
if (IsNummeric(inputtext))
{
//new alterabfrage=strval(inputtext);
if(strval(inputtext)>=18 && strval (inputtext) <=48)
{
pInfo[playerid][pAlter]=strval (inputtext);
pInfo[playerid][pEingeloggt]=1;
pInfo[playerid][pNeuling]=1;
new query[256],passworteingabe[128];
GetPVarString(playerid,"passwortvar",passworteingabe,128);
mysql_format(Handle, query, sizeof(query), "INSERT INTO user (Username, Passwort) VALUES ('%e',MD5('%e'))",Spielername(playerid),passworteingabe);
mysql_function_query(Handle,query,true,"OnplayerRegister", "i",playerid);
printf("%s",query);
}
else
{
ShowPlayerDialog(playerid,DIALOG_CHAR3,DIALOG_STYLE_INPUT,"{00FFFA}Charackter 3/3","\n{FF0023}Fehler:{FFFFFF} Eingabe ist Falsch\n{FFFFFF}Gebe nun dein alter an","{00FFFA}Weiter","{00FFFA}Abbrechen");
}
}
else
{
ShowPlayerDialog(playerid,DIALOG_CHAR3,DIALOG_STYLE_INPUT,"{00FFFA}Charackter 3/3","\n{FF0023}Fehler:{FFFFFF} Eingabe ist Falsch\n{FFFFFF}Gebe nun dein alter an","{00FFFA}Weiter","{00FFFA}Abbrechen");
}
}
else
{Kick(playerid);}
}
return 1;
}
public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
return 1;
}
forward UserCheck(playerid);
public UserCheck(playerid)
{
new num_rows, num_fields;
cache_get_data(num_rows,num_fields,Handle);
SetPlayerVirtualWorld(playerid,1);
if(num_rows == 0)
{
//reg
ClearChat(playerid);
ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_PASSWORD,"{00FFFA}Neuanfang","{00FFFA}Herzlich Willkommen{FFFFFF},\n auf unserem Kevin-Script server bitte gebe ein Password für diessen Account an.","{00FFFA}Weiter","{00FFFA}Abbrechen");
}
else
{
//log
ClearChat(playerid);
ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_PASSWORD,"{00FFFA}Einloggen","{00FFFA}Willkommen zurück{FFFFFF},\n auf unserem Kevin-Script server bitte gebe dein Password für diessen Account an.","{00FFFA}Weiter","{00FFFA}Abbrechen");
}
return 1;
}
forward OnPlayerRegister(playerid);
public OnPlayerRegister(playerid)
{
pInfo[playerid][db_id]=cache_insert_id(Handle);
TogglePlayerSpectating(playerid,0);
SpawnPlayer(playerid);
SetCameraBehindPlayer(playerid);
return 1;
}
stock Spielername(playerid)
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,MAX_PLAYER_NAME);
return name;
}
stock ClearChat(playerid)
{
for(new i = 0;i<100;i++)
{
SendClientMessage(playerid,weiss,"");
}
return 1;
}
stock IsNummeric(string[])
{
for(new i=0,j=strlen(string);i<j;i++)
{
if((string[i] > '9' || string[i] < '0'))return 0;
}
return 1;
}
aber weiß nicht voran das liegt..