Moin unzwar das Login /Register System istn bischen buggy meiner Meinung nach erkennt jemand Fehler von euch? helft mir bitte
#include <a_samp>
#include <dini>
new Text:Textdraw0;
new Text:Textdraw1;
new Text:Textdraw2;
enum SInfo
{
Adminlevel,
Fraktion,
sLogin
}
new SpielerInfo[MAX_PLAYERS][SInfo];
#define sFraktion "SAPD"
#define sFraktion "YAKUZA"
enum buildingsEnum{
Float:b_x,
Float:b_y,
Float:b_z,
Float:b_ix,
Float:b_iy,
Float:b_iz,
b_interior
}
new bInfo[][buildingsEnum] = {
{{2597.5662,1899.6418,11.0312,2324.419921,-1145.568359,1050.710083,12}}
};
#define REGISTER 1
#define LOGIN 2
#define DIENST 3
#if defined FILTERSCRIPT
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Blank Filterscript by your name here");
print("--------------------------------------\n");
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
#else
main()
{
print("\n----------------------------------");
print("Ultimate Roleplay");
print("----------------------------------\n");
}
#endif
public OnGameModeInit()
{
SetGameModeText("Ultimate Roleplay");
AddPlayerClass(101,396.8991,-1800.7217,7.8281,359.2034,0,0,0,0,0,0); //SPAWN
AddStaticVehicle(598,1585.5898,-1667.3009,5.6403,270.5964,1,1); // CHEF
AddStaticVehicle(598,1585.5647,-1671.6418,5.6395,268.9027,1,1); // CHEF1
AddStaticVehicle(596,1595.4156,-1710.8165,5.6109,359.0157,0,1); // CAR
AddStaticVehicle(596,1591.5466,-1710.7596,5.6110,0.6154,0,1); // CAR
AddStaticVehicle(596,1587.4186,-1710.9430,5.6111,359.1480,0,1); // CAR
AddStaticVehicle(596,1583.3184,-1710.4507,5.6107,358.7447,0,1); // CAR
AddStaticVehicle(596,1578.7417,-1711.0544,5.6119,0.9730,0,1); // CAR
AddStaticVehicle(596,1574.1879,-1710.6960,5.6120,358.2917,0,1); // CAR
AddStaticVehicle(596,1570.0138,-1710.7047,5.6119,358.8008,0,1); // CAR
AddStaticVehicle(482,2617.0520,1876.6816,10.9367,258.6439,48,48); // BURRITO
AddStaticVehicle(560,2611.1487,1884.2145,10.5518,0.0000,9,39); // BURRITO
AddStaticVehicle(522,2621.5264,1891.4010,10.4019,359.9968,3,8); // BURRITO
AddStaticVehicle(468,2621.1665,1886.7488,10.5184,0.0001,46,46); // BURRITO
AddStaticVehicle(575,2603.4546,1863.5947,10.4951,0.0010,19,96); // BURRITO
AddStaticVehicle(411,2604.3872,1854.9080,10.5415,358.3597,64,1); // BURRITO
AddStaticVehicle(580,2606.7605,1854.0605,10.5920,358.2290,81,81); // BURRITO
AddStaticVehicle(487,2610.2185,1842.2145,10.9798,359.8892,29,42); // BURRITO
AddStaticVehicle(480,2620.7720,1860.4423,10.5897,12.7465,12,12); // BURRITO
DisableInteriorEnterExits();
//Gebäude laden
for(new i=0; i<sizeof(bInfo); i++)
{
CreatePickup(1318,1,bInfo[i][b_x],bInfo[i][b_y],bInfo[i][b_z]);
}
LimitGlobalChatRadius(200.0);
Textdraw0 = TextDrawCreate(-1.000000, 427.000000, "I");
TextDrawBackgroundColor(Textdraw0, 255);
TextDrawFont(Textdraw0, 1);
TextDrawLetterSize(Textdraw0, 0.500000, 2.099999);
TextDrawColor(Textdraw0, -1);
TextDrawSetOutline(Textdraw0, 0);
TextDrawSetProportional(Textdraw0, 1);
TextDrawSetShadow(Textdraw0, 1);
TextDrawUseBox(Textdraw0, 1);
TextDrawBoxColor(Textdraw0, 255);
TextDrawTextSize(Textdraw0, 789.000000, 0.000000);
TextDrawSetSelectable(Textdraw0, 0);
Textdraw1 = TextDrawCreate(9.000000, 431.000000, "Ultimate Roleplay");
TextDrawBackgroundColor(Textdraw1, 255);
TextDrawFont(Textdraw1, 1);
TextDrawLetterSize(Textdraw1, 0.500000, 1.000000);
TextDrawColor(Textdraw1, 16777215);
TextDrawSetOutline(Textdraw1, 0);
TextDrawSetProportional(Textdraw1, 1);
TextDrawSetShadow(Textdraw1, 1);
TextDrawSetSelectable(Textdraw1, 0);
Textdraw2 = TextDrawCreate(166.000000, 432.000000, "2.0");
TextDrawBackgroundColor(Textdraw2, 255);
TextDrawFont(Textdraw2, 1);
TextDrawLetterSize(Textdraw2, 0.500000, 1.000000);
TextDrawColor(Textdraw2, -16776961);
TextDrawSetOutline(Textdraw2, 0);
TextDrawSetProportional(Textdraw2, 1);
TextDrawSetShadow(Textdraw2, 1);
TextDrawSetSelectable(Textdraw2, 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);
return 1;
}
public OnPlayerConnect(playerid)
{
TextDrawShowForPlayer(playerid,Textdraw0);
TextDrawShowForPlayer(playerid,Textdraw1);
TextDrawShowForPlayer(playerid,Textdraw2);
new Spieler[64];
new Sname[MAX_PLAYER_NAME];
GetPlayerName(playerid,Sname,sizeof(Sname));
format(Spieler,sizeof(Spieler),"/Spieler/%s.txt",Sname);
if(dini_Exists(Spieler))
{
ShowPlayerDialog(playerid,LOGIN,DIALOG_STYLE_INPUT,"Login","Dein Account wurde gefunden, bitte gebe nun dein Passwort ein.","Login","Abbrechen");
}
else
{
ShowPlayerDialog(playerid,REGISTER,DIALOG_STYLE_INPUT,"Registrieren","Bitte wähle ein Passwort um dir einen Account zu erstellen!","Registrieren","Abbrechen");
}
SpawnPlayer(playerid);
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
SpielerInfo[playerid][sLogin]= 0;
SpielerSpeichern(playerid);
ResetVariablen(playerid);
return 1;
}
public OnPlayerSpawn(playerid)
{
if(IstSpielerInFraktion(playerid, 0))
{
SetPlayerPos(playerid, 396.8991,-1800.7217,7.8281,359.2034);
SetPlayerColor(playerid,0xFFFFFFFF);
return 1;
}
if(IstSpielerInFraktion(playerid, 1))
{
SetPlayerPos(playerid,1552.4475,-1674.9885,16.1953,90);
SetPlayerColor(playerid,0xFFFFFFFF);
SetPlayerSkin(playerid, 283);
return 1;
}
if(IstSpielerInFraktion(playerid, 2))
{
SetPlayerPos(playerid,2596.9180,1897.2401,11.0312,183.2663);
SetPlayerColor(playerid,0xFFFFFFFF);
SetPlayerSkin(playerid, 186);
return 1;
}
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("/dienst", cmdtext, true, 10) == 0)
{
if(IstSpielerInFraktion(playerid, 1))
GivePlayerWeapon(playerid,24,0);
SendClientMessage(playerid,0xFFDC00FF,"Du hast deine Dienstwaffe aus dem Schrank genommen!");
return 1;
}
return 0;
}
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
SendClientMessage(playerid,0xFFFA00FF,"Du kannnst den Motor mit /motor starten");
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 == LOGIN)
{
if(response == 0)
{
SendClientMessage(playerid,0xFF0005FF,"Du hast den Login Vorgang abgebrochen!");
Kick(playerid);
return 1;
}
if(response == 1)
{
Login(playerid,(inputtext));
return 1;
}
}
if(dialogid == REGISTER)
{
if(response == 0)
{
SendClientMessage(playerid,0xFF0005FF,"Du hast den Registrierungsvorgang abgebrochen!");
Kick(playerid);
return 1;
}
if(response == 1)
{
if(!strlen(inputtext) == 0)
{
SendClientMessage(playerid,0xFF0005FF,"Bitte gebe ein Passwort ein!");
}
Register(playerid,(inputtext));
return 1;
}
}
return 1;
}
public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
return 1;
}
stock Register(playerid,key[])
{
new Spieler[64];
new Sname[MAX_PLAYER_NAME];
GetPlayerName(playerid,Sname,sizeof(Sname));
format(Spieler,sizeof(Spieler),"/Spieler/%s.txt",Sname);
dini_Create(Spieler);
dini_Set(Spieler,"Passwort",key);
SetPlayerScore(playerid,0);
return 1;
}
stock Login(playerid,key[])
{
new Spieler[64];
new Sname[MAX_PLAYER_NAME];
GetPlayerName(playerid,Sname,sizeof(Sname));
format(Spieler,sizeof(Spieler),"/Spieler/%s.txt",Sname);
if(!strcmp(key,dini_Get(Spieler,"Passwort"),false))
{
LoadAccount(playerid);
SendClientMessage(playerid,0x00FFE6FF,"Du hast dich erfolgreich eingeloggt!");
return 1;
}
else
{
SendClientMessage(playerid,0xFF0019FF,"Du hast ein falsches Passwort eingeben");
return 1;
}
}
stock LoadAccount(playerid)
{
new Spieler[64];
new Sname[MAX_PLAYER_NAME];
GetPlayerName(playerid,Sname,sizeof(Sname));
format(Spieler,sizeof(Spieler),"/Spieler/%s.txt",Sname);
SetPlayerScore(playerid,dini_Int(Spieler,"Level"));
GivePlayerMoney(playerid,dini_Int(Spieler,"Geld"));
SpielerInfo[playerid][Adminlevel]=dini_Int(Spieler,"Adminlevel");
SpielerInfo[playerid][Fraktion]=dini_Int(Spieler,"Fraktion");
SpielerInfo[playerid][sLogin]= 1;
return 1;
}
stock SpielerSpeichern(playerid)
{
new Spieler[64];
new Sname[MAX_PLAYER_NAME];
GetPlayerName(playerid,Sname,sizeof(Sname));
format(Spieler,sizeof(Spieler),"/Spieler/%s.txt",Sname);
dini_IntSet(Spieler,"Level",GetPlayerScore(playerid));
dini_IntSet(Spieler,"Geld",GetPlayerMoney(playerid));
dini_IntSet(Spieler,"Adminlevel",SpielerInfo[playerid][Adminlevel]);
dini_IntSet(Spieler,"Fraktion",SpielerInfo[playerid][Fraktion]);
return 1;
}
stock ResetVariablen(playerid)
{
SpielerInfo[playerid][Adminlevel]=0;
SpielerInfo[playerid][Fraktion]=0;
return 1;
}
stock IstSpielerLogged(playerid)
{
if(SpielerInfo[playerid][Login] == 1) return 1;
return 0;
}
stock IstSpielerInFraktion(playerid, fraktionsid)
{
if(SpielerInfo[playerid][Fraktion] == fraktionsid) return 1;
return 0;
}