// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT
#include <a_samp>
#include <dini>
#include <MD5>
//farben
#define BLAU 0x0000FF00
#define ROT 0xFF000000
#define GRUEN 0x00FF0000
#define WEISS 0x00000000
#define SCHWARZ 0x000000FF
//dialog
#define REGISTER 1
#define LOGIN 2
//Enums
enum SpielerDaten
{
Adminlevel,
Level,
Fratkion,
Team,
};
new sSpieler[MAX_PLAYERS][SpielerDaten];
main()
new pizza; // pizzahuteingang
new pizzaex; //pizzahutausgang
new ammu; // ammunationenter
new ammuex; // ammunationexit
new deaglebuy; // deaglekaufpunkt
{
print("\n----------------------------------");
print(" Your Story [RP] - Beta Version 0.94");
print("----------------------------------\n");
}
public OnGameModeInit()
{
// Don't use these lines if it's a filterscript
SetGameModeText("Your Story by meL");
AddPlayerClass(230,2320.0598,-70.3293,26.4844,1.0448,43,10,0,0,0,0);
AddPlayerClass(212,2320.0598,-70.3293,26.4844,1.0448,43,10,0,0,0,0);
AddPlayerClass(137,2320.0598,-70.3293,26.4844,1.0448,43,10,0,0,0,0);
AddStaticVehicle(481,2319.8396,-76.4235,25.9999,2.7907,46,46); //fahrrad 1-3
AddStaticVehicle(481,2317.5886,-76.2019,25.9996,4.1695,46,46);
AddStaticVehicle(481,2315.4419,-75.8915,25.9993,0.9938,46,46);
DisableInteriorEnterExits();
pizza = CreatePickup(1318,1,2332.4329,75.1643,26.6210); //pizza station ein/ausgang
pizzaex = CreatePickup(1318,1,372.2419,-133.2569,1001.4922);
ammu = CreatePickup(1318,1,2333.5654,61.6528,26.7058); // ammu ein/aus
ammuex = CreatePickup(1318,1,285.8144,-86.2198,1001.5229);
deaglebuy = CreatePickup(1212,1,288.0807,-63.1561,1001.5156);
return 1;
}
public OnGameModeExit()
{
return 1;
}
public OnPlayerRequestClass(playerid, classid)
{
SetPlayerPos(playerid, 2320.0598,-70.3293,26.4844); // spawn + cordis
SetPlayerCameraPos(playerid, 2320.0176,-68.0995,26.4844);
SetPlayerCameraLookAt(playerid, 2320.0598,-70.3293,26.4844);
SetPlayerFacingAngle(playerid, 1.0448);
return 1;
}
public OnPlayerConnect(playerid)
{
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))
{
SendClientMessage(playerid,BLAU,"Herzlich Wilkommen zurück auf unserem Server.");
ShowPlayerDialog(playerid,LOGIN,DIALOG_STYLE_INPUT,"Login","Dein Account ist berreits Registriert bitte gebe dein Passwort ein um dich einzuloggen!","Login","Abbrechen");
return 1;
}
else
{
SendClientMessage(playerid,0x00C700FF,"Herzlich Wilkommen auf Your Story");
ShowPlayerDialog(playerid,REGISTER,DIALOG_STYLE_INPUT,"Registrieren","Bitte wähle ein Passwort um dir einen Account zu erstellen!","Registrieren","Abbrechen");
return 1; // start message
}
}
public OnPlayerDisconnect(playerid, reason)
{
SpielerSpeichern(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[])
{
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)
{
if(pickupid==pizza) // pizzastation eingang
{
SetPlayerInterior(playerid,5);
SetPlayerPos(playerid,372.0056,-129.9511,1001.4922);
SetPlayerFacingAngle(playerid,3.2254);
}
if(pickupid==pizzaex) //pizzastation ausgang
{
SetPlayerInterior(playerid,0);
SetPlayerPos(playerid,2335.6792,75.2164,26.4823);
SetPlayerFacingAngle(playerid,274.1166);
}
if(pickupid==ammu) // ammunation eingang
{
SetPlayerInterior(playerid,4);
SetPlayerPos(playerid,286.4715,-82.8574,1001.5156);
SetPlayerFacingAngle(playerid,0.2406);
}
if(pickupid==ammuex) // ammunation ausgang
{
SetPlayerInterior(playerid,0);
SetPlayerPos(playerid,2336.7234,61.9353,26.4808);
SetPlayerFacingAngle(playerid,273.5667);
}
if(pickupid==deaglebuy)
{
if(GetPlayerMoney(playerid)>249)
{
GivePlayerMoney(playerid,-250);
SendClientMessage(playerid,0xFFFA00FF,"Du hast eine Deagle gekauft!");
GivePlayerWeapon(playerid,24,50);
}
else
{
SendClientMessage(playerid,ROT,"Du hast nicht genug Geld für eine Deagle!");
}
}
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,BLAU,"Du hast den Login Vorgang abgebrochen.");
Kick(playerid);
return 1;
}
if(response == 1)
{
Login(playerid,MD5_Hash(inputtext));
}
return 1;
}
if(dialogid == REGISTER)
{
if(response == 0)
{
SendClientMessage(playerid,ROT,"Du hast die Registrierung abgebrochen.");
Kick(playerid);
return 1;
}
if(response == 1)
{
if(!strlen(inputtext))
{
SendClientMessage(playerid,BLAU,"Bitte gebe ein Passwort ein.");
ShowPlayerDialog(playerid,REGISTER,DIALOG_STYLE_INPUT,"Registrieren","Bitte wähle ein Passwort um dir einen Account zu erstellen!","Registrieren","Abbrechen");
return 1;
}
else
{
Register(playerid,MD5_Hash(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);
dini_IntSet(Spieler,"Adminlevel",0);
dini_IntSet(Spieler,"Level",0);
dini_IntSet(Spieler,"Fraktion",0);
dini_IntSet(Spieler,"Team",0);
SendClientMessage(playerid,BLAU,"Du hast dich erfolgreich registriert");
SpielerReset(playerid);
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))
{
SendClientMessage(playerid,BLAU,"Du hast dich erfolgreich eingeloggt");
SpielerLaden(playerid);
return 1;
}
else
{
SendClientMessage(playerid,BLAU,"Du hast ein falsches Passwort eingegeben");
Kick(playerid);
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);
if(dini_Exists(Spieler))
{
dini_IntSet(Spieler,"Adminlevel",sSpieler[playerid][Adminlevel]);
dini_IntSet(Spieler,"Level",sSpieler[playerid][Level]);
dini_IntSet(Spieler,"Fraktion",sSpieler[playerid][Fraktion]);
dini_IntSet(Spieler,"Team",sSpieler[playerid][Team]);
}
return 1;
}
stock SpielerLaden(playerid)
{
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))
{
SetPlayerScore(playerid,dini_Get(Spieler,"Level");
sSpieler[playerid][Adminlevel] = dini_Get(Spieler,"Adminlevel");
sSpieler[playerid][Level] = dini_Get(Spieler,"Level");
sSpieler[playerid][Fraktion] = dini_Get(Spieler,"Fraktion");
sSpieler[playerid][Team] = dini_Get(Spieler,"Team");
}
return 1;
}
stock SpielerReset(playerid)
{
sSpieler[playerid][Adminlevel] = 0;
sSpieler[playerid][Level] = 0;
sSpieler[playerid][Fraktion] = 0;
sSpieler[playerid][Team] = 0;
}
return 1;
}
}