Hallo Breadfish-Community,
ich habe seid heute angefangen zu Scripten und werde mich wohl öfters hier mal melden
Folgendes... Ich möchte ein Roleplay Script machen und bei meinem Register-System erstellt
dini die Spieler-File nicht. Aber ich weiß nicht warum...
Code
//Includes
#include <a_samp>
#include <dini>
//Definitionen (Farben)
#define C_WHITE 0xFAFAFAFF //#FAFAFA
#define C_RED 0xFF372EFF //#FF372E
#define C_BLACK 0x000000FF //000000
//Definitionen (Strings)
#define MAX_STRING 128
//Definitionen (Dialoge)
#define DIALOG_REGISTER1 0
#define DIALOG_REGISTER2 1
#define DIALOG_REGISTER3 2
#define DIALOG_REGISTER4 3
#define DIALOG_LOGIN 4
#define DIALOG_NOPW1 5
#define DIALOG_NOPW2 6
#define DIALOG_WRONGPW 7
//Definitionen (Abkürzungen)
#define SCM SendClientMessage
//Fertige MSG's
#define MSG_PREFIX "{FAFAFA}[{FF372E}NY-RP{FAFAFA}]"
//Enums (Login/Register)
new logged[MAX_PLAYERS];
enum pInfo
{
AdminLevel,
cash,
score,
}
new PlayerInfo[MAX_PLAYERS][pInfo];
main()
{
print("\nDas Script wurde erfolgreich gestartet!");
}
public OnGameModeInit()
{
// Don't use these lines if it's a filterscript
SetGameModeText("German RolePlay");
SetNameTagDrawDistance(30.0);
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);
return 1;
}
public OnPlayerConnect(playerid)
{
SetPlayerColor(playerid, C_BLACK);
new name[MAX_PLAYER_NAME];
new file[128];
GetPlayerName(playerid, name, sizeof(name));
format(file,sizeof(file),"/Spieler/%s.ini",name);
if(dini_Exists(file))
{
LoadPlayer(playerid);
logged[playerid] = 0;
SCM(playerid, C_WHITE, "Du hast dich eingeloggt");
}
else
{
CreatePlayer(playerid, "ben2001");
SCM(playerid, C_WHITE, "Du hast dich regristiert");
}
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
logged[playerid] = 0;
SavePlayer(playerid);
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[])
{
new String[MAX_STRING];
format(String, sizeof(String), "%s Den Befehl '{FF372E}%s{FAFAFA}' gibt es nicht! Benutze: {FF372E}/cmds", MSG_PREFIX, cmdtext);
return SCM(playerid, C_WHITE, String);
}
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[])
{
return 1;
}
public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
return 1;
}
stock CreatePlayer(playerid, string[])
{
new file[128];
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(file,sizeof(file),"/Spieler/%s.ini",name);
if(dini_Exists(file))
{
dini_IntSet(file, "score", PlayerInfo[playerid][score]);
dini_IntSet(file, "money", PlayerInfo[playerid][cash]);
dini_IntSet(file, "AdminLevel",PlayerInfo[playerid][AdminLevel]);
SCM(playerid, C_WHITE, "REGd");
} else {
dini_Create(file);
dini_Set(file, "password", string);
dini_IntSet(file, "AdminLevel",0);
/*dini_IntSet(file, "AdminLevel",PlayerInfo[playerid][AdminLevel] = 0);
dini_IntSet(file, "score", PlayerInfo[playerid][score] = 0);
dini_IntSet(file, "money", PlayerInfo[playerid][cash] = 500);*/
SCM(playerid, C_WHITE, "REGdifghaiugiuhag");
}
return 1;
}
stock RemovePlayer(playerid)
{
new file[128];
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(file,sizeof(file),"/Spieler/%s.ini",name);
if(dini_Exists(file))
{
dini_Remove(file);
} else {
}
return 1;
}
stock SavePlayer(playerid)
{
new file[128];
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(file,sizeof(file),"/Spieler/%s.ini",name);
if(dini_Exists(file))
{
dini_IntSet(file, "score", PlayerInfo[playerid][score]);
dini_IntSet(file, "money", PlayerInfo[playerid][cash]);
dini_IntSet(file, "AdminLevel",PlayerInfo[playerid][AdminLevel]);
}
return 1;
}
stock LoadPlayer(playerid)
{
new file[128];
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(file,sizeof(file),"/Spieler/%s.ini",name);
if(dini_Exists(file))
{
PlayerInfo[playerid][AdminLevel] = dini_Int(file, "AdminLevel");
SetPlayerScore(playerid, PlayerInfo[playerid][score]);
}
return 1;
}
Alles anzeigen