//PostNuke Wasteland Gamemode
//#define use_med//Use mapeditor
#if defined use_med
	#define med:: med_
#endif

stock IsPlayerFCNPC(playerid) {
	#pragma unused playerid
	return 0;
}

stock FCNPC_UnlinkFollowers(playerid) {
	#pragma unused playerid
	return 0;
}

#define PNWL_VERSION 			"0.1a"
#define GM_VERSION              "Alpha"
#define GM_CODENAME             "Lucem"
#define SAMP_VERSION 			"0.3x-R2"
#define LATEST_UPDATE 			"03.11.2013"
#define CORE_PATH               "/core"
#define CACHE_PATH              "/cache"
#define ERROR_PATH              "/errors"
#define LANG_PATH               "/lang"//not implemented yet
#define MISC_PATH               "/misc"
#define SQLITE_DB               #CORE_PATH"/db/main.db"
#define MYSQL_CONNECTION_FILE 	#CORE_PATH"/mysql.ini"
#define SOUND_PATH              "http://sounds.pnwl.de"
#include "misc/dialogs"
native sha1(const text[],hesh[]);
native md5(const text[],hesh[]);
#include <a_samp.inc>
#define gm_injection
DeAMXProtection()
{
	new a[][] = {"Unarmed (Fist)","Brass K"};
	#pragma unused a
}
#define DEFAULT_SKIN                   		(58)    	//Standartskin
#define USER_BAN_SYSTEM 					(-1)   		//ForenID des Systems
#define MAX_CHAT_MESSAGES_PER_10_SECONDS 	(20)    	//Anzahl
#define MAX_CMDS_PER_10_SECONDS 			(8)     	//Anzahl
#define MAX_MUTE_TIME                       (10)		//Sekunden
#define MAX_WRONG_PWS 						(5)			//Anzahl
#define MAX_BADWORD_WARNINGS                (15)		//In 5 Minuten
#define MAX_BADWORD_MUTE_TIME               (120)		//In Sekunden
#define WRONG_PW_BAN_TIME   				(20)		//In Minuten
#define PAYDAY_TIME                         (120)		//In Minuten
#define MAX_USER_NEEDED_FOR_CREATING_GANG   (5)     	//Benötigte Anzahl
#define MIN_GANG_NAME_LEN                   (3)     	//Länge des Namen
#define MAX_GANG_NAME_LEN                   (25)    	//Länge des Namen
#define UPDATE_SERVER_DATA                  (120)		//Sekunden
#define MAX_UCHAT_RANGE						(20.0)  	//Chatrange
#define MAX_CHAT_LEN						(100)   	//Textlänge im Chat
#define MAX_SKINS							(5)     	//Anzahl
#define MAX_GENERATED_SKINS                 (30)        //Anzahl der möglich generierten Skins
#define MAX_VORNAME_LEN     				(15)    	//Länge des Vornamen
#define MIN_VORNAME_LEN     				(3) 		//Länge des Vornamen
#define MAX_NACHNAME_LEN    				(15)    	//Länge des Nachnamen
#define MIN_NACHNAME_LEN    				(3)     	//Länge des Nachnamen
#define WBB_FULLMEMBER_GROUP_ID 			(19)		//WBB Gruppe für Fullmember
#define MAX_SAME_IP_CONNECTIONS 			(1)			//Maximale gleichzeitige IP verbindungen
#define MAX_DEVELOPER_PICKUPS   			(4)			//Anzahl
#define MAX_RCON_FAILED						(3)			//Versuche
#define RCON_FAIL_BAN_TIME					(1800)		//Sekunden
#define MAX_TMP_BAN_TIME					(120)		//Minuten
#define MAX_NO_DM_WARNINGS 					(8)			//Warnungen
#define NO_DM_BANTIME						(300)		//Sekunden
#define THROW_BACK_MULTI        			(4.0)   	//Map
#define THROW_BACK_MAX_DIST     			(15.0)  	//Map
#define MAX_SPREAD_DIST 					(25.0)  	//Maximale Distanz zum Schaden bei Schrotwaffen
#define MAX_SPREAD_DAMAGE   				(1.5)   	//Schadensmultiplikator bei Schrotwaffen bei Dist=0
#define MIN_SPREAD_DAMAGE    				(0.5)   	//Schadensmultiplikator bei Schrotwaffen bei Dist=MAX_SPREAD_DIST
#define PLAYER_DEATH_TIME                   (300)   	//Sekunden
#define VOTE_TIME                           (180)   	//Sekunden
#define DEFAULT_MAX_WEIGHT					(100.0) 	//Kilo
#define DEFAULT_AUSDAUER					(100.0) 	//Abstrakt
#define BOX_TIME                            (180)   	//Sekunden
#define ARMOUR_DAMAGE_MODIFIER  			(0.6)   	//Multiplikator
#define HEADSHOT_DAMAGE_MODIFIER  			(3.0)   	//Multiplikator
#define MAX_MUELLTONNEN						(15)    	//Anzahl
#define COUNT_LANDING_POINTS    			(5)     	//Anzahl
#define UP_SPEED    						(8.0)		//Mapeinheiten pro Sekunde
#define DOWN_SPEED  						(5.0)		//Mapeinheiten pro Sekunde
#define FLY_SPEED   						(33.0)		//Mapeinheiten pro Sekunde
#define FLY_Z_OFFSET    					(150.0) 	//Flughöhe in Mapeinheiten
#define flytime(%0,%1) 						floatround(((%0/%1)*950.0))//distance,speed
#define MAX_MINERS 							(16)    	//Anzahl
#define MAX_JAEGER_POS 						(16)    	//Anzahl
#define MAX_PIZZA_MENUES 					(3)     	//Anzahl
#define BASIC_HEAL 							(3.0)   	//HP
#define HEAL_RANGE  						(2.0)   	//Mapeinheiten
#define CACHED_LOGIN_VALIDATION             (60*24*7)	//Minuten
#define MAX_WEAPON_SLOTS                    (13)        //Anzahl der Waffenslots
#define MAX_ORIGINAL_WEAPONS                (43)        //Anazhl der originalen Waffen
#define CHAT_REMOVE_LINE                    (20)        //Zeit nach der der Chat geleert wird
#define MAX_CHAT_LINES                      (25)        //Anzahl
#define KO_TIME_TAZER                       (10)        //Sekunden
#define MAX_KO_TIME                         (60)        //Sekunden
#define WEAPON_BLEEDING_LEVEL               (0.2)       //HP pro Sekunde
#define MAX_BLEEDING_LEVEL                  (0.5)       //HP pro Sekunde
#define In2dArea(%0,%1,%2,%3,%4,%5) 		(%0 >= %2 && %0 <= %4 && %1 >= %3 && %1 <= %5)
#define PreloadAnimLib(%0,%1) 				ApplyAnimation(%0,%1,"null",0.0,0,0,0,0,0)
new string[1024];
#include "misc/yless_fixes"
#include "misc/samp_fix"
#include "n_lib/lib_sql"

//Tailor Schneider TEXTDRAWS
#define SELECTION_ITEMS			(21)
#define ITEMS_PER_LINE  		(7)
#define mui_DIALOG_BASE_X   	(75.0)
#define mui_DIALOG_BASE_Y   	(130.0)
#define mui_DIALOG_WIDTH    	(550.0)
#define mui_DIALOG_HEIGHT   	(180.0)
#define mui_SPRITE_DIM_X    	(60.0)
#define mui_SPRITE_DIM_Y    	(70.0)
enum p_weapon_s
{
	wWeaponID,
	wMagAmmo,
}
#define MAX_PLAYER_WEAPONS (4)
new Text:StatusProgressBg,
	PlayerText:pStatusProgressBar[MAX_PLAYERS],
	Text:AusdauerDraw,
	PlayerText:PlayerAusdauerDraw[MAX_PLAYERS] = {PlayerText:INVALID_TEXT_DRAW,...},
	PlayerCurrentWeaponSlot[MAX_PLAYERS],
	PlayerWeapon[MAX_PLAYERS][MAX_PLAYER_WEAPONS][p_weapon_s],
	PlayerText:WeaponAmmo[MAX_PLAYERS] = {PlayerText:INVALID_TEXT_DRAW,...},
	PlayerText:mui_CurrentPageTextDrawId[MAX_PLAYERS] = {PlayerText:INVALID_TEXT_DRAW,...},
	Text:mui_BackgroundTextDrawId = Text:INVALID_TEXT_DRAW,
	Text:mui_NextButtonTextDrawId = Text:INVALID_TEXT_DRAW,
	Text:mui_PrevButtonTextDrawId = Text:INVALID_TEXT_DRAW,
	PlayerText:mui_ItemSubtitle[MAX_PLAYERS][SELECTION_ITEMS],
	PlayerText:mui_SelectionItems[MAX_PLAYERS][SELECTION_ITEMS],
	mui_SelectionItemsTag[MAX_PLAYERS][SELECTION_ITEMS],
	mui_ItemAt[MAX_PLAYERS],
	Text:tailor_gHeaderTextDrawId	= Text:INVALID_TEXT_DRAW,
	Text:items_gHeaderTextDrawId	= Text:INVALID_TEXT_DRAW,
	tailor_SkinList[][2] =
	{
		{57,15},
		{58,53},
		{59,1},
		{60,1337},
		{0,0},
		{1,1},
		{2,2},
		{3,3},
		{4,4},
		{5,5},
		{6,6},
		{7,7},
		{8,8},
		{9,9},
		{10,10},
		{11,11},
		{12,12},
		{13,13},
		{14,14},
		{15,15},
		{16,16},
		{17,17},
		{18,18},
		{19,19},
		{20,20}
	},
	pSpeedoObjects[MAX_PLAYERS];
#define TOTAL_ITEMS sizeof(tailor_SkinList)

//Formatierungen
#define FORMAT_CHAT_INFO	"{77AE35}INFO: {F1F7DC}"
#define FORMAT_CHAT_INFO_N	"{C85135}INFO: {F1F7DC}"
#define FORMAT_CHAT_ERROR	"{C85135}ERROR: {F1F7DC}"

new const __SKINLIST[] = {58,78,79,95,135};

new const EssensmarkeGerichte[][] = {{1,2},{1,2},{1,2},{1,2},{1,2},{1,2},{1,2}};// itemid-anzahl
new	OilKeypad[6] = {-1,...};//pickups für die quest (ölpumpen)

enum mt_info
{
	bool:mActive,
	mPickup,
	Float:mPos[3],
	mReload[2],
	mItems[4],//Kann 4 verschiedene Items haben
}
new Muelltonne[MAX_MUELLTONNEN][mt_info];
stock CreateMuelltonne(Float:posx,Float:posy,Float:posz,item0=0,item1=0,item2=0,item3=0,reloadtime=300)
{
	for(new i; i<MAX_MUELLTONNEN; i++)
	{
	    if(!Muelltonne[i][mActive])
	    {
	        Muelltonne[i][mPickup] 		= CreatePickup(19132,1,posx,posy,posz,0);
	        Muelltonne[i][mActive]      = true;
	        Muelltonne[i][mReload][0]   = 0;
	        Muelltonne[i][mReload][1]   = reloadtime;
	        Muelltonne[i][mPos][0] 		= posx;
	        Muelltonne[i][mPos][1] 		= posy;
	        Muelltonne[i][mPos][2] 		= posz;
	        Muelltonne[i][mItems][0]    = item0;
	        Muelltonne[i][mItems][1]    = item1;
	        Muelltonne[i][mItems][2]    = item2;
	        Muelltonne[i][mItems][3]    = item3;
	        return i;
		}
	}
	return -1;
}
stock DeactivateMuelltonne(mID)
{
	if(Muelltonne[mID][mActive])
	{
	    DestroyPickup(Muelltonne[mID][mPickup]);
	    Muelltonne[mID][mPickup]    = 0;
	    Muelltonne[mID][mReload][0] = Muelltonne[mID][mReload][1];
	    return 1;
	}
	return 0;
}

new const waffenpreis[10]	= {0,1,2,3,4,5,6,7,8,9},
	liq_preis[6]			= {0,1,2,3,4,5},
	Float:liq_durst[6]		= {0.0,1.0,2.0,3.0,4.0,5.0};
new	PlayerText:textdraw_fix_perplayer[MAX_PLAYERS] = {PlayerText:INVALID_TEXT_DRAW,...},
	Text:textdraw_fix_global = Text:INVALID_TEXT_DRAW,
	Text:RealClock = Text:INVALID_TEXT_DRAW,
	BoxTime,
	BoxerID[2];
	
//new __PICKUP[MAX_DEVELOPER_PICKUPS+1/*0 is unused*/];  <-- finding in "lib_CORE"
enum dcomtit { comhead[30] }
new const DevComTitle[MAX_DEVELOPER_PICKUPS+1][dcomtit] = {
{"-"},                      //0
{"Fort Carson"},            //1
{"Erster Dungeon"},         //2
{"Who is your daddy?"},     //3
{"Best beer"}              	//4
};

enum balloon_info
{
	bBalloon,
	bTarget,
	bool:bMoving,
}
new BalloonInfo[balloon_info];

new const LandingNames[COUNT_LANDING_POINTS][] = {
	"Fort Carson",
	"Las Barrancas",
	"Las Payasadas",
	"Area 51",
	"El Quebrados"};

new const Float:land_point[COUNT_LANDING_POINTS][2][3] = {
{{ -142.6106, 1126.1630,18.8000},{ -135.7162,1118.8645,20.1966}},
{{ -861.7700, 1557.2321,23.1120},{ -856.0540,1556.0391,23.9632}},
{{ -250.6408, 2584.7214,62.6203},{ -254.6158,2590.8931,63.5703}},
{{  201.9837, 1881.4677,16.6481},{  197.3917,1875.6553,17.6481}},
{{-1523.9337, 2526.2536,54.7952},{-1524.7249,2520.0012,55.9064}}
};


new MinersObject[MAX_MINERS]				= {-1,...},
	Float:MinersHealth[MAX_MINERS] 			= {1000.0,...};
new	const Float:MinersPos[MAX_MINERS][6] 	= {
	{787.9872,2793.7009,-51.9906,0.0000,0.0000,40.0000},
	{761.9489,2839.4101,-60.7406,0.0000,0.0000,39.9957},
	{736.6352,2834.5324,-49.9906,0.0000,0.0000,39.9957},
	{765.3605,2865.2028,-52.9906,0.0000,0.0000,39.9957},
	{841.0783,2895.5539,-61.7406,348.4488,101.1473,7.1266},
	{836.3646,2913.4780,-51.6406,313.9881,191.5590,120.9631},
	{882.7902,2907.5639,-64.1406,313.9837,191.5576,120.9594},
	{928.6517,2922.0510,-56.6406,313.9837,191.5576,120.9594},
	{935.0304,2871.0664,-64.1406,313.9837,191.5576,120.9594},
	{900.5272,2846.6186,-62.8407,313.9837,191.5576,120.9594},
	{883.3283,2815.6386,-58.0657,313.9837,191.5576,190.9594},
	{832.5434,2818.9812,-62.0657,313.9782,191.5521,190.9588},
	{825.6491,2837.7841,-75.0657,7.2139,272.8398,351.0195},
	{840.0797,2873.9350,-75.0657,68.6552,359.3042,27.1886},
	{878.4739,2860.7363,-84.0657,68.6535,359.3023,27.1856},
	{881.0927,2871.6596,-75.0657,68.6535,359.3023,27.1856}};
	
new JaegersObject[MAX_JAEGER_POS] = {-1,...},
	Float:JaegersHealth[MAX_JAEGER_POS];
new	const Float:JaegersArea[2][2] = {
		{-1543.0136,1922.4699},//Min
	    {-1411.2137,2380.4003}};//Max

new Text3D:SportStudioTexts[3],
	SportstudioUse = 0b000;

#include "misc/weapon_info"
#include "misc/item_list"
#include "libraries/lib_CORE"
//#include "libraries/lib_ZNPC"

stock checkOnlineRecord(last_name[])
{
	new old_record = INI::GetValueAsInt(#MISC_PATH"/records.ini","value","MaxOnline");
	if(__SERVER[CONNECTED_PLAYERS] > old_record)
	{
	    format(string,sizeof(string),#FORMAT_CHAT_INFO"Userrekord vom %s gebrochen! Neuer Rekord: %d User.",INI::GetValue(#MISC_PATH"/records.ini","dateformat","MaxOnline"),__SERVER[CONNECTED_PLAYERS]);
	    print(string);
	    SendClientMessageToAll(GRUEN,string);
	    INI::SetInt(#MISC_PATH"/records.ini","value",__SERVER[CONNECTED_PLAYERS],"MaxOnline");
	    INI::SetInt(#MISC_PATH"/records.ini","timestamp",gettime(_,_,_),"MaxOnline");
	    new d[3];
	    getdate(d[0],d[1],d[2]);
	    format(string,sizeof(string),"%02d-%02d-%04d",d[2],d[1],d[0]);
	    INI::SetValue(#MISC_PATH"/records.ini","dateformat",string,"MaxOnline");
	    gettime(d[0],d[1],d[2]);
	    format(string,sizeof(string),"%d:%02d-%02d",d[0],d[1],d[2]);
	    INI::SetValue(#MISC_PATH"/records.ini","timeformat",string,"MaxOnline");
	    INI::SetValue(#MISC_PATH"/records.ini","lastuser",last_name,"MaxOnline");
	}
	else if(__SERVER[CONNECTED_PLAYERS] == old_record)
	{//Update des Rekordes
	    INI::SetInt(#MISC_PATH"/records.ini","newtimestamp",gettime(_,_,_),"MaxOnline");
	}
	return 0;
}

enum pizza_men_info { mname[30],mpreis,Float:mhunger,Float:mdurst,Float:mheal,mpoid }
new const food_PizzaMenu[MAX_PIZZA_MENUES][pizza_men_info] = {
{"Kleines Gericht",		10,		20.0,	15.0,	0.0, 	2218},
{"Mittleres Gericht",	18,		40.0,	30.0,	0.0, 	2219},
{"Grosses Gericht",		25,		60.0,	50.0, 	0.0,	2220}
};

#define SHOPSCREEN_WAFFEN	(0)
#define SHOPSCREEN_LIQUOR	(1)
#define SHOPSCREEN_PIZZA    (3)

public OnGameModeInit()
{
	mysql_debug(1);
    SendRconCommand("reloadlog");//delete server_log.txt -- buggy? oO
    DeAMXProtection();
	//MAX_PLAYER_ID = (GetMaxPlayers()-1);
    MapAndreas_Init(MAP_ANDREAS_MODE_MINIMAL);
    SetGameModeText("Endzeit RPG");
    format(string,sizeof(string),"hostname %s",Hostnames[0]);
    SendRconCommand(string);
    ////Basic settings///////////////
    CORE::OnSQLiteInit(SQLITE_DB);
	CORE::OnMySQLInit(MYSQL_CONNECTION_FILE);
	CORE::OnCoreInit();//Basic server settings
	CORE::ReloadBans();//Loading bans from db
	item::OnGamemodeInit();//Creating items
	CORE::LoadStats();//Loading statistics
	//mysql_query_once("UPDATE pnwl_user SET online='0' WHERE server='0'");
	/////////////////////////////////
	textdraw_fix_global = TextDrawCreate(0.0,0.0,"bugfix");//Bugfix
	//Starting basic-core systems////
    OnHouseInit();//loading houses
    car::OnVehicleSystemInit();//vehiclesystem
    cont::OnContainerLibInit();//containerlibrary
    iman::OnLibInit();//random itemspawns
    veg::OnVegetationInit();//planting vegetation
    craft_OnCraftInit();//initializing crafting library
    achievement::AchievementInit();//Creating textdraws for achievementsystem, caching of achievementids
    status::GlobalDrawInit();//creating status textdraws
    gang::OnGangInit();//gangs laden
    turf::OnTurfInit();//gangzonen lden
    CORE::LoadObjects();//Serversided Objects
    npc::LoadNPC();//loading npc configurations
    //FCNPC::InitZombies();//initializing zombie npcs
    achievement::SyncAchievements();//Syncing achievement related information
	/////////////////////////////////
	mysql_query_once("TRUNCATE pnwl_res_items");
    AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
	__SERVER[PAYDAY_ESSEN] = INI::GetValueAsInt(#CACHE_PATH"/payday.ini","essen");
	__SERVER[PREMIUM_COST] = 1.0;
	if(__SERVER[WOCHENTAG] == 6 || __SERVER[WOCHENTAG] == 7) __SERVER[PREMIUM_COST] *= 0.8;
	
	printf("%d Steine erstellt",miners_Create(20.0));
	printf("%d Tiere erstellt",jaegers_Create(20.0));
	//Balloonsystem
 	for(new lp; lp<COUNT_LANDING_POINTS; lp++)
	{
	    format(string,sizeof(string),"%s Landezone\n/reisen",LandingNames[lp]);
	    Create3DTextLabel(string,0x77AE35FF,land_point[lp][1][0],land_point[lp][1][1],land_point[lp][1][2],20.0,0);
	}
	BalloonInfo[bBalloon] = CreateObject(19332+random(6),land_point[0][0][0],land_point[0][0][1],land_point[0][0][2],0.0,0.0,0.0,400.0);
	for(new i; i<MAX_PLAYERS; i++) ResetVars(i);
	#include "misc/textdraws"
	//Timer Set///
	SetTimer("timer_1000",1000,true);
	SetTimer("timer_60000",60000,true);
	//////////////
	printf("::CORE => Timestamp = %d",gettime(_,_,_));
	printf("::CORE => Heapspace = %dkb",heapspace()/1024);
	printf("::CORE => GM Init took %d ms",GetTickCount()-__SERVER[START_COUNT]);
    GetNetworkStats(string,sizeof(string));
    printf("::CORE => NetworkStats = %s",string);
	return 1;
}

public OnGameModeExit()
{
	TextDrawDestroy(textdraw_fix_global);
	for(new i; i<25; i++) SendClientMessageToAll(-1," ");
	SendClientMessageToAll(-1,"::CORE.pnwl shutting down...");

	for(new i; i<MAX_PLAYERS; i++)			if(IsPlayerConnected(i) && !IsPlayerNPC(i)) Kick(i);
	for(new i; i<MAX_OBJECTS; i++)			if(IsValidObject(i)) DestroyObject(i);
	for(new i; i<MAX_3DTEXT_GLOBAL; i++)	if(Text3D:i != Text3D:INVALID_3DTEXT_ID) Delete3DTextLabel(Text3D:i);
	for(new i; i<MAX_PICKUPS; i++)			DestroyPickup(i);
	for(new i; i<MAX_TEXT_DRAWS; i++)		TextDrawDestroy(Text:i);
	for(new i; i<MAX_GANG_ZONES; i++)       GangZoneDestroy(i);
	
	mysql_close();
	printf("::CORE => EXITED AT %d",gettime(_,_,_));
    GetNetworkStats(string,sizeof(string));
    printf("::CORE => NetworkStats = %s",string);
    SetTimer("CORE_ExitServer",3000,false);
	return 1;
}

forward CORE::ExitServer();
public CORE::ExitServer()
{
	printf("::CORE => Initialisiere Crash...");
	new a=3, b[] = {1,2};
	return b[a];//Crash (array index out of bounds)
}

public OnPlayerRequestClass(playerid, classid)
{
	if(IsPlayerNPC(playerid)) return 1;
	w_SetPlayerPos(playerid, -2171.9487,973.8623,-4.0091);
	SetPlayerFacingAngle(playerid,30.0);
	SetPlayerCameraPos(playerid, 	-2174.2470,	977.0400, -3.51154);
	SetPlayerCameraLookAt(playerid, -2131.1857,	926.4575, -11.0415);
	SetPlayerInterior(playerid,0);
	SetPlayerVirtualWorld(playerid,(playerid+2000));
	SpawnPlayer(playerid);
	if(!PlayerEvent[playerid][LOGGED_IN]) PlayerInfo[playerid][Connection] = 4;
	return 1;
}

public OnPlayerConnect(playerid)
{
    ResetVars(playerid);
	format(string,sizeof(string),"PNWL Version %s \"%s\" für SA:MP %s. Updated am %s",PNWL_VERSION,GM_VERSION,SAMP_VERSION,LATEST_UPDATE);
	SendClientMessage(playerid,GRUEN,string);
    GetPlayerIp(playerid, PlayerInfo[playerid][IP], 16);
    GetPlayerName(playerid,PlayerInfo[playerid][pName],MAX_PLAYER_NAME);

	if(IsPlayerFCNPC(playerid)) return 1;
	__SERVER[CONNECTED_PLAYERS]++;
	if(playerid >= __SERVER[HIGHEST_PLAYER_ID]) __SERVER[HIGHEST_PLAYER_ID] = (playerid+1);
    if(IsPlayerNPC(playerid))
	{
		new timestamp = gettime(_,_,_);

	    new npc_id = npc::IdByName(GetName(playerid));
	    if(npc_list:npc_id != NPC_NONE)
		{
			NpcID[npc_list:npc_id]			= playerid;
        	NpcOnline[npc_list:npc_id]		= timestamp<=0?1:timestamp;
	    	PlayerInfo[playerid][Nametag]	= Create3DTextLabel(GetName(playerid), 0x3365FFFF, 0.0, 0.0, 0.0, 30.0, 0);
	    	Attach3DTextLabelToPlayer(PlayerInfo[playerid][Nametag], playerid, 0.0, 0.0, 0.2);
        }
        
		new hour,minute;
		gettime(hour,minute);
	    format(string,sizeof(string),#FORMAT_CHAT_INFO"[NPC] %s hat den Server betreten (%d:%02d Uhr).",PlayerInfo[playerid][pName],hour,minute);
	    SendClientMessageToAll(GRUEN,string);
	    checkOnlineRecord(GetName(playerid));
		return 1;
    }
    PlayerInfo[playerid][PLAYER_ID] = mysql_GetIntByString("pnwl_user","userid","username",GetName(playerid));
    
    checkOnlineRecord(PlayerInfo[playerid][pName]);
	textdraw_fix_perplayer[playerid] = CreatePlayerTextDraw(playerid,0.0,0.0,".");
    fixed_TextDrawShowForPlayer(playerid,ScreenHide);

	WeaponAmmo[playerid] = CreatePlayerTextDraw(playerid,515.000000,63.000000,"0");
	PlayerTextDrawAlignment(playerid,WeaponAmmo[playerid], 3);
	PlayerTextDrawBackgroundColor(playerid,WeaponAmmo[playerid], 255);
	PlayerTextDrawFont(playerid,WeaponAmmo[playerid], 1);
	PlayerTextDrawLetterSize(playerid,WeaponAmmo[playerid], 0.420000, 1.400000);
	PlayerTextDrawColor(playerid,WeaponAmmo[playerid], 0x94B2D6FF);
	PlayerTextDrawSetOutline(playerid,WeaponAmmo[playerid], 0);
	PlayerTextDrawSetProportional(playerid,WeaponAmmo[playerid], 0);
	PlayerTextDrawSetShadow(playerid,WeaponAmmo[playerid], 1);
	mui_PlayerInit(playerid);

    new ip_connections = 0;
    for(new pid; pid<=__SERVER[HIGHEST_PLAYER_ID]; pid++)
    {
        if(!IsPlayerConnected(pid) || IsPlayerNPC(pid)) continue;
		if(!strcmp(GetIP(pid),GetIP(playerid))) ip_connections++;
    }
    if(ip_connections > MAX_SAME_IP_CONNECTIONS)
    {
        format(string,sizeof(string),"{C85135}ACHTUNG:\n\nEs bestehen zur Zeit %d Verbindungen mit der IP %s.\nDa zur Zeit nur %d Verbindungen der gleichen IP Adresse erlaubt sind müssen Sie\nunseren Server leider verlassen.\n\nVersuchen Sie es später erneut\nPostnukeWasteland.de",ip_connections,GetIP(playerid),MAX_SAME_IP_CONNECTIONS);
		ShowPlayerDialog(playerid,dialog_NULL,DIALOG_STYLE_MSGBOX,"{C85135}Zu viele Verbindungen",string,"Bye","");
		Kick(playerid);
        return 1;
    }

 	new timestamp 	= gettime(_,_,_),
		datats 		= (timestamp-(WRONG_PW_BAN_TIME*60));
	format(string,sizeof(string),"SELECT COUNT(*) FROM pnwl_user_logins WHERE success='0' AND timestamp>=%d AND (gpci='%s' OR ip='%s')",datats,GetGPCI(playerid),GetIP(playerid));
	SetPVarInt(playerid,"WrongPW",mysql_GetResultAsInt(string));
	if(GetPVarInt(playerid,"WrongPW") > MAX_WRONG_PWS)
	{
    	format(string,sizeof(string),"{F1F7DC}ACHTUNG\n\nDu wurdest temporal gesperrt (Code %s:%s).\n{FF6347}Grund: Passwort zu oft falsch eingegeben\n\n{F1F7DC}Um genauere Informationen zu erhalten wende dich bitte\nan einen Administrator. Vielen Dank fuer dein Verständnis",GetGPCI(playerid),GetIP(playerid));
		ShowPlayerDialog(playerid,0,DIALOG_STYLE_MSGBOX,"Du wurdest gesperrt",string,"Ok","");
	    Kick(playerid);
		return 1;
	}

	if(mysql_GetIntByInt("wcf0_user","banned","userID",PlayerInfo[playerid][PLAYER_ID]) == 1)
	{
	    format(string,sizeof(string),"%s",mysql_GetStringByInt("wcf0_user","username","userID",mysql_GetIntByInt("wcf0_user","banMod","userID",PlayerInfo[playerid][PLAYER_ID])));
	    format(query,sizeof(query),"%s",mysql_GetStringByInt("wcf0_user","banReason","userID",PlayerInfo[playerid][PLAYER_ID]));
    	format(string,sizeof(string),"{F1F7DC}ACHTUNG\n\nDein Benutzeraccount wurde von %s gesperrt.\n{FF6347}Grund: %s\n\n{F1F7DC}Um genauere Informationen zu erhalten wende dich bitte\nan einen Administrator. Vielen Dank fuer dein Verständnis",string?string:"<System>",query?query:"<Kein Grund vorhanden>");
		ShowPlayerDialog(playerid,0,DIALOG_STYLE_MSGBOX,"Dein Benutzeracount wurde gesperrt",string,"Ok","");
		Kick(playerid);
		mysql_free_result();
		return 1;
	}

	if(mysql_GetIntByInt("pnwl_user","banned","userid",PlayerInfo[playerid][PLAYER_ID]) == 1)
	{
	    format(string,sizeof(string),"%s",mysql_GetStringByInt("wcf0_user","username","userID",mysql_GetIntByInt("wcf0_user","banMod","userID",PlayerInfo[playerid][PLAYER_ID])));
 	    format(query,sizeof(query),"%s",mysql_GetStringByInt("pnwl_user","banReason","userid",PlayerInfo[playerid][PLAYER_ID]));
    	format(string,sizeof(string),"{F1F7DC}ACHTUNG\n\nDein Benutzeraccount wurde von %s gesperrt.\n{FF6347}Grund: %s\n\n{F1F7DC}Um genauere Informationen zu erhalten wende dich bitte\nan einen Administrator. Vielen Dank fuer dein Verständnis",string?string:"<System>",query?query:"<Kein Grund vorhanden>");
		ShowPlayerDialog(playerid,0,DIALOG_STYLE_MSGBOX,"Dein Benutzeracount wurde gesperrt",string,"Ok","");
		Kick(playerid);
		mysql_free_result();
		return 1;
	}
	
	format(string,sizeof(string),"SELECT * FROM pnwl_banned WHERE (gpci='%s' OR ip='%s' OR userid='%d') AND ((timestamp+time)>'%d' OR time='-1') ORDER BY timestamp DESC",GetGPCI(playerid),GetIP(playerid),PlayerInfo[playerid][PLAYER_ID],timestamp);
	mysql_query(string);
	mysql_store_result();
	if(mysql_num_rows() >= 1)
	{
		while(mysql_retrieve_row())
		{
			mysql_fetch_field_row(string,"userid");
			if(strval(string) != PlayerInfo[playerid][PLAYER_ID] && strval(string) >= 1)
			{//betrifft einen anderen user
			    continue;
			}

		    format(query,sizeof(query),"");
		    mysql_fetch_field_row(query,"reason");
	    	format(string,sizeof(string),"{F1F7DC}ACHTUNG\n\nDu wurdest temporal gesperrt\nCode %s>%s.\n\n{FF6347}Grund: %s\n\n{F1F7DC}Um genauere Informationen zu erhalten wende dich bitte\nan einen Administrator. Vielen Dank fuer dein Verständnis",GetIP(playerid),GetGPCI(playerid),query?query:"<Kein Grund vorhanden>");
			ShowPlayerDialog(playerid,0,DIALOG_STYLE_INPUT,"Du wurdest gesperrt",string,"Ok","");
			Kick(playerid);
			mysql_free_result();
			return 1;
		}
	}
	mysql_free_result();

	SetPlayerHealth(playerid,100.0);
 	CORE::RemoveBuildings(playerid);

	//Mapicons
	fixed_SetPlayerMapIcon(playerid,-218.8869,1119.1388,24.3752,36);//Stadthalle
	fixed_SetPlayerMapIcon(playerid,-169.2610,1116.0072,24.3752,35);//Hotel
	fixed_SetPlayerMapIcon(playerid,-210.2541,1171.4093,24.3752,22);//Medic FC
	fixed_SetPlayerMapIcon(playerid,-174.1408,1163.4119,24.3752,18);//Waffen FC
	fixed_SetPlayerMapIcon(playerid,-153.0531,1077.3798,24.3752,29);//Pizza FC
	fixed_SetPlayerMapIcon(playerid,-176.6172,1082.7015,24.3752,49);//Bar FC
	fixed_SetPlayerMapIcon(playerid,-92.6276,1377.2954,24.3752,49);//Lil Probe Inn
	fixed_SetPlayerMapIcon(playerid,-1511.2251,2567.1731,60.1434,54);//Sportstudio
	fixed_SetPlayerMapIcon(playerid,-1465.1908,2618.0913,61.6209,35);//Hotel EQ
	fixed_SetPlayerMapIcon(playerid,-1510.6984,2618.5740,61.6209,18);//Waffen EQ
	fixed_SetPlayerMapIcon(playerid,-2118.6000,1721.9000,21.2000,54);//Boxring Schrottstadt
 	for(new lp; lp<COUNT_LANDING_POINTS; lp++) fixed_SetPlayerMapIcon(playerid,land_point[lp][1][0],land_point[lp][1][1],land_point[lp][1][2],5);//Balloons
    fixed_SetPlayerMapIcon(playerid,-838.3779,2762.0925,46.0000,61);//Kawacatoose
	fixed_SetPlayerMapIcon(playerid,-841.3748,436.5292,7.1421,61);//Henry
	fixed_SetPlayerMapIcon(playerid,-149.9183,1903.6771,43.4313,61);//Mike
	fixed_SetPlayerMapIcon(playerid,-677.3391,940.6191,12.9519,61);//Travis
    fixed_SetPlayerMapIcon(playerid,-536.3696,1897.8206,107.9054,40);//Kirche
	//fixed_SetPlayerMapIcon(playerid,,40);//Moschee
    //fixed_SetPlayerMapIcon(playerid,,40);//Synagoge

	SetPlayerTime(playerid,__SERVER[GLOBAL_TIME][0],__SERVER[GLOBAL_TIME][1]);
	SetPlayerWeather(playerid,__SERVER[GLOBAL_WEATHER]);

	PlayerEvent[playerid][TutorialStep][0] 	= 0;
	PlayerEvent[playerid][TutorialStep][1] 	= 0;
	//CRaum zuruecksetzen
	PlayerInfo[playerid][IsInCRoom] 		= 0;
	PlayerInfo[playerid][CRoomAction] 		= 0;
	PlayerInfo[playerid][CRoomSubAction] 	= 0;
	Currentstep[playerid] = 0;//Cam Tutorial
    
	new player_name[MAX_PLAYER_NAME];
	GetPlayerName(playerid,player_name,sizeof(player_name));
    PlayerInfo[playerid][Nametag] = Create3DTextLabel(player_name, 0x008080FF, 0.0, 0.0, 0.0, 30.0, 0);
    Attach3DTextLabelToPlayer(PlayerInfo[playerid][Nametag], playerid, 0.0, 0.0, 0.2);
    UpdatePlayerNametag(playerid);

	w_SetPlayerPos(playerid, -2171.9487,973.8623,-4.0091);
	SetPlayerFacingAngle(playerid,30.0);
	SetPlayerInterior(playerid,0);
	SetPlayerVirtualWorld(playerid,(playerid+2000));
    TogglePlayerControllable(playerid,false);
    
    GameTextForPlayer(playerid,"~g~Willkommen",2000,1);
    SetSpawnInfo(playerid,0,58,-177.41159057617,1110.8359375,19.7421875,0.0,0,0,0,0,0,0);
	SpawnPlayer(playerid);
	return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
	if(IsPlayerNPC(playerid)) return 1;
	/////////////////////////////////////////////////////////////
	#if defined use_med
	if(med::OnDialogResponse(playerid, dialogid, response, listitem, inputtext) == 1) 			return 1;
	#endif
	if(car::OnDialogResponse(playerid, dialogid, response, listitem, inputtext) == 1) 			return 1;
	if(qOnDialogResponse(playerid, dialogid, response, listitem) == 1) 							return 1;
	if(haus_OnDialogResponse(playerid, dialogid, response, listitem, inputtext) == 1) 			return 1;
	if(item::OnDialogResponse(playerid, dialogid, response, listitem, inputtext) == 1) 			return 1;
	if(achievement::OnDialogResponse(playerid, dialogid, response, listitem, inputtext) == 1) 	return 1;
	if(cont::OnDialogResponse(playerid, dialogid, response, listitem, inputtext) == 1) 			return 1;
	if(veg::OnDialogResponse(playerid, dialogid, response, listitem, inputtext) == 1) 			return 1;
	if(craft_OnDialogResponse(playerid, dialogid, response, listitem, inputtext) == 1)  		return 1;
	/////////////////////////////////////////////////////////////
	switch(dialogid)
	{
	    case dialog_MAIN_SELECT_LANG:
		{
		    //l_SetPlayerLang(playerid,l_GetLangByID(listitem));

		    format(string,sizeof(string),"{F1F7DC}Du hast die Sprache \"Deutsch\" ausgewählt, ist das korrekt?"/*,l_GetLangByID(listitem)*/);
		    ShowPlayerDialog(playerid,dialog_MAIN_SELECT_LANGRE,DIALOG_STYLE_MSGBOX,"{F1F7DC}Sprachauswahl",string,"Ja","Nein");

			//format(string,sizeof(string),"UPDATE pnwl_user_option SET lang='%s' WHERE userid='%d'","de"/*l_GetLangByID(listitem)*/,PlayerInfo[playerid][PLAYER_ID]);
			//mysql_query_once(string);
		    return 1;
		}
	    case dialog_MAIN_SELECT_LANGRE:
		{
			if(response)
			{//Bestätigt
				PlayerEvent[playerid][TutorialStep][0] = 0;
				PlayerEvent[playerid][TutorialStep][1] = 0;
			    ShowPlayerDialog(playerid,dialog_TUTORIAL_SETVORNAME,DIALOG_STYLE_INPUT,"{F1F7DC}Charaktername","{F1F7DC}Bitte gebe den VORNAMEN deines InGame Charakters ein.\n\n{C85135}Achtung:\n- 3 bis 15 Zeichen\n- Keine Zahlen\n- Anfang des Namen groß\n- Keine großen Zeichen IM Namen\n- Mehrere Vornamen erlaubt","Weiter","");
			    w_SetPlayerPos(playerid, -2171.9487,973.8623,-4.0091);
			    SetPlayerFacingAngle(playerid,30.0);
                SetPlayerCameraInfoEx(playerid,Float:{-2174.5470703125, 975.0400390625, -3.5115416049957},Float:{-2168.2316894531, 968.06512451172, 61.956909179688}); //c1
				Currentstep[playerid] = 2;
				fixed_TextDrawShowForPlayer(playerid,Filmstreifen[0]);
				fixed_TextDrawShowForPlayer(playerid,Filmstreifen[1]);
			}
			else
			{//Fehler
			    language_menu(playerid);
			}
			return 1;
		}
		case dialog_NPC_CHUCK_MAINRE:
		{
		    format(string,sizeof(string),"{F1F7DC}Informationen\n\
		    Was bringt Ausdauer?\n\
		    Was bringt Stärke?\n\
		    Neuen Kampfstil erlernen");
		    ShowPlayerDialog(playerid,dialog_NPC_CHUCK_MAIN,DIALOG_STYLE_LIST,"{C87E35}Gespräch mit Chuck",string,"Weiter","Tschüss");
		    return 1;
		}
		case dialog_NPC_CHUCK_MAIN:
		{
		    if(!response) return 1;
		    switch(listitem)
		    {
		        case 0:
		        {//Informationen
					format(string,sizeof(string),"{C87E35}Chuck (Kampfsportler):\n\"{F1F7DC}\
					Moinsen\n\
					ich heiße Chuck und das hier ist mein Dojo. Vor einiger Zeit habe ich\n\
					mich dazu entschlossen meine jahrelange Erfahrung an eine neue Generation\n\
					weiter zu geben, damit diese den Mutanten ordentlich in den Arsch treten\n");
					strcat(string,"kann! Die Sportgeräte kann jeder benutzen:\n\
					- Das Fahrrad steigert deine Ausdauer\n\
					- Das Laufband steigert deine Ausdauer\n\
					- Die Hanteln steigern deine Kraft\n\
					Wenn du mental und physisch stark genug bist kann ich dir mein Wissen über\n\
					geheime Kampfkünste beibringen - also trainiere hart!{C87E35}\"");
				    ShowPlayerDialog(playerid,dialog_NPC_CHUCK_MAINRE,DIALOG_STYLE_MSGBOX,"{C87E35}Gespräch mit Chuck",string,"Zurück","");
				    return 1;
		        }
		        case 1:
		        {//Ausdauer
					format(string,sizeof(string),"{C87E35}Chuck (Kampfsportler):\n\"{F1F7DC}\
					Nunja, die Ausdauer bestimmt dein Durchhaltevermögen. So kannst du zum Beispiel\n\
					über lange Distanzen rennen ohne zu ermüden. Außerdem zehren Nahkampfangriffe\n\
					und -kombinationen an deiner Ausdauer. Wenn du zu erschöpft bist und deinen\n");
					strcat(string,"Körper überanstrengst kannst du zusammenbrechen. In einem richtigen Kampf ist das\n\
					fatal, also achte stets auf die Ausdaueranzeige über überlege, wann du einen\n\
					Nahkampfangriff einsetzt. Beim Training können jedoch auch andere >passive<\n\
					Skills leiden.{C87E35}\"");
		            ShowPlayerDialog(playerid,dialog_NPC_CHUCK_MAINRE,DIALOG_STYLE_MSGBOX,"{C87E35}Gespräch mit Chuck",string,"Zurück","");
		        }
		        case 2:
		        {//Kraft
					format(string,sizeof(string),"{C87E35}Chuck (Kampfsportler):\n\"{F1F7DC}\
					Neben das Ausdauer ist vor allem die Kraft wichtig. Sie bestimmt, wie du deinen Körper\n\
					belasten kannst. Je kräftiger du bist, desto mehr Gewicht kannst du tragen - das bedeutet,\n\
					dass du mehr Items und somit auch mehr Vorräte tragen kannst. Außerdem können deine\n");
					strcat(string,"Nahkampfangriffe gewaltige Schäden anrichten, wenn du deinen Körper richtig trainiert\n\
					hast. Beim Trainieren können jedoch auch andere >aktive< Skills leiden.{C87E35}\"");
		            ShowPlayerDialog(playerid,dialog_NPC_CHUCK_MAINRE,DIALOG_STYLE_MSGBOX,"{C87E35}Gespräch mit Chuck",string,"Zurück","");
		        }
		        case 3:
		        {//Neuen Kampfstil lernen
					format(string,sizeof(string),"{F1F7DC}\
					Normal\n\
					Boxing\n\
					Kung Fu\n\
					Kneehead\n\
					Grabkick\n\
					Elbow");
		            ShowPlayerDialog(playerid,dialog_NPC_CHUCK_LEARN_SELECT,DIALOG_STYLE_LIST,"{C87E35}Gespräch mit Chuck",string,"Erlernen","Zurück");
		        }
		    }
		    return 1;
		}
		case dialog_NPC_CHUCK_LEARN_SELECT:
		{
		    if(!response) return OnDialogResponse(playerid,dialog_NPC_CHUCK_MAINRE,1,0,"");
		    SetPVarInt(playerid,"cache_fightstyle",listitem);
		    format(string,sizeof(string),"{C87E35}Chuck (Kampfsportler):\n\"{F1F7DC}Okay %s, du möchtest von mir also in die hohen Künste des\n","as");
		    switch(listitem)
		    {
		        case 0:
		        {//Normal
					strcat(string,"normalen Kampfes eingeführt werden? Das ist eine ausgewogene\n\
					und leichte Technik, die allerdings auf nichts spezialisiert ist. Sie gewährt\n\
					dir folgende Attribute:\n\
					{F1F7DC}* {77AE35}+10%% eA\n\
					{F1F7DC}* {C85135}-5%% eB");
		        }
		        case 1:
		        {//Boxing
					strcat(string,"Boxkampfes eingeführt werden? bla bla bla bla\n\
					dir folgende Attribute:\n\
					{F1F7DC}* {77AE35}+10%% eA\n\
					{F1F7DC}* {C85135}-5%% eB");
				}
				case 2:
				{//Kungfu
					strcat(string,"Kung-Fu eingeführt werden? japsen shit usw\n\
					dir folgende Attribute:\n\
					{F1F7DC}* {77AE35}+10%% eA\n\
					{F1F7DC}* {C85135}-5%% eB");
				}
		        default: return 1;
		    }
		    strcat(string,"\n{F1F7DC}Möchtest du diese Technik lernen?{C87E35}\"");
		    ShowPlayerDialog(playerid,dialog_NPC_CHUCK_LEARN_GO,DIALOG_STYLE_MSGBOX,"{C87E35}Gespräch mit Chuck",string,"Training","Zurück");
		    return 1;
		}
		case dialog_NPC_CHUCK_LEARN_GO:
		{
		    if(!response) { DeletePVar(playerid,"cache_fightstyle"); return OnDialogResponse(playerid,dialog_NPC_CHUCK_MAIN,1,3,""); }
			SetPVarInt(playerid,"pev_training_fightstyle_step",1);
		    new style[] = {4,5,6,15,16,4};
		    if(!(GetPVarInt(playerid,"cache_fightstyle") >= 0 && GetPVarInt(playerid,"cache_fightstyle") < sizeof(style))) return 1;
			SetPlayerFightingStyle(playerid,style[GetPVarInt(playerid,"cache_fightstyle")]);			
			SetPlayerPos(playerid,-1471.5801,2614.0835,41.5738);
			SetPlayerFacingAngle(playerid,272.6473);
			fixed_SetPlayerWorldBounds(playerid,-1472.4191,-1466.5037,2611.3567,2617.1021);//Boxring
			SetCameraBehindPlayer(playerid);
			
		    SetPVarInt(playerid,"pev_training_fightstyle_value",10);
		    DisplayInfobox(playerid,"Training: ~r~Abwehr","~w~Gehe ~r~10~w~ Sekunden lang in die Abwehrposition.~n~=> Tastenkombo: ~g~RMB~w~+~g~LSHIFT");
		    format(string,sizeof(string),"{C87E35}Chuck (Kampfsportler):\n\"{F1F7DC}\
		    Alles klar aber bevor es zum Angriff übergeht musst du lernen,\n\
			wie man sich gegen Angriffe verteidigt. Dazu gehst du mit 10 Sekunden\n\
			lang in die Abwehrposition, indem du die rechte Maustaste \"RMB\" und\n\
			Shift \"LSHIFT\" drückst. Wie gesagt, die Position musst du 10 Sekunden\n\
			am Stück halten...{C87E35}\"");
		    ShowPlayerDialog(playerid,dialog_NULL,DIALOG_STYLE_MSGBOX,"{C87E35}Gespräch mit Chuck",string,"Weiter","");
		    return 1;
		}
		case dialog_NPC_MATHEO_MAINRE:
		{//Gespräch mit Matheo dem Liquorladenbesitzer
		    format(string,sizeof(string),"{F1F7DC}Informationen\nHandel");
		    if(PlayerNPC[playerid][NPC_MATHEO][cash] == 0) strcat(string," (kein Guthaben)");
		    else format(string,sizeof(string),"%s (%d Guthaben)",string,PlayerNPC[playerid][NPC_MATHEO][cash]);
		    strcat(string,"\nQuests\nAuf Wiedersehen");
		    ShowPlayerDialog(playerid,dialog_NPC_MATHEO_MAIN,DIALOG_STYLE_LIST,"{C87E35}Gespräch mit Matheo",string,"Weiter","Tschüss");
		    return 1;
		}
		case dialog_NPC_MATHEO_MAIN:
		{
		    if(response)
		    {
		        switch(listitem)
		        {
		            case 0:
		            {//Informationen
		                ShowPlayerDialog(playerid,dialog_NPC_MATHEO_MAINRE,DIALOG_STYLE_MSGBOX,"{C87E35}Gespräch mit Matheo","{C87E35}Matheo:\n\"{F1F7DC}\
						Bonjour!\n\
						Ich bin Matheo und führe bereits in der zweiten Generation\n\
						diesen exquisiten Spirituosenvertrieb. Schon meine Eltern\n\
						waren der Meinung man könne die Menschheit nur durch ein feines\n\
						Tröpfchen wieder zur zivilisierten Gesellschaft führen.\
						{C87E35}\"","Tschüss","");
		            }
		            case 1:
		            {//Handel
		                ShowPlayerDialog(playerid,dialog_NPC_MATHEO_ENTER_BUYMODE,DIALOG_STYLE_MSGBOX,"{C87E35}Gespräch mit Matheo","{C87E35}Matheo:\n\"{F1F7DC}\
						Sehr schön. Ich führe ausschließlich sehr exquisite Spirituosen\n\
						und andere äußerst qualitative Genussmittel in meinem Hause.{C87E35}\"\n\n\
						{878375}Hinweis: Gucke mit den Pfeiltasten <- und -> durch den Shop,\n\
						mit ENTER oder F kaufst du einen Artikel, mit LEERTASTE kannst\n\
						du den Laden wieder verlassen.","Einkaufen","");
		            }
		            case 2:
					{//Quests
		                ShowPlayerDialog(playerid,dialog_NPC_MATHEO_MAINRE,DIALOG_STYLE_MSGBOX,"{C87E35}Gespräch mit Matheo","{C87E35}Matheo:\n\"{F1F7DC}\
						Oh merci, dass du für mich arbeiten möchtest aber zur Zeit\n\
						habe ich leider keine Aufträge zu vergeben. Wenn du dich\n\
						später melden solltest können wir gucken, was sich da machen\n\
						lässt.\
						{C87E35}\"","Tschüss","");
					}
					default:
					{//Gespräch beenden
					    ShowPlayerDialog(playerid,dialog_NULL,DIALOG_STYLE_MSGBOX,"{C87E35}Gespräch mit Matheo","{C87E35}Matheo:\n\"{F1F7DC}Au revoir mon ami!{C87E35}\"","Tschüss","");
					}
		        }
		    }
		    return 1;
		}
		case dialog_NPC_MATHEO_ENTER_BUYMODE:
		{
			TogglePlayerControllable(playerid,false);
			SetPlayerPos(playerid,-234.3000031,2620.8999023,70.0999985);
			SetPlayerCameraInfoEx(playerid,Float:{-234.3000031,2620.8999023,64.0999985},Float:{-234.1999969,2622.6999512,63.5000000});
			SetPVarInt(playerid,"liq_store",1);
			SetPVarInt(playerid,"liq_pos",0);
			//PlayerShopDrawHide(playerid);
			//UpdatePlayerShopScreen(playerid,SHOPSCREEN_LIQUOR);
			UpdatePlayerShopScreen(playerid,SHOPSCREEN_LIQUOR);
		    return 1;
		}
	    case dialog_NPC_INDIAN_MAINRE:
		{//Gespräch mit dem Indianerleiter
		    new dlop = 0;
		    format(string,sizeof(string),"{F1F7DC}Informationen");
		    PlayerOption[playerid][dialog][dlop] = 0;
		    dlop++;

		    strcat(string,"\nHandel");
		    if(PlayerNPC[playerid][NPC_INDIAN][cash] == 0) strcat(string," (kein Guthaben)");
		    else format(string,sizeof(string),"%s (%d Guthaben)",string,PlayerNPC[playerid][NPC_INDIAN][cash]);
		    PlayerOption[playerid][dialog][dlop] = 1;
		    dlop++;

		    strcat(string,"\nQuests");
		    PlayerOption[playerid][dialog][dlop] = 2;
		    dlop++;

		    if(PlayerInfo[playerid][Job] == 0)
		    {
			    strcat(string,"\nBeruf ==> {C87E35}Jäger{F1F7DC} werden");
			    PlayerOption[playerid][dialog][dlop] = 3;
			    dlop++;
			}
			else if(JOB_LIST:PlayerInfo[playerid][Job] == JOB_JAEGER)
			{
			    strcat(string,"\nBerufhilfe ({C87E35}Jäger{F1F7DC})");
			    PlayerOption[playerid][dialog][dlop] = 4;
			    dlop++;

			    strcat(string,"\nEquipment (Beruf {C87E35}Jäger{F1F7DC})");
			    PlayerOption[playerid][dialog][dlop] = 5;
			    dlop++;
			}

		    strcat(string,"\nAuf Wiedersehen");
		    PlayerOption[playerid][dialog][dlop] = -1;
		    dlop++;

		    ShowPlayerDialog(playerid,dialog_NPC_INDIAN_MAIN,DIALOG_STYLE_LIST,"{C87E35}Gespräch mit Kawacatoose",string,"Weiter","Tschüss");
		    return 1;
		}
	    case dialog_NPC_INDIAN_MAIN:
		{
		    if(!response || GetDialogOption(playerid,listitem) == -1)
		    {//Bye
		        return 1;
		    }
		    switch(GetDialogOption(playerid,listitem))
		    {
		        case 0://Infos
		        {
					format(string,sizeof(string),"{C87E35}Kawacatoose (Indianer):\n\"{F1F7DC}\
					Sei gegrüßt.\nIch bin Kawacatoose, Indianerhäuptling des Stammes \"Shawnee\". Schon seit\n\
					Generationen leben wir hier in den nördlichen Wüstenteilen Robadas. Uns verbinden");
					strcat(string,"\nalte Tradition, wir schon seit Jahrhunderten weitergegeben werden und den\n\
					Geist der Shawnee am Leben erhalten.\nFremder, wie kann ich dir dienen?{C87E35}\"");
					
					ShowPlayerDialog(playerid,dialog_NPC_INDIAN_MAINRE,DIALOG_STYLE_MSGBOX,"{C87E35}Gespräch mit Kawacatoose",string,"Zurück","");
		        }
		        case 1://Handel
		        {
		            ShowPlayerDialog(playerid,dialog_NPC_INDIAN_MAINRE,DIALOG_STYLE_MSGBOX,"{C87E35}Gespräch mit Kawacatoose","{C87E35}Kawacatoose (Indianer):\n\"{F1F7DC}Zur Zeit betreibe ich keinen Handel{C87E35}\"","Zurück","");
		        }
		        case 2://Quests
				{
				    ShowPlayerDialog(playerid,dialog_NPC_INDIAN_MAINRE,DIALOG_STYLE_MSGBOX,"{C87E35}Gespräch mit Kawacatoose","{C87E35}Kawacatoose (Indianer):\n\"{F1F7DC}Zur Zeit habe ich keine Aufgaben für dich{C87E35}\"","Zurück","");
				}
			    case 3://Job annehmen
			    {
			        ShowPlayerDialog(playerid,dialog_NPC_INDIAN_JOB_CHECK,DIALOG_STYLE_MSGBOX,"{C87E35}Gespräch mit Kawacatoose","{C87E35}Kawacatoose (Indianer):\n\"{F1F7DC}\
					Sei gegrüßt.\n\
					Du möchtest also den heiligen Beruf des Jägers erlernen? Bevor\n\
					du eine Entscheidung triffst sei dir im Klaren, dass diese\n\
					Berufung von dir mindestens 10 Spielstunden lang ausgeführt werden\n\
					muss, bevor du dir einen neuen Job suchen kannst.\n\
					\n\
					Möchtest du nun Jäger werden?\
					{C87E35}\"","Ja","Nein");
			    }
			    case 4://Berufhilfe
			    {
			        ShowPlayerDialog(playerid,dialog_NPC_INDIAN_MAINRE,DIALOG_STYLE_MSGBOX,"{C87E35}Gespräch mit Kawacatoose","{C87E35}Kawacatoose (Indianer):\n\"{F1F7DC}Zur Zeit kann ich dir nicht helfen{C87E35}\"","Zurück","");
			    }
			    case 5://Berufequipment
			    {
			        ShowPlayerDialog(playerid,dialog_NPC_INDIAN_MAINRE,DIALOG_STYLE_MSGBOX,"{C87E35}Gespräch mit Kawacatoose","{C87E35}Kawacatoose (Indianer):\n\"{F1F7DC}Zur Zeit habe ich für dich keine Ausrüstung{C87E35}\"","Zurück","");
			    }
			    default://Unbekannt
			    {
			    }
		    }
		    return 1;
		}
	    case dialog_NPC_INDIAN_JOB_CHECK:
		{
		    if(!response) return OnDialogResponse(playerid,dialog_NPC_INDIAN_MAINRE,1,0,"");
		    //Job annehmen
		    job_OnPlayerChangeJob(playerid,JOB_JAEGER);
		    ShowPlayerDialog(playerid,dialog_NPC_INDIAN_MAINRE,DIALOG_STYLE_MSGBOX,"{C87E35}Gespräch mit Kawacatoose","\
			{C87E35}Kawacatoose (Indianer):\n\"{F1F7DC}\
			Herzlichen Glückwunsch, du bist jetzt ein Jäger der Shawnee. Gegen eine\n\
			kleine Gegenleistung biete ich dir ein traditionelles Jägerequipment an,\n\
			das dir bei der Ausübung des Berufes sicherlich helfen wird.\
			{C87E35}\"","Zurück","");
		    return 1;
		}
		case dialog_NPC_TRAVIS_MAINRE:
		{//Gespräch mit travis
			new dlop = 0;
			format(string,sizeof(string),"{F1F7DC}Informationen");
			PlayerOption[playerid][dialog][dlop] = 0;
			dlop++;

			strcat(string,"\nHandel");
			if(PlayerNPC[playerid][NPC_TRAVIS][cash] == 0) strcat(string," (kein Guthaben)");
			else format(string,sizeof(string),"%s (%d Guthaben)",string,PlayerNPC[playerid][NPC_TRAVIS][cash]);
			PlayerOption[playerid][dialog][dlop] = 1;
			dlop++;

			strcat(string,"\nQuests");
			PlayerOption[playerid][dialog][dlop] = 2;
			dlop++;

			if(PlayerInfo[playerid][Job] == 0)
			{
				strcat(string,"\nBeruf ==> {C87E35}Gärtner{F1F7DC} werden");
				PlayerOption[playerid][dialog][dlop] = 3;
				dlop++;
			}
			else if(JOB_LIST:PlayerInfo[playerid][Job] == JOB_HOLZFAELLER)
			{
				strcat(string,"\nBerufhilfe ({C87E35}Gärtner{F1F7DC})");
				PlayerOption[playerid][dialog][dlop] = 4;
				dlop++;

				strcat(string,"\nEquipment (Beruf {C87E35}Gärtner{F1F7DC})");
				PlayerOption[playerid][dialog][dlop] = 5;
				dlop++;
			}

			strcat(string,"\nAuf Wiedersehen");
			PlayerOption[playerid][dialog][dlop] = -1;
			dlop++;

			ShowPlayerDialog(playerid,dialog_NPC_TRAVIS_MAIN,DIALOG_STYLE_LIST,"{C87E35}Gespräch mit Travis",string,"Weiter","Tschüss");
			return 1;
		}
		case dialog_NPC_TRAVIS_MAIN:
		{
			if(!response || GetDialogOption(playerid,listitem) == -1)
			{//Bye
				return 1;
			}
			switch(GetDialogOption(playerid,listitem))
			{
				case 0://Infos
				{
					format(string,sizeof(string),"{C87E35}Travis (Gärtner):\n\"{F1F7DC}\
					Moin.\nMein Name is Travis, ich bin leidenschaftlicher Gärtner und bau auch gerne heißes\n\
					Zeug an um mir ne richtige Dröhnung zu verpassen. Ich kann dir gute Sachen verkaufen\n\
					oder - wenn du möchtest - dir das Handwerk eines richtigen Gärtners beibringen.{C87E35}\"");
					ShowPlayerDialog(playerid,dialog_NPC_TRAVIS_MAINRE,DIALOG_STYLE_MSGBOX,"{C87E35}Gespräch mit Travis",string,"Zurück","");
				}
				case 1://Handel
				{
					ShowPlayerDialog(playerid,dialog_NPC_TRAVIS_MAINRE,DIALOG_STYLE_MSGBOX,"{C87E35}Gespräch mit Travis","{C87E35}Travis (Gärtner):\n\"{F1F7DC}Zur Zeit betreibe ich keinen Handel{C87E35}\"","Zurück","");
				}
				case 2://Quests
				{
					ShowPlayerDialog(playerid,dialog_NPC_TRAVIS_MAINRE,DIALOG_STYLE_MSGBOX,"{C87E35}Gespräch mit Travis","{C87E35}Travis (Gärtner):\n\"{F1F7DC}Zur Zeit habe ich keine Aufgaben für dich{C87E35}\"","Zurück","");
				}
				case 3://Job annehmen
				{
					format(string,sizeof(string),"{C87E35}Travis (Gärtner):\n\"{F1F7DC}\
					Jau.\n\
					Du willst also eigenes Zeug anbauen? Sehr gute Entscheidung, damit\n\
					kannst du entweder super Stoff produzieren oder deine Erträge verkaufen.\n\
					Bevor du eine Entscheidung triffst sei dir im Klaren, dass du dann\n\
					mindestens 10 Spielstunden lang einen auf Öko machen");
					strcat(string," musst, ehe du\n\
					einen anderen Job ausüben kannst.\n\
					\nMöchtest du nun Gärtner werden?{C87E35}\"");
					ShowPlayerDialog(playerid,dialog_NPC_TRAVIS_JOB_CHECK,DIALOG_STYLE_MSGBOX,"{C87E35}Gespräch mit Travis",string,"Ja","Nein");
				}
				case 4://Berufhilfe
				{
					ShowPlayerDialog(playerid,dialog_NPC_TRAVIS_MAINRE,DIALOG_STYLE_MSGBOX,"{C87E35}Gespräch mit Travis","{C87E35}Travis (Gärtner):\n\"{F1F7DC}Zur Zeit kann ich dir nicht helfen{C87E35}\"","Zurück","");
				}
				case 5://Berufequipment
				{
					ShowPlayerDialog(playerid,dialog_NPC_TRAVIS_MAINRE,DIALOG_STYLE_MSGBOX,"{C87E35}Gespräch mit Travis","{C87E35}Travis (Gärtner):\n\"{F1F7DC}Zur Zeit habe ich für dich keine Ausrüstung{C87E35}\"","Zurück","");
				}
				default://Unbekannt
				{
				}
			}
			return 1;
		}
		case dialog_NPC_TRAVIS_JOB_CHECK:
		{
			if(!response) return OnDialogResponse(playerid,dialog_NPC_TRAVIS_MAINRE,1,0,"");
			//Job annehmen
			job_OnPlayerChangeJob(playerid,JOB_HOLZFAELLER);
			ShowPlayerDialog(playerid,dialog_NPC_TRAVIS_MAINRE,DIALOG_STYLE_MSGBOX,"{C87E35}Gespräch mit Travis","\
			{C87E35}Travis (Gärtner):\n\"{F1F7DC}\
			Herzlichen Glückwunsch, du bist jetzt ein Gärtner! Gegen eine kleine\n\
			Entschädigung gebe ich dir Equipment, mit dem du geiles Zeug anbauen\n\
			kannst.\
			{C87E35}\"","Zurück","");
			return 1;
		}
	    case dialog_NPC_RICHARD_MAIN,dialog_NPC_RICHARD_JOB_MAINRE:
		{//Gespräch mit dem Bürgermeister
		    if(listitem < 0) listitem = 0;
		    if(!response) PlayerOption[playerid][dialog][listitem] = -1;
	        if(dialogid == dialog_NPC_RICHARD_JOB_MAINRE) PlayerOption[playerid][dialog][listitem] = 1;//Jobs (MAIN)
		    switch(GetDialogOption(playerid,listitem))
		    {
		        case -1:
		        {//Tschüss
		        }
		        case 0:
		        {//Informationen
		            format(string,sizeof(string),"{C87E35}Richard (Bürgermeister): \"{F1F7DC}Hallo %s,\n\
					Ich bin Richard, der Bürgermeister Fort Carsons. Ich helfe Neuligen\n\
					Jobs zu finden, organisiere Events, verwalte den Papierkram und\n\
					solche Dinge...{C87E35}\"");
					ShowPlayerDialog(playerid,dialog_NPC_RICHARD_MAINRE,DIALOG_STYLE_MSGBOX,"Berufe bei PNWL.de",string,"Zurück","");
		        }
		        case 1:
		        {//Jobs (MAIN)
		            format(string,sizeof(string),"{F1F7DC}Allgemeine Informationen\nMinenarbeiter\nLandschaftsgärtner\nJäger\nKFZ Mechaniker");
		            ShowPlayerDialog(playerid,dialog_NPC_RICHARD_JOB_MAIN,DIALOG_STYLE_LIST,"Berufe bei PNWL.de",string,"Infos","Zurück");
		        }
			}
			return 1;
		}
	    case dialog_NPC_RICHARD_MAINRE:
		{
	        new dlop = 0;
			PlayerOption[playerid][dialog][dlop] = 0;
	        format(string,sizeof(string),"{F1F7DC}Informationen");
	        dlop++;
			if(PlayerInfo[playerid][Job] == 0)
			{
				PlayerOption[playerid][dialog][dlop] = 1;
	        	strcat(string,"\nJobs");
	        	dlop++;
	        }
			PlayerOption[playerid][dialog][dlop] = -1;
	    	strcat(string,"\nAuf Wiedersehen");
	    	dlop++;
	        ShowPlayerDialog(playerid,dialog_NPC_RICHARD_MAIN,DIALOG_STYLE_LIST,"{F1F7DC}Gespräch mit Richard",string,"Weiter","Tschüss");
	        return 1;
		}
	    case dialog_NPC_RICHARD_JOB_MAIN:
		{
		    if(!response)
		    {
		        OnDialogResponse(playerid,dialog_NPC_RICHARD_MAINRE,1,0,"");
		        return 1;
		    }
		    format(string,sizeof(string),"{F1F7DC}Error: INVALID J_ID");
		    switch(listitem)
		    {
		        case 0:
		        {//Informationen
		            format(string,sizeof(string),"{C87E35}Richard (Bürgermeister): \n\
					\"{F1F7DC}Du kannst verschiedene Berufe erlernen und somit Bonuspunkte auf\n\
		            spezielle Arbeiten erhalten. Durch diese Boni hast du bei der\n\
		            Ausübung von jenen Arbeiten Vorteile wie zum Beispiel eine erhöhte\n\
		            Chance auf Itemausbeute, ");
		            strcat(string,"Erfolgswahrscheinlichkeiten usw. Außerdem\n\
					bieten Berufe besondere Möglichkeiten, die du sonst nicht nutzen könntest.\n\
					Du kannst verschiedene Berufe an verschiedenen Orten in Robada Wasteland\n\
					erlernen.{C87E35}\"");
		        }
				case 1:
				{//Minenarbeiter
				    format(string,sizeof(string),"{F1F7DC}Beruf: Minenarbeiter\n\
					\n\
				    Als Minenarbeiter kannst du mit deinem Equipment in Minen verschiedene\n\
					Gesteine zertrümmern und somit Erze freilegen bzw. abbauen. Die gewonnenen\n\
					Items können zum Handel oder zur Weiterverarbeitung verwendet werden.\
					\n\
					Du kannst den Beruf vor dem ort:Dungeon1 bei bot:Unknown erlernen.");
				}
				case 2:
				{//Landschaftsgärtner
				    format(string,sizeof(string),"{F1F7DC}Beruf: Gärtner\n\
					\n\
				    Als Gärtner musst du geduldig sein, da du Pflanzen erst längere Zeit\n\
					heranwachsen lassen musst um die Früchte zu ernten. Früchte dienen\n\
					primär zur Nahrungsaufnahme, bestimmte Exemplare, wie zB Hanf, können\n\
					aber auch für andere Zwecke benutzt werden *zwinker*\
					\n\
					Du kannst den Beruf am an der Hütte westlich von Fort Carson jenseits\n\
					des ausgetrockneten Flusses von \"Travis\" erlernen.");
				}
				case 3:
				{//Jäger
				    format(string,sizeof(string),"{F1F7DC}Beruf: Jäger\n\
					\n\
				    Als Jäger kannst du wilde Tiere erlegen und mit deinem Messer ausweisen,\n\
				    dadurch kannst du nützliche Items erhalten, die eventuell weiterverarbeitet\n\
				    werden können.\
					\n\
					Du kannst den Beruf bei \"Kawacatoose\" im Shawnee Reservat erlernen,\n\
					das findest du im hohen Norden Robadas, westlich des stillgelegten\n\
					Militärflugplatzes und östlich der Stadt idk bitch.");
				}
				case 4:
				{//KFZ Mechaniker
				    format(string,sizeof(string),"{F1F7DC}Beruf: KFZ Mechaniker\n\
					\n\
					Als Mechaniker erhältst du einen Geschwindigkeitsbonus auf alle Reparaturen,\n\
					du kannst Motoren weiter reparieren als Leute, die keine Ahnung von\n\
					Kraftfahrzeugen haben. Außerdem ist das Risiko, dass Ersatzteile beim\n\
					Einbau zerstört werden, äußerst gering.\n\
					\n\
					Du kannst den Beruf bei \"Jason\" an der Tankstelle in Fort Carson\n\
					erlernen.");
				}
		    }
	        ShowPlayerDialog(playerid,dialog_NPC_RICHARD_JOB_MAINRE,DIALOG_STYLE_MSGBOX,"Berufe bei PNWL.de",string,"Zurück","");
		    return 1;
		}
		case dialog_NPC_WILFRIED_MAINRE:
		{
			new dlop = 0;
			PlayerOption[playerid][dialog][dlop] = 0;
			format(string,sizeof(string),"{F1F7DC}Informationen");
			dlop++;

			PlayerOption[playerid][dialog][dlop] = 1;
			strcat(string,"\nEssensmarke(n) einlösen");
			dlop++;
			
			PlayerOption[playerid][dialog][dlop] = 2;
			strcat(string,"\nQuests");
			dlop++;

			PlayerOption[playerid][dialog][dlop] = 3;
			strcat(string,"\nHandel");
			dlop++;
			
			PlayerOption[playerid][dialog][dlop] = 4;
			strcat(string,"\nAuf Wiedersehen");
			dlop++;

			ShowPlayerDialog(playerid,dialog_NPC_WILFRIED_MAIN,DIALOG_STYLE_LIST,"{F1F7DC}Gespräch mit Wilfried",string,"Weiter","Tschüss");
			return 1;
		}
		case dialog_NPC_WILFRIED_MAIN:
		{
		    if(response)
		    {
		        switch(GetDialogOption(playerid,listitem))
		        {
		            case 0:
		            {//Informationen
		                format(string,sizeof(string),"{C87E35}Wilfried (Küchengehilfe):\n\"{F1F7DC}\
						Tach, ich bin Wilfried.\n\
						Ich kümmer mich hier ums Futter für die Leude dieser Stadt.\n\
						Die Stadtverwaltung verteilt hin und wieder Essensmarken, die\n\
						kann man dann hier gegen das Tagesgericht eintauschen. Allerdings\n\
						bin ich mir nicht so sicher ob ich das wirklich essen will....");
						strcat(string,"\nAlso, willst du was zu fressen haben oder bist du hier, weil du\n\
						nen Job suchst!?{C87E35}\"");
						ShowPlayerDialog(playerid,dialog_NPC_WILFRIED_MAINRE,DIALOG_STYLE_MSGBOX,"{F1F7DC}Gespräch mit Wilfried",string,"Zurück","");
						return 1;
		            }
		            case 1:
		            {//PayDay
		                new marken = (PlayerEvent[playerid][PayDayTime]-(PlayerEvent[playerid][PayDayTime]%PAYDAY_TIME))/PAYDAY_TIME;
		                if(marken >= 1)
		                {
		                    format(string,sizeof(string),"{C87E35}Wilfried (Küchengehilfe):\n\"{F1F7DC}\
							Du hast also %d Essensmarken... Das Tagesgericht lautet:\n",marken);
			                format(string,sizeof(string),"%s{FFECAA}%d mal %s",string,EssensmarkeGerichte[__SERVER[PAYDAY_ESSEN]][0],EssensmarkeGerichte[__SERVER[PAYDAY_ESSEN]][1]);
		                    strcat(string,"\n{F1F7DC}Wie viele Portionen möchtest du haben?{C87E35}\"");
		                    ShowPlayerDialog(playerid,dialog_NPC_WILFRIED_PAYDAY,DIALOG_STYLE_MSGBOX,"{F1F7DC}Gespräch mit Wilfried",string,"Zurück","");
		                    return 1;
		                }
		                format(string,sizeof(string),"{C87E35}Wilfried (Küchengehilfe):\n\"{F1F7DC}\
						Willst du mich verarschen? Komm wieder, wenn du Essensmarken hast!\n\
						die nächste kriegste vielleicht in %d oder so...{C87E35}\"",(PAYDAY_TIME-PlayerEvent[playerid][PayDayTime]));
                        ShowPlayerDialog(playerid,dialog_NPC_WILFRIED_MAINRE,DIALOG_STYLE_MSGBOX,"{F1F7DC}Gespräch mit Wilfried",string,"Zurück","");
		            }
		            case 2:
		            {//quests
		                ShowPlayerDialog(playerid,dialog_NPC_WILFRIED_MAINRE,DIALOG_STYLE_MSGBOX,"{F1F7DC}Gespräch mit Wilfried","{C87E35}Wilfried (Küchengehilfe):\n\"{F1F7DC}Mein Gott, ich bin doch selber nur nen elender Küchengehilfe...\nWie soll ich dir denn bitteschön nen Job abieten können!?{C87E35}\"","Zurück","");
		            }
		            case 3:
					{//handel
					    ShowPlayerDialog(playerid,dialog_NPC_WILFRIED_MAINRE,DIALOG_STYLE_MSGBOX,"{F1F7DC}Gespräch mit Wilfried","{C87E35}Wilfried (Küchengehilfe):\n\"{F1F7DC}Wat? Du brauchst Essensmarken um was zu bekommen!{C87E35}\"","Zurück","");
					}
		            case 4:
		            {//Auf Wiedersehen
		            }
				}
			}
			return 1;
		}
		case dialog_NPC_WILFRIED_PAYDAY:
		{
		    if(!response || strval(inputtext) <= 0) return OnDialogResponse(playerid,dialog_NPC_WILFRIED_MAINRE,1,0,"");
		    new input 			= strval(inputtext),
		        marken 			= (PlayerEvent[playerid][PayDayTime]-(PlayerEvent[playerid][PayDayTime]%PAYDAY_TIME))/PAYDAY_TIME;
		    if(input > marken) input = marken;
			if(item::GivePlayerItem(playerid,EssensmarkeGerichte[__SERVER[PAYDAY_ESSEN]][1],EssensmarkeGerichte[__SERVER[PAYDAY_ESSEN]][0]))
			{
				PlayerEvent[playerid][PayDayTime] -= (input*PAYDAY_TIME);
				format(string,sizeof(string),"{C87E35}Wilfried (Küchengehilfe):\n\"{F1F7DC}Du hast %d Essensmarken eingetauscht. Guten Appetit!{C87E35}\"",input);
				ShowPlayerDialog(playerid,dialog_NPC_WILFRIED_MAINRE,DIALOG_STYLE_MSGBOX,"{F1F7DC}Gespräch mit Wilfried",string,"Zurück","");
			}
			else OnDialogResponse(playerid,dialog_NPC_WILFRIED_MAINRE,1,0,"");
			return 1;
		}
		case dialog_NPC_MIKE_MAINRE:
		{
			new dlop = 0;
			PlayerOption[playerid][dialog][dlop] = 0;
			format(string,sizeof(string),"{F1F7DC}Informationen");
			dlop++;

			PlayerOption[playerid][dialog][dlop] = 1;
			strcat(string,"\nQuests");
			dlop++;

			PlayerOption[playerid][dialog][dlop] = 2;
			format(string,sizeof(string),"%s\nHandel (%d gegeben)",string,PlayerNPC[playerid][NPC_MIKE][cash]);
			dlop++;

			PlayerOption[playerid][dialog][dlop] = -1;
			strcat(string,"\nAuf Wiedersehen");
			dlop++;

			ShowPlayerDialog(playerid,dialog_NPC_MIKE_MAIN,DIALOG_STYLE_LIST,"{F1F7DC}Gespräch mit Mike",string,"Weiter","Tschüss");
			return 1;
		}
		case dialog_NPC_MIKE_MAIN:
		{
		    if(response)
		    {
		        switch(GetDialogOption(playerid,listitem))
		        {
		            case 0:
		            {//Informationen
		                format(string,sizeof(string),"{C87E35}Mike (Urlauber):\n\"{F1F7DC}\
						Hm, hallo...\n\
						Ich bin übrigens Mike. Mit einigen Freunden wollte ich mich\n\
						hier ein bisschen amüsieren aber das Ganze ist wohl aus dem\n\
						Ruder gelaufen. Mitten in der Nacht ist eine Horde Zombies");
						strcat(string,"\noder so über uns hergefallen... Haben alle getötet... Ich\n\
						muss die Leichen - oder was davon übrig ist - verbrennen,\n\
						bevor diese auf mutieren. Hilfst du mir?{C87E35}\"");
						ShowPlayerDialog(playerid,dialog_NPC_MIKE_MAINRE,DIALOG_STYLE_MSGBOX,"{F1F7DC}Gespräch mit Mike",string,"Zurück","");
						return 1;
		            }
		            case 1:
		            {//Quests
		                new questid[5],quests=0,dlop=0;
		                questid[0] = quest::QuestIdByName("Leichen verbrennen");
		                questid[1] = quest::QuestIdByName("ASD1");
		                questid[2] = quest::QuestIdByName("ASD2");
		                format(string,sizeof(string),"{F1F7DC}");
						if(questid[0])
						{
						    if(quests != 0) strcat(string,"\n");
							if(quest::HasPlayerQuest(playerid,questid[0])) 	strcat(string,"\"Leichen verbrennen\" - läuft");
							else											format(string,sizeof(string),"%s\"Leichen verbrennen\" - %s",string,QuestDifficulty[QuestInfo[questid[0]][qDifficulty]]);
							quests++;
							PlayerOption[playerid][dialog][dlop] = 0;
		                }
		                if(quests > 0) ShowPlayerDialog(playerid,dialog_NPC_MIKE_QUESTS,DIALOG_STYLE_LIST,"{F1F7DC}Gespräch mit Mike",string,"Weiter","Zurück");
		                else ShowPlayerDialog(playerid,dialog_NPC_MIKE_MAINRE,DIALOG_STYLE_MSGBOX,"{F1F7DC}Gespräch mit Mike","{C87E35}Mike (Urlauber):\n\"{F1F7DC}Tut mir leid, momentan habe ich keine Quests für dich...{C87E35}\"","Zurück","");
		            }
		            case 2:
		            {//Handel
		                ShowPlayerDialog(playerid,dialog_NPC_MIKE_MAINRE,DIALOG_STYLE_MSGBOX,"{F1F7DC}Gespräch mit Mike","{C87E35}Mike (Urlauber):\n\"{F1F7DC}Tut mir leid, momentan habe ich nichts zum Verkaufen...{C87E35}\"","Zurück","");
		            }
		            default:
		            {//Auf Wiedersehen
		            }
		        }
		    }
		    return 1;
		}
		case dialog_NPC_MIKE_QUESTS:
		{
		    if(!response) return OnDialogResponse(playerid,dialog_NPC_MIKE_MAINRE,1,0,"");
		    switch(GetDialogOption(playerid,listitem))
		    {
		        case 0:
		        {//Leichen verbrennen
		            new questid = quest::QuestIdByName("Leichen verbrennen");
		            if(questid)
		            {
		                if(quest::HasPlayerQuest(playerid,questid)) ShowPlayerDialog(playerid,dialog_NPC_MIKE_MAINRE,DIALOG_STYLE_MSGBOX,"{F1F7DC}Gespräch mit Mike","{C87E35}Mike (Urlauber):\n\"{F1F7DC}Du erledigst bereits diese Quest für mich. Falls du das nicht\nmehr möchtest kannst du diese per \"/quest\" entfernen.{C87E35}\"","Zurück","");
		                else
		                {
		                    quest::AddPlayerQuest(playerid,questid);
		                    ShowPlayerDialog(playerid,dialog_NPC_MIKE_MAINRE,DIALOG_STYLE_MSGBOX,"{F1F7DC}Gespräch mit Mike","{C87E35}Mike (Urlauber):\n\"{F1F7DC}Vielen Dank! Genauere Informationen zu dieser Quest kannst du mit\n\"/quest\" abfragen.{C87E35}\"","Zurück","");
		                    return 1;
		                }
		            }
		            else OnDialogResponse(playerid,dialog_NPC_MIKE_MAINRE,1,0,"");
		        }
		    }
		    return 1;
		}
		case dialog_NPC_NICK_MAINRE:
		{
			new dlop = 0;
			PlayerOption[playerid][dialog][dlop] = 0;
			format(string,sizeof(string),"{F1F7DC}Informationen");
			dlop++;

			PlayerOption[playerid][dialog][dlop] = 1;
			strcat(string,"\nMedizinische Ausbildungen");
			dlop++;

			PlayerOption[playerid][dialog][dlop] = 2;
			format(string,sizeof(string),"%s\nHandel (%d gegeben)",string,PlayerNPC[playerid][NPC_NICK][cash]);
			dlop++;

			PlayerOption[playerid][dialog][dlop] = 3;
			strcat(string,"\nQuests");
			dlop++;

			PlayerOption[playerid][dialog][dlop] = -1;
			strcat(string,"\nAuf Wiedersehen");
			dlop++;

			ShowPlayerDialog(playerid,dialog_NPC_NICK_MAIN,DIALOG_STYLE_LIST,"{F1F7DC}Gespräch mit Dr. med. Riviera",string,"Weiter","Tschüss");
			return 1;
		}
		case dialog_NPC_NICK_MAIN:
		{
			if(!response || listitem < 0)
			{
				return 1;
			}
			switch(GetDialogOption(playerid,listitem))
			{
				case 0://Informationen
				{
					ShowPlayerDialog(playerid,dialog_NPC_NICK_MAINRE,DIALOG_STYLE_MSGBOX,"{F1F7DC}Gespräch mit Dr. med. Riviera","{C87E35}Dr. med. Nick Riviera (Arzt):\n\"{F1F7DC}\
					Hallo, alle miteinander!\n\
					Ich bin Doktor Nick Riviera, ihr Arzt für alles. Falls\n\
					ihnen ein lizensierter Mediziner zu kostspielig ist - dann\n\
					komme ich ins Spiel! Außerdem leite ich Ausbildungskurse,\n\
					damit ihr ein genauso guter Arzt werden könnt wie ich,\n\
					und treibe Handel mit Medikamenten{C87E35}\"","Zurück","");
					return 1;
				}
				case 1://Med. Ausbildungen
				{
					format(string,sizeof(string),"{C87E35}Dr. med. Nick Riviera (Arzt):\n\"{F1F7DC}\
					Sehr schön, es gibt keinen besseren, handwerklichen Nebenjob\n\
					als den Arzt. Entscheide dich für eine Trainingseinheit und\n\
					zahle mir eine kleine Entschädigung, dann werde ich dir die");
					strcat(string,"\nnotwendigen Dinge ruckzuck beibringen!{C87E35}\"\n\n\n{878375}\
					Hinweis: Steuere mit den Pfeiltasten. Mit [ENTER] oder [F]\n\
					wählst du ein Training aus, mit [LEER] schließt du das Menü.");
					ShowPlayerDialog(playerid,dialog_NULL,DIALOG_STYLE_MSGBOX,"{F1F7DC}Gespräch mit Dr. med. Riviera",string,"Zurück","");
					ShowInfoMessage(playerid,"Medizin ~<~ Auswahl ~>~ Operation~n~LEER = Zurueck");
					
					SetPlayerCameraInfoEx(playerid,Float:{2863.5618,-261.1241,52.7608},Float:{2864.3375,-257.9034,52.8658});//4-8
					PlayerCamera[playerid][camPOSto]    = Float:{2863.5618,-261.1241,52.7608};
					PlayerCamera[playerid][camLOOKto]   = Float:{2864.3375,-257.9034,52.8658};
					SetPVarInt(playerid,"hosp_cam",1);
					TogglePlayerControllable(playerid,false);
					cam_Ziel[playerid] 	= 0;
    				cam_Ort[playerid] 	= 4;
					return 1;
				}
				case 2://Handel
				{
					ShowPlayerDialog(playerid,dialog_NPC_NICK_MAINRE,DIALOG_STYLE_MSGBOX,"{F1F7DC}Gespräch mit Dr. med. Riviera","{C87E35}Dr. med. Nick Riviera (Arzt):\n\"{F1F7DC}\
					Oh, tut mir leid das sagen zu müssen aber zur Zeit kann\n\
					ich bedauerlicherweise keinen Handel mit medizinischen\n\
					Utensilien treiben.	Versuche es später erneut ;){C87E35}\"","Zurück","");
					return 1;
				}
				case 3://Quests
				{
					ShowPlayerDialog(playerid,dialog_NPC_NICK_MAINRE,DIALOG_STYLE_MSGBOX,"{F1F7DC}Gespräch mit Dr. med. Riviera","{C87E35}Dr. med. Nick Riviera (Arzt):\n\"{F1F7DC}\
					Oh, tut mir leid das sagen zu müssen aber zur Zeit kann\n\
					ich dir aufgrund der Faulheit des amtierenden Programmierers von\n\
					PNWL bedauerlicherweise keine Quests anbieten.\n\
					Versuche es später erneut ;){C87E35}\"","Zurück","");
					return 1;
				}
				default://Beenden
				{
					SetPVarInt(playerid,"npc_gespraech",0);
					SetPVarInt(playerid,"talk_to_npc",0);
					ShowPlayerDialog(playerid,dialog_NULL,DIALOG_STYLE_MSGBOX,"{F1F7DC}Gespräch mit Dr. med. Riviera","{C87E35}Dr. med. Nick Riviera (Arzt):\n\"{F1F7DC}\
					Macht's gut, liebe Freunde!{C87E35}\"","Zurück","");
					return 1;
				}
			}
			return 1;
		}
	    case dialog_CROOM_SI_MAIN:
		{
			if(!response) return 1;
			switch(listitem)
			{
			    case 0:
			    {//Entwicklerkommentare
					format(query,sizeof(query),"{F1F7DC}Entwicklerkommentare (%d/%d [%0.2f%%])",PlayerEvent[playerid][DevComment][1],MAX_DEVELOPER_PICKUPS,(float(PlayerEvent[playerid][DevComment][1])/float(MAX_DEVELOPER_PICKUPS))*100.0);
				    for(new i; i<(MAX_DEVELOPER_PICKUPS+1); i++)
				    {
				        if(PlayerEvent[playerid][DevComment][0] & (1<<i))
				        {//Hat den Kommentar bereits
				            if(i >= 1) format(string,sizeof(string),"%s\n%s",string,DevComTitle[i][comhead]);
				            else format(string,sizeof(string),"{F1F7DC}%s",DevComTitle[i][comhead]);
				            continue;
				        }
				        //Hat ihn noch nicht
				        if(i >= 1) strcat(string,"\n(Noch nicht gefunden)");
				        else format(string,sizeof(string),"{F1F7DC}(Noch nicht gefunden)");
				    }
			        ShowPlayerDialog(playerid,dialog_CROOM_SI_DEVCOM_MAIN,DIALOG_STYLE_LIST,query,string,"Angucken","Zurück");
					return 1;
			    }
			}
		    return 1;
		}
	    case dialog_CROOM_SI_DEVCOM_MAIN:
		{
		    if(!response)
		    {
	            format(string,sizeof(string),"{F1F7DC}Entwicklerkommentare (%d/%d)",PlayerEvent[playerid][DevComment][1],MAX_DEVELOPER_PICKUPS);
				ShowPlayerDialog(playerid,dialog_CROOM_SI_MAIN,DIALOG_STYLE_LIST,"{F1F7DC}Sammelobjekte",string,"Ok","Zurück");
		        return 1;
		    }
			if(!(PlayerEvent[playerid][DevComment][0] & (1<<listitem)))
		    {
		        ShowPlayerDialog(playerid,dialog_CROOM_SI_DEVCOM_MAINRE,DIALOG_STYLE_MSGBOX,"{F1F7DC}Entwicklerkommentare","{F1F7DC}Du hast diesen Entwicklerkommentar noch nicht gefunden.","Zurück","");
		        return 1;
		    }
		    ShowPlayerDevComment(playerid,listitem);
		    return 1;
		}
	    case dialog_CROOM_SI_DEVCOM_MAINRE:
		{
			OnDialogResponse(playerid,dialog_CROOM_SI_MAIN,1,0,"");//Liste der Kommentare erneut anzeigen, siehe oben ;)
		    return 1;
		}
	    case dialog_CROOM_SI_DEVCOM:
		{
	        if(GetPVarInt(playerid,"devc_new") == 1)
			{//Hat den Kommentar grade erst bekommen
				return 1;
			}
			if(PlayerInfo[playerid][IsInCRoom] == 1)
			{//Ist im Kontrollraum
			    OnDialogResponse(playerid,dialog_CROOM_SI_MAIN,1,0,"");//Liste der Kommentare erneut anzeigen, siehe oben ;)
			    return 1;
			}
			//Ungültig
			return 1;
		}
	    case dialog_NPC_PIZZA_MAIN:
		{
		    if(response == 0)
		    {
	    	    SetPVarInt(playerid,"pizzaladen",0);
	        	SetPVarInt(playerid,"menue",0);
	        	DeletePVar(playerid,"npc_gespräch");
	        	DeletePVar(playerid,"pizzaladen");
	        	DeletePVar(playerid,"menue");
			    UpdatePlayerShopScreen(playerid,SHOPSCREEN_PIZZA,false);
			    TogglePlayerControllable(playerid,true);
			    SetCameraBehindPlayer(playerid);
			    return 1;
		    }
			if(listitem == -1)
			{
	        	format(query,sizeof(query),"{C87E35}Pizza Joe (Laune: %d),",NPCInfo[NPC_JOE][laune]);
	       		format(string,sizeof(string),"{F1F7DC}Informationen\nEssen kaufen (%d gegeben)",PlayerNPC[playerid][NPC_JOE][cash]);
	       		ShowPlayerDialog(playerid,dialog_NPC_PIZZA_MAIN,DIALOG_STYLE_LIST,query,string,"Weiter","Bye");
	       		return 1;
			}
			switch(listitem)
			{
			    case 0:
			    {//Informationen
		        	format(query,sizeof(query),"{C87E35}Pizza Joe (Laune: %d),",NPCInfo[NPC_JOE][laune]);
		       		ShowPlayerDialog(playerid,dialog_NPC_PIZZA_INF,DIALOG_STYLE_MSGBOX,query,"{C87E35}Pizza Joe:\n\"{F1F7DC}Erstmal willkommen in der FC Pizzeria. Wir bieten ihnen sauberes,\nunverseuchtes Essen zum günstigen Preis an. Wie man unschwer erahnen\nkann haben wir uns auf Pizzagerichte spezialisiert.{C87E35}\"","Joo","");
			    }
			    case 1:
			    {//Essen kaufen
			        TogglePlayerControllable(playerid,false);
	    			SetPlayerCameraPos(playerid,375.78695678711,-114.15123748779,1002.5);
	                SetPlayerCameraLookAt(playerid,375.83206176758,-112.87711334229,1001.0);
	                //PlayerShopDrawHide(playerid);
	                SetPVarInt(playerid,"in_shop",1);
		    	    SetPVarInt(playerid,"pizzaladen",1);
		        	SetPVarInt(playerid,"menue",0);
					DeletePlayerSpecialObject(playerid,GetPlayerSlotBySpecialObject(playerid,GetPVarInt(playerid,"pizza_menu_oid")));
					SetPVarInt(playerid,"pizza_menu_oid",CreatePlayerSpecialObject(playerid,food_PizzaMenu[0][mpoid],376.08938599,-113.16246796,1001.55664062,331.55670166,29.90423584,75.31896973));
			        //UpdatePlayerShopScreen(playerid,SHOPSCREEN_PIZZA);
			        UpdatePlayerShopScreen(playerid,SHOPSCREEN_PIZZA);
			    }
			}
		}
	    case dialog_NPC_PIZZA_KAUF:
		{
		    if(listitem == 0)
		    {//Shop verlassen
			    UpdatePlayerShopScreen(playerid,SHOPSCREEN_PIZZA,false);
				TogglePlayerControllable(playerid,true);
	            SetPVarInt(playerid,"pizzaladen",0);
	            SetPVarInt(playerid,"menue",0);
	        	DeletePVar(playerid,"npc_gespräch");
	        	DeletePVar(playerid,"pizzaladen");
	        	DeletePVar(playerid,"menue");
	            SetCameraBehindPlayer(playerid);
		        return 1;
		    }
		    else
		    {//Weitershoppen
	            return 1;
		    }
		}
	    case dialog_NPC_PIZZA_WENIG:
		{
			switch(listitem)
			{
			    case 0:
			    {//Weitershoppen
			        return 1;
			    }
			    case 1:
			    {//Items bieten
			        item::SHOW_ITEM_LIST(playerid);
			    }
			    case 2:
			    {//Feilschen
				    if(PlayerStatus[playerid][Hunger] <= 0.0)
				    {//kann nicht essen
				    	GameTextForPlayer(playerid,"~w~Du hast ~r~keinen ~w~Hunger",2000,5);
				    	ShowPlayerDialog(playerid,dialog_NPC_PIZZA_KAUF,DIALOG_STYLE_MSGBOX,"{F1F7DC}Du hast keinen Hunger","{F1F7DC}Du hast keinen Hunger, kaufe dir etwas Essen wenn du\nHunger hast. Die Anzeige ist oben rechts.","Weiter","");
				    	return 1;
				    }
			    	new gpreis = food_PizzaMenu[GetPVarInt(playerid,"menue")][mpreis],
			    	    pcash = PlayerNPC[playerid][NPC_JOE][cash];
					if((pcash/gpreis*(1+(PlayerNPC[playerid][NPC_JOE][beliebtheit]+PlayerSkill[playerid][SkillWortgewandt])/200)) >= 1)
					{//Kauf erfolgreich
						format(string,sizeof(string),"%s",food_PizzaMenu[GetPVarInt(playerid,"menue")][mname]);
			            format(string,sizeof(string),"{C87E35}Feilschen erfolgreich. Du hast ein %s Menü gekauft.",string);
	                    ShowPlayerDialog(playerid,dialog_NULL,DIALOG_STYLE_LIST,"Erfolg",string,"Bye","");

						new Float:p_health;
						GetPlayerHealth(playerid,p_health);
						p_health 									+= food_PizzaMenu[GetPVarInt(playerid,"menue")][mheal];
	    			    PlayerStatus[playerid][Hunger] 				-= food_PizzaMenu[GetPVarInt(playerid,"menue")][mhunger];
	    			    PlayerStatus[playerid][Durst] 				-= food_PizzaMenu[GetPVarInt(playerid,"menue")][mdurst];
	    			    if(p_health >= 100.0) 						p_health 						= 100.0;
	    			    if(PlayerStatus[playerid][Hunger] < 0.0) 	PlayerStatus[playerid][Hunger] 	= 000.0;
						if(PlayerStatus[playerid][Durst] < 0.0) 	PlayerStatus[playerid][Durst] 	= 000.0;
						SetPlayerHealth(playerid,p_health);

						PlayerNPC[playerid][NPC_JOE][cash] -= gpreis;

						new am_id = __amCache[amVielfrass];
						if(am_id != -1) achievement::SetPlayerAchievementData(playerid,am_id,1,true);

					    UpdatePlayerShopScreen(playerid,SHOPSCREEN_PIZZA,false);
						TogglePlayerControllable(playerid,true);
			            SetPVarInt(playerid,"pizzaladen",0);
			            SetPVarInt(playerid,"menue",0);
			        	DeletePVar(playerid,"npc_gespräch");
			        	DeletePVar(playerid,"pizzaladen");
			        	DeletePVar(playerid,"menue");
			            SetCameraBehindPlayer(playerid);
			            ApplyAnimation(playerid,"FOOD", "EAT_Burger",3.0,0,0,0,0,0);
					}
					else
					{//Kauf nicht erfolgreich
					    ShowPlayerDialog(playerid,dialog_NPC_PIZZA_KAUF,DIALOG_STYLE_MSGBOX,"{F1F7DC}Feilschen gescheitert","{F1F7DC}Du hast Joe nicht überzeugen können. Biete etwas mehr\nund versuche es dann erneut.","Weiter","");
					}
			    }
			    case 3:
			    {//Drohen
				    if(PlayerStatus[playerid][Hunger] <= 0.0)
				    {//kann nicht essen
				    	GameTextForPlayer(playerid,"~w~Du hast ~r~keinen ~w~Hunger",2000,5);
				    	ShowPlayerDialog(playerid,dialog_NPC_PIZZA_KAUF,DIALOG_STYLE_MSGBOX,"{F1F7DC}Du hast keinen Hunger","{F1F7DC}Du hast keinen Hunger, kaufe dir etwas Essen wenn du\nHunger hast. Die Anzeige ist oben rechts.","Weiter","");
				    	return 1;
				    }
			    	new gpreis = food_PizzaMenu[GetPVarInt(playerid,"menue")][mpreis],
			    	    pcash = PlayerNPC[playerid][NPC_JOE][cash];
					if((pcash/gpreis*(1+(PlayerNPC[playerid][NPC_JOE][beliebtheit]+PlayerSkill[playerid][SkillKraft])/200)) >= 1)
					{//Kauf erfolgreich
						format(string,sizeof(string),"%s",food_PizzaMenu[GetPVarInt(playerid,"menue")][mname]);
			            format(string,sizeof(string),"{C87E35}Einschüchtern erfolgreich. Du hast ein %s Menü gekauft.",string);
	                    ShowPlayerDialog(playerid,dialog_NULL,DIALOG_STYLE_LIST,"Erfolg",string,"Bye","");

						new Float:p_health;
						GetPlayerHealth(playerid,p_health);
						p_health 									+= food_PizzaMenu[GetPVarInt(playerid,"menue")][mheal];
	    			    PlayerStatus[playerid][Hunger] 				-= food_PizzaMenu[GetPVarInt(playerid,"menue")][mhunger];
	    			    PlayerStatus[playerid][Durst] 				-= food_PizzaMenu[GetPVarInt(playerid,"menue")][mdurst];
	    			    if(p_health >= 100.0) 						p_health 						= 100.0;
	    			    if(PlayerStatus[playerid][Hunger] < 0.0) 	PlayerStatus[playerid][Hunger] 	= 000.0;
						if(PlayerStatus[playerid][Durst] < 0.0) 	PlayerStatus[playerid][Durst] 	= 000.0;
						SetPlayerHealth(playerid,p_health);
						
						PlayerNPC[playerid][NPC_JOE][cash] -= gpreis;
						
						new am_id = __amCache[amVielfrass];
						if(am_id != -1) achievement::SetPlayerAchievementData(playerid,am_id,1,true);

					    UpdatePlayerShopScreen(playerid,SHOPSCREEN_PIZZA,false);
						TogglePlayerControllable(playerid,true);
			            SetPVarInt(playerid,"pizzaladen",0);
			            SetPVarInt(playerid,"menue",0);
			        	DeletePVar(playerid,"npc_gespräch");
			        	DeletePVar(playerid,"pizzaladen");
			        	DeletePVar(playerid,"menue");
			            SetCameraBehindPlayer(playerid);
			            ApplyAnimation(playerid,"FOOD", "EAT_Burger",3.0,0,0,0,0,0);
					}
					else ShowPlayerDialog(playerid,dialog_NPC_PIZZA_KAUF,DIALOG_STYLE_MSGBOX,"{F1F7DC}Einschüchtern gescheitert","{F1F7DC}Du hast Joe nicht überzeugen können. Biete etwas mehr\nund versuche es dann erneut.","Weiter","");
			    }
			    case 4:
			    {//Verlassen
				    UpdatePlayerShopScreen(playerid,SHOPSCREEN_PIZZA,false);
					TogglePlayerControllable(playerid,true);
		            SetPVarInt(playerid,"pizzaladen",0);
		            SetPVarInt(playerid,"menue",0);
		        	DeletePVar(playerid,"npc_gespräch");
		        	DeletePVar(playerid,"pizzaladen");
		        	DeletePVar(playerid,"menue");
		            SetCameraBehindPlayer(playerid);
					return 1;
			    }
			}
		    return 1;
		}
	    case dialog_NPC_PIZZA_INF: return OnDialogResponse(playerid, dialog_NPC_PIZZA_MAIN, 1,-1, "");//Hauptmenü öffnen
	    case DIALOG_FUNK_MAIN:
		{
		    if(!response) return 1;
		    switch(listitem)
		    {
		        case 0:
		        {
					format(string,sizeof(string),"{F1F7DC}Stufe des Funkgerätes: %d\nFrequenz (%d Hz)",PlayerOption[playerid][pFunkgeraet][0],PlayerOption[playerid][pFunkgeraet][1]);
					ShowPlayerDialog(playerid,DIALOG_FUNK_INF,DIALOG_STYLE_MSGBOX,"{F1F7DC}Funkgerät - Informationen",string,"Zurück","");
		        }
		        case 1:
		        {
					format(string,sizeof(string),"{F1F7DC}Gebe neue Funkfrequenz zwischen 30khZ und 300kHz ein.\n(jetzige Frequenz: %d kHz)",PlayerOption[playerid][pFunkgeraet][1]);
					ShowPlayerDialog(playerid,DIALOG_FUNK_FREQ,DIALOG_STYLE_INPUT,"{F1F7DC}Funkgerät - Frequenz",string,"Setzen","Zurück");
		        }
		        case 2:
		        {
		           PlayerOption[playerid][pFunkgeraet][2] = (PlayerOption[playerid][pFunkgeraet][2]==1?0:1);
				   mysql_SetIntByInt("pnwl_user_option","funkopt",PlayerOption[playerid][pFunkgeraet][2],"userid",PlayerInfo[playerid][PLAYER_ID]);
				   format(string,sizeof(string),"{F1F7DC}Informationen\nFrequenz ändern (%d Hz)\nFrequenzabweichungen hören (%s{F1F7DC})",PlayerOption[playerid][pFunkgeraet][1],PlayerOption[playerid][pFunkgeraet][2]==1?("{33AA33}Ja"):("{C85135}Nein"));
				   ShowPlayerDialog(playerid,DIALOG_FUNK_MAIN,DIALOG_STYLE_LIST,"{F1F7DC}Funkgerät",string,"Ok","Beenden");
		        }
		    }
		    return 1;
		}
	    case DIALOG_FUNK_INF: return ncom_funk(playerid);
	    case DIALOG_FUNK_FREQ:
		{
		    if(!response) return ncom_funk(playerid);
		    if(inputtext[0] && strval(inputtext) >= 30 && strval(inputtext) <= 300)
		    {
		        PlayerOption[playerid][pFunkgeraet][1] = strval(inputtext);
				format(string,sizeof(string),"{F1F7DC}Die neue Funkfrequenz ist %d kHz)",PlayerOption[playerid][pFunkgeraet][1]);
				ShowPlayerDialog(playerid,DIALOG_FUNK_INF,DIALOG_STYLE_MSGBOX,"{F1F7DC}Funkgerät - Neue Frequenz",string,"Zurück","");
				return 1;
		    }
			format(string,sizeof(string),"{FF6347}INFO: Die Funkfrequenz muss zwischen 30 kHz und 300 kHz liegen.\n\n{F1F7DC}Gebe neue Funkfrequenz zwischen 30khZ und 300kHz ein.\n(jetzige Frequenz: %d kHz)",PlayerOption[playerid][pFunkgeraet][1]);
			ShowPlayerDialog(playerid,DIALOG_FUNK_FREQ,DIALOG_STYLE_INPUT,"{F1F7DC}Funkgerät - Frequenz",string,"Setzen","Zurück");
		    return 1;
		}
	    case dialog_GANG_MAINRE: return ncom_gang(playerid);
	    case dialog_GANG_MAIN:
		{
		    if(PlayerInfo[playerid][pGang] == -1) return 1;
			if(response)
			{
			    switch(GetDialogOption(playerid,listitem))
			    {
			        case 0:
			        {//informationen
						new gid = PlayerInfo[playerid][pGang];
						format(string,sizeof(string),"{F1F7DC}Gang Informationen:\n\nGangname: 	\t%s\nGang ID: 	\t%d\nMitglieder: \t\t%d\nFarbe: \t\t\t{%s}[][][][]",GangInfo[gid][gName],gid,GangInfo[gid][gMembers],gang::GetColor(GangInfo[gid][gColor]));
						format(string,sizeof(string),"%s{F1F7DC}\nGründer: \t\t%s",string,mysql_GetStringByInt("pnwl_user","username","userid",GangInfo[gid][gFounder]));
				        ShowPlayerDialog(playerid,dialog_GANG_MAINRE,DIALOG_STYLE_MSGBOX,"{F1F7DC}Gang Informationen",string,"Zurück","");
			            return 1;
			        }
			        case 1:
			        {//ränge ändern => id
			            if(PlayerInfo[playerid][pGangRang] == -1 || perm::HasPlayerGangPermission(playerid,'r'))
			            {
			                ShowPlayerDialog(playerid,dialog_GANG_SET_MEMBER_RANG_ID,DIALOG_STYLE_INPUT,"{F1F7DC}Ränge von Spielern ändern","{F1F7DC}Bitte gebe die Benutzer-ID oder den Namen des Spielers ein,\ndessen Rang zu ändern möchtest:","Weiter","Zurück");
			                return 1;
			            }
			            else ncom_gang(playerid);
			        }
			        case 2:
			        {//Neue Spieler einladen
			        	if(PlayerInfo[playerid][pGangRang] == -1 || perm::HasPlayerGangPermission(playerid,'i')) ShowPlayerDialog(playerid,dialog_GANG_INVITE_ID,DIALOG_STYLE_INPUT,"{F1F7DC}Spieler einladen","{F1F7DC}Bitte gebe die PlayerID oder den Namen des Spielers ein, den\ndu in die Gang einladen möchtest:","Weiter","Zurück");
			            else ncom_gang(playerid);
			        }
			        case 3:
			        {//aus gang werfen => id

			            if(PlayerInfo[playerid][pGangRang] == -1 || perm::HasPlayerGangPermission(playerid,'k')) ShowPlayerDialog(playerid,dialog_GANG_KICK_MEMBER_ID,DIALOG_STYLE_INPUT,"{F1F7DC}Spieler rauswerfen","{F1F7DC}Bitte gebe die Benutzer-ID oder den Namen des Spielers ein,\nden du rauswerfen möchtest:","Rauswerfen","Zurück");
			            else ncom_gang(playerid);
		                return 1;
					}
			        case 4:
			        {//Berechtigungen ändern
			            if(PlayerInfo[playerid][pGangRang] == -1) ShowPlayerDialog(playerid,dialog_GANG_PERM_MEMBER_ID,DIALOG_STYLE_INPUT,"{F1F7DC}Spielerberechtigung ändern","{F1F7DC}Gebe die ForenID oder den Namen des Members ein:","Weiter","Zurück");
			            else ncom_gang(playerid);
						return 1;
			        }
			        case 5:
			        {//online member anzeigen
			            format(string,sizeof(string),"Gangmitglieder, die online sind:\n\n");
			            new rounds=0,not_listened=0;
			            for(new pid=0; pid<=__SERVER[HIGHEST_PLAYER_ID]; pid++)
			            {
			                if(IsPlayerConnected(pid) && !IsPlayerNPC(pid) && PlayerInfo[pid][pGang] == PlayerInfo[playerid][pGang])
			                {
			                    if(++rounds >= 15) not_listened++;
			                    else format(string,sizeof(string),"%s\n%s",string,PlayerInfo[pid][pName]);
			                }
			            }
			            if(rounds >= 15) format(string,sizeof(string),"%s\n(und %d andere)",not_listened);
			            format(string,sizeof(string),"{F1F7DC}%s",string);
			            ShowPlayerDialog(playerid,dialog_GANG_MAINRE,DIALOG_STYLE_MSGBOX,"{F1F7DC}Online Gangmembers",string,"Zurück","");
			        }
			        case 6:
			        {//gangchat config
			            ShowPlayerDialog(playerid,dialog_GANG_CHAT_CONFIG,DIALOG_STYLE_INPUT,"{F1F7DC}Gangchat","{F1F7DC}Hier kannst du bestimmen, mit welchem Kürzel du den Gangchat aufrufst. Ein Beispiel\nwäre zum Beispiel das \"+\". Öffnest du das Chatfenster und gibst\n+hallo leute\nein, wird die Nachricht an alle Gangmember gesendet. Das Kürzel darf bis zu 3 Zeichen lang sein,\nbereits belegte Kürzel: # (Funk), ? (Support). Erlaubte Kürzel (bis zu 3 gemischt): + , . - ( ) = % \" !","Bestätigen","Zurück");
			            return 1;
			        }
			        case 7:
			        {//gang verlassen
			            ShowPlayerDialog(playerid,dialog_GANG_LEAVE,DIALOG_STYLE_MSGBOX,"{F1F7DC}Gang verlassen","{F1F7DC}Du bist kurz davor deine Gang zu verlassen. Diese Entscheidung kann\nnicht mehr rückgängig gemacht werden. Bist du sicher, dass du die\nGang verlassen möchtest?","Nein","Ja");
						return 1;
			        }
			    }
			}
		    return 1;
		}
		case dialog_GANG_INVITE_ID:
		{
		    if(!response || inputtext[0]) return ncom_gang(playerid);
		    if(PlayerInfo[playerid][pGang] == -1) return 1;
			new pid=-1,gid=PlayerInfo[playerid][pGang];
			if(GangInfo[gid][gMembers] >= GangInfo[gid][gMemberLimit]) return 1;
			if(is_numeric(inputtext)) pid = strval(inputtext);
			else
			{
			    for(new i; i<=__SERVER[HIGHEST_PLAYER_ID]; i++)
			    {
					if(i == playerid || !IsPlayerConnected(i) || IsPlayerNPC(i)) continue;
			        if(!strcmp(inputtext,PlayerInfo[i][pName]))
			        {
			            pid = i;
						break;
			        }
			    }
			}
			if(pid < 0 || pid >= MAX_PLAYERS || !IsPlayerConnected(pid) || IsPlayerNPC(pid))
			{
				ShowPlayerDialog(playerid,dialog_GANG_INVITE_ID,DIALOG_STYLE_INPUT,"{F1F7DC}Spieler in Gang einladen","{F1F7DC}Deine Eingabe ist ungültig, gebe eine PlayerID oder\neinen Namen ein (der Spieler muss online sein):","Einladen","Zurück");
				return 1;
			}
			if(!PlayerEvent[pid][LOGGED_IN] || PlayerInfo[pid][pGang] != -1)
			{
			    ShowPlayerDialog(playerid,dialog_GANG_INVITE_ID,DIALOG_STYLE_INPUT,"{F1F7DC}Spieler in Gang einladen","{F1F7DC}Der Spieler ist schon in einer Gang. Neue Eingabe:","Einladen","Zurück");
			    return 1;
			}
			SetPVarInt(playerid,"gang_invite_pid",pid);
			format(string,sizeof(string),"{F1F7DC}Du möchtest \"%s\" aka \"%s %s\" also in die\nGang einladen?",GetName(pid),PlayerInfo[pid][Vorname],PlayerInfo[pid][Nachname]);
			ShowPlayerDialog(playerid,dialog_GANG_INVITE_ACCEPT,DIALOG_STYLE_MSGBOX,"{F1F7DC}Spieler in Gang einladen",string,"Ja","Nein");
			return 1;
		}
		case dialog_GANG_INVITE_ACCEPT:
		{
		    if(PlayerInfo[playerid][pGang] == -1) return 1;
			if(!response) return ShowPlayerDialog(playerid,dialog_GANG_INVITE_ID,DIALOG_STYLE_MSGBOX,"{F1F7DC}Spieler in Gang einladen","{F1F7DC}Okay, dann wähle einen anderen Spieler aus:","Einladen","Zurück");
			new pid = GetPVarInt(playerid,"gang_invite_pid"),gid=PlayerInfo[playerid][pGang];
			if(GangInfo[gid][gMembers] >= GangInfo[gid][gMemberLimit]) return 1;
			if(gid == -1) return 1;
			if(pid < 0 || pid >= MAX_PLAYERS || !IsPlayerConnected(pid) || IsPlayerNPC(pid))
			{
				ShowPlayerDialog(playerid,dialog_GANG_INVITE_ID,DIALOG_STYLE_INPUT,"{F1F7DC}Spieler in Gang einladen","{F1F7DC}Deine Eingabe ist ungültig, gebe eine PlayerID oder\neinen Namen ein (der Spieler muss online sein):","Einladen","Zurück");
				return 1;
			}
			if(!PlayerEvent[pid][LOGGED_IN] || PlayerInfo[pid][pGang] != -1)
			{
			    ShowPlayerDialog(playerid,dialog_GANG_INVITE_ID,DIALOG_STYLE_INPUT,"{F1F7DC}Spieler in Gang einladen","{F1F7DC}Der Spieler ist schon in einer Gang. Neue Eingabe:","Einladen","Zurück");
			    return 1;
			}
			//Einladen erfolgreich
			format(string,sizeof(string),#FORMAT_CHAT_INFO"%s (%d) lädt dich in die Gang \"%s\" ein. /gangjoin um zu akzeptieren",GetName(playerid),playerid,GangInfo[gid][gName]);
			SendClientMessage(pid,GRUEN,string);
			format(string,sizeof(string),#FORMAT_CHAT_INFO"Du lädst %s (%d) in die Gang ein",GetName(pid),pid);
			SendClientMessage(playerid,GRUEN,string);
			format(string,sizeof(string),"{F1F7DC}Du hast %s (%d) in die Gang eingeladen",GetName(pid),pid);
			ShowPlayerDialog(playerid,dialog_GANG_MAINRE,DIALOG_STYLE_MSGBOX,"{F1F7DC}Spieler eingeladen",string,"Zurück","");
			
			SetPVarInt(pid,"joining_gang",playerid);
			return 1;
		}
	    case dialog_GANG_CHAT_CONFIG:
		{
		    if(PlayerInfo[playerid][pGang] == -1) return 1;
		    if(response)
		    {
				// + , . - ( ) = % !
				new len = strlen(inputtext),bool:valid = true;
		        if(!inputtext[0] || len > 3) valid = false;
		        else
		        {
		            new valid_chars[] = {'+',',','.','-','(',')','=','!','%'};
		            for(new letter=0; letter<len; letter++)
		            {
		                new bool:validchar=false;
						for(new vchar=0; vchar<sizeof(valid_chars); vchar++)
						{
						    if(inputtext[letter] == valid_chars[vchar])
						    {
						        validchar = true;
						    }
						}
						if(!validchar)
						{
						    valid = false;
						    break;
						}
		            }
		        }
				if(!valid) return ShowPlayerDialog(playerid,dialog_GANG_CHAT_CONFIG,DIALOG_STYLE_INPUT,"{F1F7DC}Gangchat Konfiguration","{F1F7DC}Erlaubte Kürzel (bis zu 3 gemischt): + , . - ( ) = % !","Bestätigen","Zurück");

				for(new gchat; gchat<strlen(inputtext); gchat++) PlayerOption[playerid][GChat][gchat] = inputtext[gchat];
				PlayerOption[playerid][GChat][3] = strlen(inputtext);

				format(string,sizeof(string),"{F1F7DC}Die neue Kombination:\n");
				for(new letter=0; letter<len; letter++) format(string,sizeof(string),"%s%c",string,inputtext[letter]);
	            ShowPlayerDialog(playerid,dialog_GANG_MAINRE,DIALOG_STYLE_MSGBOX,"{F1F7DC}Neue Kombination",string,"Zurück","");
				return 1;
		    }
		    ncom_gang(playerid);
		    return 1;
		}
	    case dialog_GANG_SET_MEMBER_RANG_ID:
		{
		    if(PlayerInfo[playerid][pGang] == -1) return 1;
		    if(!response) return ncom_gang(playerid);
			if(!inputtext[0]) return ShowPlayerDialog(playerid,dialog_GANG_SET_MEMBER_RANG_ID,DIALOG_STYLE_INPUT,"{F1F7DC}Ränge verteilen","{F1F7DC}Bitte gebe die FOREN-ID oder den Namen des Spielers ein,\ndessen Rang du ändern möchtest:","Weiter","Zurück");

			new pid = CORE::GetUserID(inputtext);

			if(pid == 0 || mysql_GetIntByInt("pnwl_user","gang","userid",pid) != PlayerInfo[playerid][pGang])
			{//Nicht in der Gang
			    format(string,sizeof(string),"FEHLER: Der Spieler (%s, ID %d) befindet sich nicht in deiner Gang!\n\n{F1F7DC}Bitte gebe die FOREN-ID oder den Namen des Spielers ein,\ndessen Rang du ändern möchtest:",mysql_GetStringByInt("pnwl_user","username","userid",pid),pid);
			    ShowPlayerDialog(playerid,dialog_GANG_SET_MEMBER_RANG_ID,DIALOG_STYLE_INPUT,"{F1F7DC}Ränge verteilen",string,"Weiter","Zurück");
				return 1;
			}
			else
			{//Spieler ID erfolgreich erkannt
			    SetPVarInt(playerid,"gang_give_rank_pid",pid);//zwischenspeicher
			    format(string,sizeof(string),"{F1F7DC}Rang von %s, ID %d ändern.\nBitte gebe den neuen Rang (Zahl zwischen 0 und - [Zahl]) ein:",mysql_GetStringByInt("pnwl_user","username","userid",pid),pid);
				ShowPlayerDialog(playerid,dialog_GANG_SET_MEMBER_RANG,DIALOG_STYLE_INPUT,"{F1F7DC}Rang geben",string,"Weiter","Zurück");
				return 1;
			}
		}
	    case dialog_GANG_SET_MEMBER_RANG:
		{
		    if(PlayerInfo[playerid][pGang] == -1) return 1;
		    if(!response) return ncom_gang(playerid);
			new new_rank = strval(inputtext);
			if(new_rank < 0 || new_rank > 500) return ShowPlayerDialog(playerid,dialog_GANG_SET_MEMBER_RANG,DIALOG_STYLE_INPUT,"{F1F7DC}Rang geben","{F1F7DC}Der Rang sollte eine Zahl zwischen 0 und 500 sein.","Weiter","Zurück");
			new pid = GetPVarInt(playerid,"gang_give_rank_pid");
			mysql_SetIntByInt("pnwl_user","grang",new_rank,"userid",pid);

			new cache_name[MAX_PLAYER_NAME];
			format(cache_name,MAX_PLAYER_NAME,"%s",mysql_GetStringByInt("pnwl_user","username","userid",pid));
			format(string,sizeof(string),#FORMAT_CHAT_INFO"%s wurde von %s einem neuen Rang (%d) zugewiesen.",cache_name,PlayerInfo[playerid][pName],new_rank);

			for(new pid2=0; pid2<=__SERVER[HIGHEST_PLAYER_ID]; pid2++)
	        {
	            if(IsPlayerConnected(pid2) && !IsPlayerNPC(pid2) && PlayerInfo[pid2][pGang] == PlayerInfo[playerid][pGang])
	            {
	                if(PlayerInfo[pid2][PLAYER_ID] == pid)
	                {
	                    format(query,sizeof(query),#FORMAT_CHAT_INFO"Du wurdest von %s einem anderen Rang (%d) zugewiesen.",PlayerInfo[playerid][pName],new_rank);
	                    SendClientMessage(pid2,GRUEN,query);
	                    PlayerInfo[pid][pGangRang] = new_rank;
		            }
	                else SendClientMessage(pid2,GRUEN,string);
	            }
			}
		    format(string,sizeof(string),"{F1F7DC}Du hast %s (ID %d) den Rang %d gegeben.",cache_name,pid,new_rank);
		    ShowPlayerDialog(playerid,dialog_GANG_MAINRE,DIALOG_STYLE_MSGBOX,"{F1F7DC}Member einen neuen Rang gegeben",string,"Hauptmenü","");
		    return 1;
		}
		case dialog_GANG_PERM_MEMBER_ID:
		{
		    if(PlayerInfo[playerid][pGang] == -1) return 1;
		    if(!response) return ncom_gang(playerid);
			if(!inputtext[0]) return ShowPlayerDialog(playerid,dialog_GANG_PERM_MEMBER_ID,DIALOG_STYLE_INPUT,"{F1F7DC}Spielerberechtigung ändern","{F1F7DC}Gebe die ForenID oder den Namen des Members ein:","Weiter","Zurück");

			new pid = CORE::GetUserID(inputtext);

			if(pid == 0 || mysql_GetIntByInt("pnwl_user","gang","userid",pid) != PlayerInfo[playerid][pGang])
			{//Nicht in der Gang
			    format(string,sizeof(string),"FEHLER: Der Spieler (%s, ID %d) befindet sich nicht in deiner Gang!\n\n{F1F7DC}Gebe die ForenID oder den Namen des Members ein, dessen Berechtigungen\ndu ändern möchtest:",mysql_GetStringByInt("pnwl_user","username","userid",pid),pid);
			    ShowPlayerDialog(playerid,dialog_GANG_PERM_MEMBER_ID,DIALOG_STYLE_INPUT,"{F1F7DC}Spielerberechtigung ändern",string,"Weiter","Zurück");
				return 1;
			}
			else
			{//Spieler ID erfolgreich erkannt
			    SetPVarInt(playerid,"gang_perm_pid",pid);//zwischenspeicher
			    format(string,sizeof(string),"{F1F7DC}Berechtigungsänderung von %s, ID %d.\nGebe die Berechtigungsänderung ein:\n\n\
				Verfügbare Einstellungen:\n\
				Gruppen: 'b' (Boss) = 'i', 'r', 'k'\n\
				Berechtigungen: 'i' (Invite), 'r' (Rangänderung), 'k' (Rauswurf)\n\
				Du kannst diese positiv/negativ verwenden. Bsp: \"-k+ir\" (ohne \"\")\
				",mysql_GetStringByInt("pnwl_user","username","userid",pid),pid);
				ShowPlayerDialog(playerid,dialog_GANG_PERM_MEMBER_CODE,DIALOG_STYLE_INPUT,"{F1F7DC}Spielerberechtigung ändern",string,"Weiter","Zurück");
				return 1;
			}
		}
		case dialog_GANG_PERM_MEMBER_CODE:
		{
		    if(PlayerInfo[playerid][pGang] == -1) return 1;
		    if(!response) return ncom_gang(playerid);
			new pid = GetPVarInt(playerid,"gang_perm_pid");

			if(mysql_GetIntByInt("pnwl_user","gang","userid",pid) != PlayerInfo[playerid][pGang])
			{
			    ncom_gang(playerid);
			    return 1;
			}
			
			//Searching user
			new userid = -1;
			for(new pid2=0; pid2<=__SERVER[HIGHEST_PLAYER_ID]; pid2++)
			{
				if(PlayerInfo[pid2][PLAYER_ID] == pid)
				{
				    userid = pid2;
				    break;
				}
			}
			if(userid == -1)
			{
			    ShowPlayerDialog(playerid,dialog_GANG_MAINRE,DIALOG_STYLE_MSGBOX,"{F1F7DC}Spielerberechtigung ändern","{F1F7DC}Der User ist zur Zeit offline, versuche es später erneut","Zurück","");
				return 1;
			}
			format(query,sizeof(query),"%s",perm::ChangeGangPermissionStr(userid,inputtext));
			format(string,sizeof(string),"{F1F7DC}Du hast die Spielerberechtigung erfolgreich geändert.\nNeuer Code: {FFECAA}%s",query);
			ShowPlayerDialog(playerid,dialog_GANG_MAINRE,DIALOG_STYLE_MSGBOX,"{F1F7DC}Spielerberechtigung ändern",string,"Zurück","");
			format(string,sizeof(string),"GANG: Neue Berechtigungen: %s",query);
			SendClientMessage(userid,GRUEN,string);
		    return 1;
		}
	    case dialog_GANG_KICK_MEMBER_ID:
		{
		    if(PlayerInfo[playerid][pGang] == -1) return 1;
		    if(!response) return ncom_gang(playerid);
			if(!inputtext[0]) return ShowPlayerDialog(playerid,dialog_GANG_KICK_MEMBER_ID,DIALOG_STYLE_INPUT,"{F1F7DC}Spieler rauswerfen","{F1F7DC}Bitte gebe die FOREN-ID oder den Namen des Spielers ein,\nden du rauswerfen möchtest:","Rauswerfen","Zurück");

			new pid = CORE::GetUserID(inputtext);

			if(pid == 0 || mysql_GetIntByInt("pnwl_user","gang","userid",pid) != PlayerInfo[playerid][pGang])
			{//Nicht in der Gang
			    format(string,sizeof(string),"FEHLER: Der Spieler (%s, ID %d) befindet sich nicht in deiner Gang!\n\n{F1F7DC}Bitte gebe die FOREN-ID oder den Namen des Spielers ein,\nden du rauswerfen möchtest:",mysql_GetStringByInt("pnwl_user","username","userid",pid),pid);
			    ShowPlayerDialog(playerid,dialog_GANG_KICK_MEMBER_ID,DIALOG_STYLE_INPUT,"{F1F7DC}Spieler rauswerfen",string,"Rauswerfen","Zurück");
				return 1;
			}
			else
			{//Spieler ID erfolgreich erkannt
			    SetPVarInt(playerid,"gang_rauswurf_pid",pid);//zwischenspeicher
			    format(string,sizeof(string),"{F1F7DC}Rauswurf von %s, ID %d.\nMöchtest du einen Grund angeben (wenn nicht einfach auf \"weiter\" klicken):",mysql_GetStringByInt("pnwl_user","username","userid",pid),pid);
				ShowPlayerDialog(playerid,dialog_GANG_KICK_MEMBER_REASON,DIALOG_STYLE_INPUT,"{F1F7DC}Gangmember rauswerfen",string,"Weiter","Zurück");
				return 1;
			}
		}
	    case dialog_GANG_KICK_MEMBER_REASON:
		{
		    if(PlayerInfo[playerid][pGang] == -1) return 1;
		    if(!response) return ncom_gang(playerid);
			new pid = GetPVarInt(playerid,"gang_rauswurf_pid");
			gang::OnPlayerLeaveGang(pid,inputtext,true,PlayerInfo[playerid][PLAYER_ID]);
		    format(string,sizeof(string),"{F1F7DC}Du hast %s (ID %d) mit folgender Begründung rausgeworfen:\n%s",mysql_GetStringByInt("pnwl_user","username","userid",pid),pid,!inputtext[0]?("<Keine Begründung vorhanden>"):inputtext);
		    ShowPlayerDialog(playerid,dialog_GANG_MAINRE,DIALOG_STYLE_MSGBOX,"{F1F7DC}Member rausgeworfen",string,"Hauptmenü","");
		    return 1;
		}
	    case dialog_GANG_LEAVE:
		{
		    if(PlayerInfo[playerid][pGang] == -1) return 1;
			if(response)
			{
			    ncom_gang(playerid);
				return 1;
			}
			gang::OnPlayerLeaveGang(PlayerInfo[playerid][PLAYER_ID]);
			format(string,sizeof(string),"{F1F7DC}Du hast die Gang verlassen");
			ShowPlayerDialog(playerid,dialog_NULL,DIALOG_STYLE_MSGBOX,"{F1F7DC}Gang verlassen",string,"Ok","");
			return 1;
		}
	    case dialog_NPC_BARKEEPER_UFO_MAINRE: return OnDialogResponse(playerid, dialog_NPC_BARKEEPER_UFO_MAIN, 1,-1, "");//Hauptmenü öffnen
	    case dialog_NPC_BARKEEPER_UFO_MAIN:
		{
		    if(response)
		    {
				switch(listitem)
				{
				    case -1:
				    {
				        SetPVarInt(playerid,"talk_to_npc",NPC_WEZ);
				        if(PlayerInfo[playerid][pGang] != -1)
				        {
						    format(string,sizeof(string),"Handeln\nQuests\nGang: {%s}%s",gang::GetColor(GangInfo[PlayerInfo[playerid][pGang]][gColor]),GangInfo[PlayerInfo[playerid][pGang]][gName]);
							ShowPlayerDialog(playerid,dialog_NPC_BARKEEPER_UFO_MAIN,DIALOG_STYLE_LIST,"{C87E35}Gespräch mit Wez",string,"Reden","Verlassen");
				            return 1;
				        }
					    new joining_playerids_gang = 0;
					    for(new pid; pid<=__SERVER[HIGHEST_PLAYER_ID]; pid++)
					    {
					        if(!IsPlayerConnected(pid) || IsPlayerNPC(pid)) continue;
					        if(GetPVarInt(pid,"joining_gang") == playerid) joining_playerids_gang++;
					    }
					    format(string,sizeof(string),"{F1F7DC}Handeln\nQuests\n%sGang gründen (%d/%d)",(joining_playerids_gang>=MAX_USER_NEEDED_FOR_CREATING_GANG)?("{77AE35}"):("{FF0000}"),joining_playerids_gang,MAX_USER_NEEDED_FOR_CREATING_GANG);
						ShowPlayerDialog(playerid,dialog_NPC_BARKEEPER_UFO_MAIN,DIALOG_STYLE_LIST,"{C87E35}Gespräch mit Wez",string,"Reden","Verlassen");
				    }
				    case 0:
				    {//{C87E35}{F1F7DC}{878375}, HANDEL
				        ShowPlayerDialog(playerid,dialog_NPC_BARKEEPER_UFO_MAINRE,DIALOG_STYLE_MSGBOX,"{C87E35}Gespräch mit Wez","{C87E35}Wez (Barkeeper):\n\"{F1F7DC}Moinsen. Tut mir leid aber im Moment habe ich keine Waren hier.\nVersuche es doch später noch einmal\"\n\n\n{878375}Hinweis: Zur Zeit ist der Handel noch beschränkt","Zurück","");
				    }
					case 1:
					{//Quests
					    ShowPlayerDialog(playerid,dialog_NPC_BARKEEPER_UFO_MAINRE,DIALOG_STYLE_MSGBOX,"{C87E35}Gespräch mit Wez","{C87E35}Wez (Barkeeper):\n\"{F1F7DC}Guten Tag. Im Moment habe ich noch keine Aufgaben für dich aber du\nkannst später gerne nochmal vorbeikommen\"\n\n\n{878375}Hinweis: Zur Zeit gibt es noch keine Quests","Zurück","");
					}
					case 2:
					{//Gang gründen//Gang Info
					    if(PlayerInfo[playerid][pGang] != -1)
					    {
							new gid = PlayerInfo[playerid][pGang];
							format(string,sizeof(string),"{F1F7DC}Gang Informationen:\n\nGangname: 	\t%s\nGang ID: 	\t%d\nMitglieder: \t\t%d\nFarbe: \t\t\t{%s}[][][][]",GangInfo[gid][gName],gid,GangInfo[gid][gMembers],gang::GetColor(GangInfo[gid][gColor]));
							format(string,sizeof(string),"%s{F1F7DC}\nGründer: \t\t%s",string,mysql_GetStringByInt("pnwl_user","username","userid",GangInfo[gid][gFounder]));
					        ShowPlayerDialog(playerid,dialog_NPC_BARKEEPER_UFO_MAINRE,DIALOG_STYLE_MSGBOX,"{F1F7DC}Gang Informationen",string,"Zurück","");
					        return 1;
					    }
					    new joining_playerids_gang = 0;
					    for(new pid; pid<=__SERVER[HIGHEST_PLAYER_ID]; pid++)
					    {
					        if(!IsPlayerConnected(pid) || IsPlayerNPC(pid)) continue;
					        if(GetPVarInt(pid,"joining_gang") == playerid) joining_playerids_gang++;
					    }
					    if(joining_playerids_gang >= MAX_USER_NEEDED_FOR_CREATING_GANG)
						{
						    format(string,sizeof(string),"{C87E35}Wez (Barkeeper):\n\"{F1F7DC}Aha, du willst also mit\n");
						    new joiner_loop=0;
						    for(new pid; pid<=__SERVER[HIGHEST_PLAYER_ID]; pid++)
						    {
						        if(!IsPlayerConnected(pid) || IsPlayerNPC(pid)) continue;
						        format(string,sizeof(string),"%s\n%s",string,PlayerInfo[pid][pName]);
						        if(++joiner_loop >= 6) break;
						    }
						    if(joiner_loop >= 6) strcat(string,"\nusw...");

						    strcat(string,"\n\nEine Gang gründen? Alles klar, Kollege!\"");
							ShowPlayerDialog(playerid,dialog_NPC_BARKEEPER_UFO_GANG1,DIALOG_STYLE_MSGBOX,"{C87E35}Gespräch mit Wez",string,"Weiter","Doch nicht");
					    }
					    else
					    {
					        format(string,sizeof(string),"{C87E35}Wez (Barkeeper):\n\"{F1F7DC}Haha was willst du mit %d Versagern? Damit du überhaupt eine Chance gegen\ndie Konkurrenz hast brauchst du MINDESTENS zwei starke Kameraden!\"\n\n\n{878375}Hinweis: Um eine Gang gründen zu können brauchst du 2 Mitspieler",joining_playerids_gang);
					        ShowPlayerDialog(playerid,dialog_NPC_BARKEEPER_UFO_MAINRE,DIALOG_STYLE_MSGBOX,"{C87E35}Gespräch mit Wez",string,"Zurück","");
					    }
					}
				}
		    }
		    else
		    {
		    }
		    return 1;
		}
	    case dialog_NPC_BARKEEPER_UFO_GANG1:
		{
			if(response)
			{
			    new joining_playerids_gang = 0;
			    for(new pid; pid<=__SERVER[HIGHEST_PLAYER_ID]; pid++)
			    {
			        if(!IsPlayerConnected(pid) || IsPlayerNPC(pid)) continue;
			        if(GetPVarInt(pid,"joining_gang") == playerid) joining_playerids_gang++;
			    }
			    if(joining_playerids_gang >= MAX_USER_NEEDED_FOR_CREATING_GANG)
				{
				    ShowPlayerDialog(playerid,dialog_NPC_BARKEEPER_UFO_GANG2,DIALOG_STYLE_LIST,"{C87E35}Wähle deine Gangfarbe aus","\
					{0094FF}Hellblau\n\
					{267F00}Dunkelgrün\n\
					{00FF21}Hellgrün\n\
					{724F0E}Braun\n\
					{FF0000}Rot\n\
					{FF6A00}Orange\n\
					{FFD800}Gelb\n\
					{B200FF}Violett\n\
					{FF7FED}Rosa\n\
					{808080}Grau\n\
					","Weiter","");
				    return 1;
				}
				OnDialogResponse(playerid, dialog_NPC_BARKEEPER_UFO_MAIN, 1,-1, "");//Hauptmenü öffnen
			}
			else
			{
		        OnDialogResponse(playerid, dialog_NPC_BARKEEPER_UFO_MAIN, 1,-1, "");//Hauptmenü öffnen
			}
		    return 1;
		}
	    case dialog_NPC_BARKEEPER_UFO_GANG2:
		{
	        format(string,sizeof(string),"{C87E35}Wez (Barkeeper):\n{F1F7DC}\"Alles, klar.");
	        SetPVarInt(playerid,"gang_create_farbe",listitem);
	        switch(listitem)
	        {
	            case 0: { strcat(string," {0094FF}Hellblau"); 	}
	            case 1: { strcat(string," {267F00}Dunkelgrün");	}
	            case 2: { strcat(string," {00FF21}Hellgrün"); 	}
	            case 3: { strcat(string," {724F0E}Braun"); 		}
	            case 4: { strcat(string," {FF0000}Rot");        }
	            case 5: { strcat(string," {FF6A00}Orange");     }
	            case 6: { strcat(string," {FFD800}Gelb");       }
	            case 7: { strcat(string," {B200FF}Violett");    }
	            case 8: { strcat(string," {FF7FED}Rosa");    	}
	            case 9: { strcat(string," {808080}Grau");		}
	            default:{ strcat(string," {808080}Grau");		}
	        }
	     	strcat(string," {F1F7DC}ist echt eine schöne Farbe.\nWie soll deine Bande denn nun heißen?\"");
	        ShowPlayerDialog(playerid,dialog_NPC_BARKEEPER_UFO_GANG3,DIALOG_STYLE_INPUT,"{C87E35}Gespräch mit Wez",string,"Weiter","");
			return 1;
		}
	    case dialog_NPC_BARKEEPER_UFO_GANG3:
		{
			new valid = 0;
		    if(strlen(inputtext) < MIN_GANG_NAME_LEN) valid = 1;
			else if(strlen(inputtext) > MAX_GANG_NAME_LEN) valid = 3;
			for(new charid=0; charid < strlen(inputtext); charid++)
			{
			    if(!((inputtext[charid] >= 'a' && inputtext[charid] <= 'z') || (inputtext[charid] >= 'A' && inputtext[charid] <= 'Z') || (inputtext[charid] >= '0' && inputtext[charid] <= '9'))) valid = 2;
			}
		    if(valid >= 1)
		    {
		     	if(valid == 1 || valid == 3) format(string,sizeof(string),"{C87E35}Wez (Barkeeper):\n\"{F1F7DC}Ach komm. Der Name sollte zwischen 3 und 25 Zeichen lang sein... Wie\nwillst du deine Gang nun nennen?\"\n\n\n{878375}Hinweis: Der Name deiner Gang sollte mindestens 3 Zeichen lang sein und\nnur Buchstaben und/oder Zahlen enthalten.",string);
				else format(string,sizeof(string),"{C87E35}Wez (Barkeeper):\n\"{F1F7DC}Ach komm, der Name sollte nur a-z, A-Z, 0-9 enthalten... Wie\nwillst du deine Gang nun nennen?\"\n\n\n{878375}Hinweis: Der Name deiner Gang sollte mindestens 3 Zeichen lang sein und\nnur Buchstaben und/oder Zahlen enthalten.",string);
		        ShowPlayerDialog(playerid,dialog_NPC_BARKEEPER_UFO_GANG3,DIALOG_STYLE_INPUT,"{C87E35}Gespräch mit Wez",string,"Weiter","");
		    }
		    else
		    {
			    new joining_playerids_gang = 0;
			    for(new pid; pid<=__SERVER[HIGHEST_PLAYER_ID]; pid++)
			    {
			        if(!IsPlayerConnected(pid) || IsPlayerNPC(pid)) continue;
			        if(GetPVarInt(pid,"joining_gang") == playerid) joining_playerids_gang++;
			    }
                new gid = gang::CreateGang(inputtext,PlayerInfo[playerid][PLAYER_ID]);
                if(gid == -1)
                {
                    print("ERROR CREATING GANG");
                    return 1;
                }
			    mysql_SetIntByInt("pnwl_user","gang",gid,"userid",PlayerInfo[playerid][PLAYER_ID]);
			    mysql_SetIntByInt("pnwl_user","grang",-1,"userid",PlayerInfo[playerid][PLAYER_ID]);

				format(string,sizeof(string),"Du bist %s's Gang (%s) beigetreten.",PlayerInfo[playerid][pName],inputtext);
				for(new pid; pid<=__SERVER[HIGHEST_PLAYER_ID]; pid++)
			    {
			        if(!IsPlayerConnected(pid) || IsPlayerNPC(pid)) continue;
			        if(GetPVarInt(pid,"joining_gang") == playerid)
			        {
			        	if(pid != playerid)
						{
				        	SetPVarInt(pid,"joining_gang",			-1);
				        	SetPVarInt(pid,"invite_joining_gang",	-1);
				        	PlayerInfo[pid][pGang] 					= gid;
				        	PlayerInfo[pid][pGangRang] 				= 1;
				        	mysql_SetIntByInt("pnwl_user","gang",gid,"userid",PlayerInfo[pid][PLAYER_ID]);
							mysql_SetIntByInt("pnwl_user","grang",1,"userid",PlayerInfo[pid][PLAYER_ID]);
							SendClientMessage(pid,GRUEN,string);
							continue;
						}
						format(query,sizeof(query),"GANG: %s ist deiner Gang beigetreten",GetName(pid));
						SendClientMessage(playerid,GRUEN,query);
						continue;
					}
					if(GetPVarInt(pid,"invite_joining_gang") == playerid)
					{
						SetPVarInt(pid,"invite_joining_gang",-1);
						SendClientMessage(pid,ROT,#FORMAT_CHAT_INFO"Die Gang wurde ohne dich gegründet.");
					}
			    }
				format(string,sizeof(string),"{C87E35}Wez (Barkeeper):\n\"{F1F7DC}Herzlichen Glückwunsch, du hast erfolgreich deine eigene Gang gegründet.\n\nFakten:\nName: %s\nMitglieder: %d\nFarbe:",inputtext,joining_playerids_gang);
		        switch(GetPVarInt(playerid,"gang_create_farbe"))
		        {
		            case 0: { strcat(string,"{0094FF}Hellblau"); 	}
		            case 1: { strcat(string," {267F00}Dunkelgrün"); }
		            case 2: { strcat(string," {00FF21}Hellgrün"); 	}
		            case 3: { strcat(string," {724F0E}Braun"); 		}
		            case 4: { strcat(string," {FF0000}Rot");        }
		            case 5: { strcat(string," {FF6A00}Orange");     }
		            case 6: { strcat(string," {FFD800}Gelb");       }
		            case 7: { strcat(string," {B200FF}Violett");    }
		            case 8: { strcat(string," {FF7FED}Rosa");    	}
		            case 9: { strcat(string," {808080}Grau");		}
		            default:{ strcat(string," {808080}Grau");		}
		        }
		        strcat(string,"{F1F7DC}\n\nViel Glück ;)\"\n\n\n{878375}Hinweis: Du kannst mit deiner Gang Häuser kaufen, Gangwars führen und und Gebiete erobern");
		        ShowPlayerDialog(playerid,dialog_NULL,DIALOG_STYLE_MSGBOX,"{C87E35}Gang gegründet",string,"Weiter","");
		        SetPVarInt(playerid,"creating_gang",0);
		    }
		    return 1;
		}
	    case dialog_SELECT_SPAWN_MAIN:
		{
		    if(response)
		    {
		    	new selectspawn = CSpawn[playerid][listitem];
		    	PlayerOption[playerid][SelectedSpawn] = selectspawn;
		    	mysql_SetIntByInt("pnwl_user_option","selectedspawn",selectspawn,"userid",PlayerInfo[playerid][PLAYER_ID]);
		    	switch(selectspawn)
		    	{
		            /*0 = noob spawn
					1 = log spawn
					2 = haus spawn
					3 = fraktions spawn
					4 = crash spawn
					5 = tot spawn*/
		    	    case 0:
		    	    {//noob spawn
		    	        format(string,sizeof(string),"{F1F7DC}Du wirst nun am {77AE35}Hotel in Fort Carson {F1F7DC}spawnen.");
		    	    }
		    	    case 1:
		    	    {//log spawn
		    	        format(string,sizeof(string),"{F1F7DC}Du wirst nun an der {77AE35}Position vor deinem Logout {F1F7DC}spawnen.");
		    	    }
		    	    case 2:
		    	    {//haus spawn
		    	        format(string,sizeof(string),"{F1F7DC}Du wirst nun an {77AE35}deinem Haus {F1F7DC}spawnen.");
		    	    }
		    	    case 3:
		    	    {//fraktions spawn
		    	        switch(PlayerInfo[playerid][Fraktion])
						{
							case 0: format(string,sizeof(string),"Zivilist");
							case 1: format(string,sizeof(string),"Armee");
							case 2: format(string,sizeof(string),"Infizierte");
							default: format(string,sizeof(string),"Unknown");
						}
		    	        format(string,sizeof(string),"{F1F7DC}Du wirst nun an der {77AE35}Basis deiner Fraktion (%s){F1F7DC}spawnen.",string);
		    	    }
		    	    case 4:
		    	    {//crashed spawn
		    	        format(string,sizeof(string),"{F1F7DC}Du wirst nun der {77AE35}Stelle deines Gamecrashes {F1F7DC}spawnen.");
		    	    }
		    	    case 5:
		    	    {//tot spawn
		    	        format(string,sizeof(string),"{F1F7DC}Du wirst nun an der {77AE35}Stelle deines Todes {F1F7DC}spawnen.");
		    	    }
		    	}
				ShowPlayerDialog(playerid,dialog_SELECT_SPAWN_SELECTED,DIALOG_STYLE_MSGBOX,"{F1F7DC}Spawn auswählen",string,"Bestätigen","Hauptmenü");
		    }
		    return 1;
		}
	    case dialog_SELECT_SPAWN_SELECTED:
		{
	        /*0 = noob spawn
			1 = log spawn
			2 = haus spawn
			3 = fraktions spawn
			4 = crash spawn
			5 = tot spawn*/
			if(response)
			{
		        new spawn_loop = 0;

	        	if(PlayerOption[playerid][SelectedSpawn] == 0) format(string,sizeof(string),"{77AE35}==> Hotel in Fort Carson");
	        	else format(string,sizeof(string),"{F1F7DC}Hotel in Fort Carson");
	        	CSpawn[playerid][spawn_loop] = 0;
	        	spawn_loop++;
			        	
				if(PlayerInfo[playerid][Fraktion] == 1)
				{//Armee
		        	if(PlayerOption[playerid][SelectedSpawn] == 3)strcat(string,"\n{77AE35}==> Basis der Armee");
		        	else strcat(string,"\n{F1F7DC}Basis der Armee");
		        	CSpawn[playerid][spawn_loop] = 3;
		        	spawn_loop++;
				}
				if(PlayerInfo[playerid][Fraktion] == 2)
				{//Infizierte
		        	if(PlayerOption[playerid][SelectedSpawn] == 3) strcat(string,"\n{77AE35}==> Basis der Infizierten");
		        	else strcat(string,"\n{F1F7DC}Basis der Infizierten");
		        	CSpawn[playerid][spawn_loop] = 3;
		        	spawn_loop++;
				}

		        if(PlayerInfo[playerid][ConnectedTimes] >= 1 && GetPVarInt(playerid,"first_connection") == 0)
		        {
		            if(PlayerOption[playerid][SelectedSpawn] == 1) strcat(string,"\n{77AE35}==> Letzte Position");
		            else strcat(string,"\n{F1F7DC}Letzte Position");
					CSpawn[playerid][spawn_loop] = 1;
					spawn_loop++;
		        }
		        if(PlayerOption[playerid][Crashed] == 1)
		        {
		            if(PlayerOption[playerid][SelectedSpawn] == 4) strcat(string,"\n{77AE35}==> Crashed Position");
		            else strcat(string,"\n{F1F7DC}Crashed Position");
					CSpawn[playerid][spawn_loop] = 4;
					spawn_loop++;
		        }
		        if(PlayerOption[playerid][HouseSelect] != -1)
		        {
		            if(PlayerOption[playerid][SelectedSpawn] == 2) format(string,sizeof(string),"%s\n{77AE35}==> Haus (ID %d)",string,PlayerOption[playerid][HouseSelect]);
		            else format(string,sizeof(string),"%s\n{F1F7DC}Haus (ID %d)",string,PlayerOption[playerid][HouseSelect]);
					CSpawn[playerid][spawn_loop] = 2;
					spawn_loop++;
		        }
		        ShowPlayerDialog(playerid,dialog_SELECT_SPAWN_MAIN,DIALOG_STYLE_LIST,"{F1F7DC}Spawn auswählen",string,"Auswählen","Beenden");
			}
		    return 1;
		}
	    case dialog_OPTION_SET:
		{
	        if(PlayerOption[playerid][OptionC]&optCRoom) format(string,sizeof(string),"{F1F7DC}Kontrollraummeldung\t\t {C85135}deaktiviert {F1F7DC}(=> {77AE35}aktivieren{F1F7DC})");
	        else format(string,sizeof(string),"{F1F7DC}Kontrollraummeldung\t\t {77AE35}aktiviert {F1F7DC}(=> {C85135}deaktivieren{F1F7DC})");
	        if(PlayerOption[playerid][OptionC]&optCTod)		strcat(string,"\n{F1F7DC}Todesmeldung\t\t\t {C85135}deaktiviert {F1F7DC}(=> {77AE35}aktivieren{F1F7DC})");
	        else 											strcat(string,"\n{F1F7DC}Todesmeldung\t\t\t {77AE35}aktiviert {F1F7DC}(=> {C85135}deaktivieren{F1F7DC})");
	        if(PlayerOption[playerid][OptionC]&optCSound)	strcat(string,"\n{F1F7DC}Sounds\t\t\t\t {C85135}deaktiviert{F1F7DC} (=> {77AE35}aktivieren{F1F7DC})");
	        else 											strcat(string,"\n{F1F7DC}Sounds\t\t\t\t {77AE35}aktiviert {F1F7DC}(=> {C85135}deaktivieren{F1F7DC})");
	        if(PlayerOption[playerid][OptionC]&optCMail)	strcat(string,"\n{F1F7DC}E-Mail Benachrichtigungen\t {C85135}deaktiviert{F1F7DC} (=> {77AE35}aktivieren{F1F7DC})");
	        else 											strcat(string,"\n{F1F7DC}E-Mail Benachrichtigungen\t {77AE35}aktiviert {F1F7DC}(=> {C85135}deaktivieren{F1F7DC})");
	        if(PlayerOption[playerid][OptionC]&optCAlogin)	strcat(string,"\n{F1F7DC}Automatischer Login\t\t {C85135}deaktiviert{F1F7DC} (=> {77AE35}aktivieren{F1F7DC})");
	        else 											strcat(string,"\n{F1F7DC}Automatischer Login\t\t {77AE35}aktiviert {F1F7DC}(=> {C85135}deaktivieren{F1F7DC})");
			ShowPlayerDialog(playerid,dialog_OPTION_MAIN,DIALOG_STYLE_LIST,"{F1F7DC}Spieleinstellungen",string,"Auswählen","Beenden");
		}
	    case dialog_OPTION_MAIN:
		{
			if(response)
			{
			    switch(listitem)
			    {
			        case 0:
			        {//CRaum Meldung
			            if(PlayerOption[playerid][OptionC] & optCRoom)
			            {
			                PlayerOption[playerid][OptionC] &= ~optCRoom;
			                mysql_SetIntByInt("pnwl_user_option","optionc",PlayerOption[playerid][OptionC],"userid",PlayerInfo[playerid][PLAYER_ID]);
			                ShowPlayerDialog(playerid,dialog_OPTION_SET,DIALOG_STYLE_MSGBOX,"{F1F7DC}Einstellung geändert","{F1F7DC}Du hast die Kontrollraummeldung {77AE35}aktiviert{F1F7DC}.","Hauptmenü","");
			            }
			            else
			            {
			                PlayerOption[playerid][OptionC] |= optCRoom;
			                mysql_SetIntByInt("pnwl_user_option","optionc",PlayerOption[playerid][OptionC],"userid",PlayerInfo[playerid][PLAYER_ID]);
			                ShowPlayerDialog(playerid,dialog_OPTION_SET,DIALOG_STYLE_MSGBOX,"{F1F7DC}Einstellung geändert","{F1F7DC}Du hast die Kontrollraummeldung {C85135}deaktiviert{F1F7DC}.","Hauptmenü","");
			            }
			        }
			        case 1:
			        {//Todesmeldung
			            if(PlayerOption[playerid][OptionC] & optCTod)
			            {
			                PlayerOption[playerid][OptionC] &= ~optCTod;
			                mysql_SetIntByInt("pnwl_user_option","optionc",PlayerOption[playerid][OptionC],"userid",PlayerInfo[playerid][PLAYER_ID]);
			                ShowPlayerDialog(playerid,dialog_OPTION_SET,DIALOG_STYLE_MSGBOX,"{F1F7DC}Einstellung geändert","{F1F7DC}Du hast die Todesmeldung {77AE35}aktiviert{F1F7DC}.","Hauptmenü","");
			            }
			            else
			            {
                            PlayerOption[playerid][OptionC] |= optCTod;
			                mysql_SetIntByInt("pnwl_user_option","optionc",PlayerOption[playerid][OptionC],"userid",PlayerInfo[playerid][PLAYER_ID]);
			                ShowPlayerDialog(playerid,dialog_OPTION_SET,DIALOG_STYLE_MSGBOX,"{F1F7DC}Einstellung geändert","{F1F7DC}Du hast die Todesmeldung {C85135}deaktiviert{F1F7DC}.","Hauptmenü","");
			            }
			        }
			        case 2:
			        {//Sound de/aktivieren
			            if(PlayerOption[playerid][OptionC] & optCSound)
			            {
			                PlayerOption[playerid][OptionC] &= ~optCSound;
			                mysql_SetIntByInt("pnwl_user_option","optionc",PlayerOption[playerid][OptionC],"userid",PlayerInfo[playerid][PLAYER_ID]);
			                ShowPlayerDialog(playerid,dialog_OPTION_SET,DIALOG_STYLE_MSGBOX,"{F1F7DC}Einstellung geändert","{F1F7DC}Du hast die Sounds {77AE35}aktiviert{F1F7DC}.","Hauptmenü","");
			            }
						else
						{
			                PlayerOption[playerid][OptionC] |= optCSound;
			                mysql_SetIntByInt("pnwl_user_option","optionc",PlayerOption[playerid][OptionC],"userid",PlayerInfo[playerid][PLAYER_ID]);
			                ShowPlayerDialog(playerid,dialog_OPTION_SET,DIALOG_STYLE_MSGBOX,"{F1F7DC}Einstellung geändert","{F1F7DC}Du hast die Sounds {C85135}deaktiviert{F1F7DC}.","Hauptmenü","");
						}
			        }
			        case 3:
			        {//E-Mail Benachrichtigungen de/aktivieren
			            if(PlayerOption[playerid][OptionC] & optCMail)
			            {
			                PlayerOption[playerid][OptionC] &= ~optCMail;
			                mysql_SetIntByInt("pnwl_user_option","optionc",PlayerOption[playerid][OptionC],"userid",PlayerInfo[playerid][PLAYER_ID]);
			                ShowPlayerDialog(playerid,dialog_OPTION_SET,DIALOG_STYLE_MSGBOX,"{F1F7DC}Einstellung geändert","{F1F7DC}Du hast die E-Mail Benachrichtigungen {77AE35}aktiviert{F1F7DC}.","Hauptmenü","");
			            }
						else
						{
			                PlayerOption[playerid][OptionC] |= optCMail;
			                mysql_SetIntByInt("pnwl_user_option","optionc",PlayerOption[playerid][OptionC],"userid",PlayerInfo[playerid][PLAYER_ID]);
			                ShowPlayerDialog(playerid,dialog_OPTION_SET,DIALOG_STYLE_MSGBOX,"{F1F7DC}Einstellung geändert","{F1F7DC}Du hast die E-Mail Benachrichtigungen {C85135}deaktiviert{F1F7DC}.","Hauptmenü","");
						}
			        }
			        case 4:
			        {//Automatischer Login
			            if(PlayerOption[playerid][OptionC] & optCAlogin)
			            {
			                PlayerOption[playerid][OptionC] &= ~optCAlogin;
			                mysql_SetIntByInt("pnwl_user_option","optionc",PlayerOption[playerid][OptionC],"userid",PlayerInfo[playerid][PLAYER_ID]);
							format(query,sizeof(query),"UPDATE pnwl_user_logins SET alogin='1' WHERE userid='%d' AND gpci='%s' AND ip LIKE '%s.%%' AND timestamp>%d",PlayerInfo[playerid][PLAYER_ID],GetGPCI(playerid),CORE::GetIpBlock(GetIP(playerid),3),gettime(_,_,_)-(CACHED_LOGIN_VALIDATION*60));
							mysql_query_once(query);
			                ShowPlayerDialog(playerid,dialog_OPTION_SET,DIALOG_STYLE_MSGBOX,"{F1F7DC}Einstellung geändert","{F1F7DC}Du hast den automatischen Login {77AE35}aktiviert{F1F7DC}.","Hauptmenü","");
			            }
						else
						{
			                PlayerOption[playerid][OptionC] |= optCAlogin;
			                mysql_SetIntByInt("pnwl_user_option","optionc",PlayerOption[playerid][OptionC],"userid",PlayerInfo[playerid][PLAYER_ID]);
			                format(query,sizeof(query),"UPDATE pnwl_user_logins SET alogin='0' WHERE userid='%d'",PlayerInfo[playerid][PLAYER_ID]);
			                mysql_query_once(query);
			                ShowPlayerDialog(playerid,dialog_OPTION_SET,DIALOG_STYLE_MSGBOX,"{F1F7DC}Einstellung geändert","{F1F7DC}Du hast den automatischen Login {C85135}deaktiviert{F1F7DC}.","Hauptmenü","");
						}
			        }
			    }
			}
		    return 1;
		}
	    case dialog_NPC_WAFFENDEALER_MAIN:
		{
			if(response)
			{
			    switch(listitem)
			    {
					case 0:
					{
					    TogglePlayerControllable(playerid,false);
					    //PlayerShopDrawHide(playerid);
					    SetPVarInt(playerid,"in_shop",1);
						SetPVarInt(playerid,"waffenladen",1);
						SetPVarInt(playerid,"waffe",0);
						SetPlayerCameraInfoEx(playerid,Float:{-170.9597,1166.4010,88.3823},Float:{-171.0594,1171.5595,89.0823});//RIFLE
						//UpdatePlayerShopScreen(playerid,SHOPSCREEN_WAFFEN);
						UpdatePlayerShopScreen(playerid,SHOPSCREEN_WAFFEN);
					}
					case 1:
					{
					    response = 0;
					}
				}
			}
			if(!response)
			{
				format(string,sizeof(string),#SOUND_PATH"/npc/dimitry/verabschieden/v%d-128k.mp3",random(4));
	            aPlayAudioStreamForPlayer(playerid,string);
				TogglePlayerControllable(playerid,true);
	            SetPVarInt(playerid,"waffenladen",0);
	            SetPVarInt(playerid,"waffe",0);
	        	DeletePVar(playerid,"npc_gespräch");
	        	DeletePVar(playerid,"waffenladen");
	        	DeletePVar(playerid,"waffe");
	            SetCameraBehindPlayer(playerid);
			}
		    return 1;
		}
	    case dialog_NPC_WAFFENDEALER_WENIG:
		{
			switch(listitem)
			{
			    case 0:
			    {//Weitershoppen
			        return 1;
			    }
			    case 1:
			    {//Items bieten
			        item::SHOW_ITEM_LIST(playerid);
			    }
			    case 2:
			    {//Feilschen
			    	new wpreis = waffenpreis[GetPVarInt(playerid,"waffe")],
			    	    pcash = PlayerNPC[playerid][NPC_DIMITRY][cash];
					if((pcash/wpreis*(1+(PlayerNPC[playerid][NPC_DIMITRY][beliebtheit]+PlayerSkill[playerid][SkillWortgewandt])/200)) >= 1)
					{//Kauf erfolgreich
			            format(string,sizeof(string),#SOUND_PATH"/npc/dimitry/kaufen/k%d-128k.mp3",random(8));
			            aPlayAudioStreamForPlayer(playerid,string);
			            switch(GetPVarInt(playerid,"waffe"))
			            {
							case 0: { format(string,sizeof(string),"Gewehr"); 		fixed_GivePlayerWeapon(playerid,33,50); }
							case 1: { format(string,sizeof(string),"Sniper"); 		fixed_GivePlayerWeapon(playerid,34,50); }
							case 2: { format(string,sizeof(string),"AK-47"); 		fixed_GivePlayerWeapon(playerid,30,50); }
							case 3: { format(string,sizeof(string),"M4"); 			fixed_GivePlayerWeapon(playerid,31,50); }
							case 4: { format(string,sizeof(string),"Schrotgewehr"); fixed_GivePlayerWeapon(playerid,25,50); }
							case 5: { format(string,sizeof(string),"SawnOff"); 		fixed_GivePlayerWeapon(playerid,26,50); }
							case 6: { format(string,sizeof(string),"9mm Pistole"); 	fixed_GivePlayerWeapon(playerid,22,50); }
							case 7: { format(string,sizeof(string),"Desert Eagle"); fixed_GivePlayerWeapon(playerid,24,50); }
			            }
			            format(string,sizeof(string),"{C87E35}Feilschen erfolgreich. Du hast eine \"%s\" gekauft.",string);
	                    ShowPlayerDialog(playerid,dialog_NPC_WAFFENDEALER_KAUF,DIALOG_STYLE_LIST,string,"{F1F7DC}Laden verlassen\nWeiter einkaufen","Weiter","");
	                    PlayerNPC[playerid][NPC_DIMITRY][cash] -= wpreis;

						new am_id = __amCache[amWarlord];
						if(am_id != -1) achievement::SetPlayerAchievementData(playerid,am_id,1,true);
					}
					else
					{//Kauf nicht erfolgreich
					    ShowPlayerDialog(playerid,dialog_NPC_WAFFENDEALER_KAUF,DIALOG_STYLE_MSGBOX,"{F1F7DC}Feilschen gescheitert","{F1F7DC}Du hast Dimitry nicht überzeugen können. Biete etwas mehr\nund versuche es dann erneut.","Weiter","");
					}
					return 1;
			    }
			    case 3:
			    {//Drohen
			    	new wpreis = waffenpreis[GetPVarInt(playerid,"waffe")],
			    	    pcash = PlayerNPC[playerid][NPC_DIMITRY][cash];
					if((pcash/wpreis*(1+(PlayerNPC[playerid][NPC_DIMITRY][beliebtheit]+PlayerSkill[playerid][SkillWortgewandt])/200)) >= 1)
					{//Kauf erfolgreich
			            format(string,sizeof(string),#SOUND_PATH"/npc/dimitry/kaufen/k%d-128k.mp3",random(8));
			            aPlayAudioStreamForPlayer(playerid,string);
			            switch(GetPVarInt(playerid,"waffe"))
			            {
							case 0: { format(string,sizeof(string),"Gewehr"); 		fixed_GivePlayerWeapon(playerid,33,50); }
							case 1: { format(string,sizeof(string),"Sniper"); 		fixed_GivePlayerWeapon(playerid,34,50); }
							case 2: { format(string,sizeof(string),"AK-47"); 		fixed_GivePlayerWeapon(playerid,30,50); }
							case 3: { format(string,sizeof(string),"M4"); 			fixed_GivePlayerWeapon(playerid,31,50); }
							case 4: { format(string,sizeof(string),"Schrotgewehr"); fixed_GivePlayerWeapon(playerid,25,50); }
							case 5: { format(string,sizeof(string),"SawnOff"); 		fixed_GivePlayerWeapon(playerid,26,50); }
							case 6: { format(string,sizeof(string),"9mm Pistole"); 	fixed_GivePlayerWeapon(playerid,22,50); }
							case 7: { format(string,sizeof(string),"Desert Eagle"); fixed_GivePlayerWeapon(playerid,24,50); }
			            }
			            format(string,sizeof(string),"{C87E35}Einschüchtern erfolgreich. Du hast eine \"%s\" gekauft.",string);
	                    ShowPlayerDialog(playerid,dialog_NPC_WAFFENDEALER_KAUF,DIALOG_STYLE_LIST,string,"{F1F7DC}Laden verlassen\nWeiter einkaufen","Weiter","");
	                    PlayerNPC[playerid][NPC_DIMITRY][cash] -= wpreis;

						new am_id = __amCache[amWarlord];
						if(am_id != -1) achievement::SetPlayerAchievementData(playerid,am_id,1,true);
					}
				    else ShowPlayerDialog(playerid,dialog_NPC_WAFFENDEALER_KAUF,DIALOG_STYLE_MSGBOX,"{F1F7DC}Einschüchtern gescheitert","{F1F7DC}Du hast Dimitry nicht überzeugen können. Biete etwas mehr\nund versuche es dann erneut.","Weiter","");
				    return 1;
			    }
			    case 4:
			    {//Verlassen
					format(string,sizeof(string),#SOUND_PATH"/npc/dimitry/verabschieden/v%d-128k.mp3",random(4));
		            aPlayAudioStreamForPlayer(playerid,string);
				    UpdatePlayerShopScreen(playerid,SHOPSCREEN_WAFFEN,false);
					TogglePlayerControllable(playerid,true);
		            SetPVarInt(playerid,"waffenladen",0);
		            SetPVarInt(playerid,"waffe",0);
		        	DeletePVar(playerid,"npc_gespräch");
		        	DeletePVar(playerid,"waffenladen");
		        	DeletePVar(playerid,"waffe");
		            SetCameraBehindPlayer(playerid);
					return 1;
			    }
			}
		    return 1;
		}
	    case dialog_NPC_WAFFENDEALER_KAUF:
		{
		    if(listitem == 0)
		    {//Shop verlassen
				format(string,sizeof(string),#SOUND_PATH"/npc/dimitry/verabschieden/v%d-128k.mp3",random(4));
	            aPlayAudioStreamForPlayer(playerid,string);
			    UpdatePlayerShopScreen(playerid,SHOPSCREEN_WAFFEN,false);
				TogglePlayerControllable(playerid,true);
	            SetPVarInt(playerid,"waffenladen",0);
	            SetPVarInt(playerid,"waffe",0);
	        	DeletePVar(playerid,"npc_gespräch");
	        	DeletePVar(playerid,"waffenladen");
	        	DeletePVar(playerid,"waffe");
	            SetCameraBehindPlayer(playerid);
		        return 1;
		    }
		    else
		    {//Weitershoppen
	            return 1;
		    }
		}
		case dialog_ITEMSTORE_MAINRE:
		{
		    format(string,sizeof(string),"Informationen\nItems einlagern\nItems rausholen (%d stück)",GetPVarInt(playerid,"itemstore_unique"));
		    ShowPlayerDialog(playerid,dialog_ITEMSTORE_MAIN,DIALOG_STYLE_LIST,"Itemlager",string,"Weiter","Beenden");
		    return 1;
		}
		case dialog_ITEMSTORE_MAIN:
		{
		    if(!response) return 1;
		    switch(listitem)
		    {
				case 0://Informationen
				{
				    ShowPlayerDialog(playerid,dialog_ITEMSTORE_MAINRE,DIALOG_STYLE_MSGBOX,"Itemlager","Infos","Zurück","");
				    return 1;
				}
				case 1://Einlagern
				{
				    ShowPlayerDialog(playerid,dialog_ITEMSTORE_MAINRE,DIALOG_STYLE_MSGBOX,"Itemlager","Einlagern","Zurück","");
				    return 1;
				}
				case 2://Lager verwalten
				{
					if(GetPVarInt(playerid,"itemstore_unique") <= 0) return ShowPlayerDialog(playerid,dialog_ITEMSTORE_MAINRE,DIALOG_STYLE_MSGBOX,"{F1F7DC}Itemlager","{F1F7DC}Dein Lager ist leer","Zurück","");
					new start	= GetPVarInt(playerid,"itemstore_page");
					if(start < 0)							SetPVarInt(playerid,"itemstore_page",0), start = 0;
					if((start*ITEMS_PER_PAGE) >= MAX_ITEMS) SetPVarInt(playerid,"itemstore_page",0), start = 0;
					new	end = (start+ITEMS_PER_PAGE),
						list[ITEMS_PER_PAGE][2];
					item::store_GetItemList(playerid,start,end,list);
					format(string,sizeof(string),"{FFECAA}Nächste Seite\n{FFECAA}Vorherige Seite");
					PlayerOption[playerid][dialog][0] = -3;
					PlayerOption[playerid][dialog][1] = -4;
					for(new i; i<ITEMS_PER_PAGE; i++)
					{
					    if(0 < list[1][0] < MAX_ITEMS)
						{
						    format(string,sizeof(string),"{F1F7DC}%s\n%dx \"%s\"",string,list[i][1],item_ItemInfo[list[i][0]][iName]);
						    PlayerOption[playerid][dialog][i+2] = list[i][0];
						    continue;
					    }
					    format(string,sizeof(string),"%s\n{F1F7DC}Leer",string);
					    PlayerOption[playerid][dialog][i+2] = 0;
					}
					format(query,sizeof(query),"{F1F7DC}Itemlager (Seite %d)",GetPVarInt(playerid,"itemstore_page")+1);
					ShowPlayerDialog(playerid,dialog_ITEMSTORE_SELECT_ITEM,DIALOG_STYLE_LIST,query,string,"Weiter","Zurück");
					return 1;
				}
		    }
		    return 1;
		}
		case dialog_ITEMSTORE_SELECT_ITEM:
		{
		    if(!response) return 1;
		    new choice = GetDialogOption(playerid,listitem);
			switch(choice)
			{
			    case -3:
			    {//Nächste Seite
			        SetPVarInt(playerid,"itemstore_page",GetPVarInt(playerid,"itemstore_page")+1);
			        OnDialogResponse(playerid,dialog_ITEMSTORE_MAIN,1,2,"");
			        return 1;
			    }
			    case -4:
				{//Vorherige Seite
				    SetPVarInt(playerid,"itemstore_page",GetPVarInt(playerid,"itemstore_page")-1);
				    if(GetPVarInt(playerid,"itemstore_page") < 0) SetPVarInt(playerid,"itemstore_page",0);
				    OnDialogResponse(playerid,dialog_ITEMSTORE_MAIN,1,2,"");
				    return 1;
				}
				case 1..MAX_ITEMS:
				{
				    SetPVarInt(playerid,"itemstore_man_itemid",choice);
				    format(string,sizeof(string),"{F1F7DC}Du hast %dx \"%s\" im Lager.\nWie viel möchtest du rausnehmen?",item::store_CountItems(playerid,choice),item_ItemInfo[choice][iName]);
				    ShowPlayerDialog(playerid,dialog_ITEMSTORE_WITHDRAW,DIALOG_STYLE_INPUT,"Itemlager",string,"Holen","Zurück");
				    return 1;
				}
			}
		    format(string,sizeof(string),"Informationen\nItems einlagern\nItems rausholen (%d stück)",GetPVarInt(playerid,"itemstore_unique"));
		    ShowPlayerDialog(playerid,dialog_ITEMSTORE_MAIN,DIALOG_STYLE_LIST,"Itemlager",string,"Weiter","Beenden");
		    return 1;
		}
		case dialog_ITEMSTORE_WITHDRAW:
		{
		    new itemid = GetPVarInt(playerid,"itemstore_man_itemid");
		    if(itemid < 0 || itemid >= MAX_ITEMS || !response)
			{
			    DeletePVar(playerid,"itemstore_man_itemid");
			    OnDialogResponse(playerid,dialog_ITEMSTORE_MAINRE,1,2,"");
				return 1;
			}
			new anzahl = strval(inputtext),
				in_lager = item::store_CountItems(playerid,itemid);
			if(anzahl > in_lager) anzahl = in_lager;
			if(anzahl <= 0)
			{
			    format(string,sizeof(string),"{F1F7DC}Du hast %dx \"%s\" im Lager.\nWie viel möchtest du rausnehmen?",item::store_CountItems(playerid,itemid),item_ItemInfo[itemid][iName]);
			    ShowPlayerDialog(playerid,dialog_ITEMSTORE_WITHDRAW,DIALOG_STYLE_INPUT,"Itemlager",string,"Holen","Zurück");
			    return 1;
			}
			new result = item::GivePlayerItem(playerid,itemid,anzahl);
			switch(result)
			{// -1 = falsche itemid, -2 = offline, -3 = zu wenig platz, -4 = zu wenig items
			    case -3:
			    {
				    ShowPlayerDialog(playerid,dialog_ITEMSTORE_WITHDRAW,DIALOG_STYLE_INPUT,"{F1F7DC}Itemlager","{F1F7DC}Du hast nicht genug Platz im Inventar.\nWie viel möchtest du rausnehmen?","Holen","Zurück");
				    return 1;
			    }
			    case 1:
			    {
			    	item::store_ChangeItemCount(playerid,itemid,-anzahl);
			    	format(string,sizeof(string),"{F1F7DC}Du hast %d \"%s\" aus dem Lager geholt",anzahl,item_ItemInfo[itemid][iName]);
			    	ShowPlayerDialog(playerid,dialog_ITEMSTORE_MAINRE,DIALOG_STYLE_MSGBOX,"{F1F7DC}Itemlager",string,"Zurück","");
			    }
			    default: DeletePVar(playerid,"itemstore_man_itemid");
			}
			return 1;
		}
		case dialog_REISEN_ORDER:
		{
		    if(!response) return 1;
		    new this_landing = GetPlayerLanding(playerid,15.0);
			if(BalloonInfo[bMoving])
			{
			    if(BalloonInfo[bTarget] == this_landing)
			    {//Ist schon unterwegs zur LP
			        SendClientMessage(playerid,-1,#FORMAT_CHAT_INFO"Ein Balloon ist unterwegs zu dir.");
			        SetPVarInt(playerid,"balloon_ordered",1);
			        return 1;
			    }//Ist unterwegs zur anderen LP
				SendClientMessage(playerid,ROT,"Hinweis: Der Balloon ist noch unterwegs. Versuche es später...");
				return 1;
			}
			else if(BalloonInfo[bTarget] != this_landing)
			{//Ist woanders, wird hergeholt
				SendClientMessage(playerid,-1,#FORMAT_CHAT_INFO"Ein Balloon ist unterwegs zu dir.");
				SetPVarInt(playerid,"balloon_ordered",1);
			    BalloonCheckpoint(-1,0,BalloonInfo[bTarget],this_landing);
			    return 1;
			}
			else ncom_reisen(playerid);//Ist bereits hier
			return 1;
		}
		case dialog_REISEN_TARGET:
		{
		    if(!response) return 1;
			new target 			= GetDialogOption(playerid,listitem),
				this_landing	= GetPlayerLanding(playerid,15.0);

			if(target < 0 || target >= sizeof(land_point)) 	return SendClientMessage(playerid,0x77AE35FF,"ERROR: Invalid target");
			if(target == this_landing) 						return SendClientMessage(playerid,0x77AE35FF,"ERROR: Target = This");

			if(BalloonInfo[bMoving])
			{
				SendClientMessage(playerid,-1,#FORMAT_CHAT_INFO"Der Balloon ist noch unterwegs. Versuche es später...");
				return 1;
			}
			else if(BalloonInfo[bTarget] != this_landing)
			{
				SendClientMessage(playerid,-1,#FORMAT_CHAT_INFO"Ein Balloon ist unterwegs zu dir.");
			    BalloonCheckpoint(playerid,-1,BalloonInfo[bTarget],this_landing);
			    return 1;
			}
			new Float:bpos[3];
			GetObjectPos(BalloonInfo[bBalloon],bpos[0],bpos[1],bpos[2]);
			w_SetPlayerPos(playerid,bpos[0],bpos[1],bpos[2]+1.0);
			BalloonCheckpoint(playerid,0,this_landing,target);
			return 1;
		}
		case dialog_REVIVE_QUESTION:
		{
		    if(!response) return 1;
		    new qid = GetPVarInt(playerid,"medical_tr_mp_question"),
		        solutions[] = {0,1,2,3,4,5,6,7,8,9},
		        bool:revive = false;
			if(qid >= 0 && qid < sizeof(solutions)) if(solutions[qid] == listitem) revive = true;
			if(revive)
			{
			    SetTimerEx("OnPlayerRevive",4000,false,"dd",GetPVarInt(playerid,"medical_tr_tid"),playerid);
			}
		    return 1;
		}
		case dialog_VOTE_MAINRE:
		{
			if(!response) return 1;
			format(string,sizeof(string),"{F1F7DC}Informationen");
			if(GlobalVote[voteID])	format(string,sizeof(string),"%s\nAktuelle Abstimmung (ID %d)",string,GlobalVote[voteID]);
			else					strcat(string,"\nNeue Abstimmung starten");
			ShowPlayerDialog(playerid,dialog_VOTE_MAIN,DIALOG_STYLE_LIST,"{F1F7DC}Abstimmungen",string,"Weiter","Beenden");
			return 1;
		}
		case dialog_VOTE_MAIN:
		{
			if(!response) return 1;
			switch(listitem)
			{
				case 0:
				{//Informationen
					ShowPlayerDialog(playerid,dialog_VOTE_MAINRE,DIALOG_STYLE_MSGBOX,"{F1F7DC}Abstimmungen","{F1F7DC}Informationen:","Zurück","");
				}
				case 1:
				{//Abstimmen oder neue Abstimmung
					if(GlobalVote[voteID])
					{//Abstimmen
	                    format(string,sizeof(string),"{F1F7DC}Abstimmung (ID %d):\n%s möchte %s für 5 Minuten kicken.\nGrund: \"%s\"\nRestzeit: %d",
	                        GlobalVote[voteID],
	                        mysql_GetStringByInt("pnwl_user","username","userid",GlobalVote[voteStarterID]),
	                        mysql_GetStringByInt("pnwl_user","username","userid",GlobalVote[voteInformation][0]),
	                        GlobalVote[voteReason],
	                        GlobalVote[voteTimeLeft]);
					    ShowPlayerDialog(playerid,dialog_VOTE_TO_VOTE,DIALOG_STYLE_MSGBOX,"{F1F7DC}Abstimmungen",string,"Abstimmen","Zurück");
					}
					else
					{//Neue Abstimmung
						ShowPlayerDialog(playerid,dialog_VOTE_START_TYPE,DIALOG_STYLE_LIST,"{F1F7DC}Abstimmungen","{F1F7DC}Spieler für 5 Minuten kicken","Weiter","Zurück");
					}
				}
			}
			return 1;
		}
		case dialog_VOTE_TO_VOTE:
		{
		    if(!GlobalVote[voteID]) return OnDialogResponse(playerid,dialog_VOTE_MAINRE,1,0,"");
			ShowPlayerDialog(playerid,dialog_VOTE_VOTE,DIALOG_STYLE_LIST,"{F1F7DC}Abstimmungen","{F1F7DC}Mit \"{77AE35}Ja{F1F7DC}\" abstimmen\nMit \"{C85135}Nein{F1F7DC}\" abstimmen","Abstimmen","Zurück");
		    return 1;
		}
		case dialog_VOTE_START_TYPE:
		{
			if(GlobalVote[voteID] || !response) return OnDialogResponse(playerid,dialog_VOTE_MAINRE,1,0,"");
			switch(listitem)
			{
				case 0:
				{//Kick
					ShowPlayerDialog(playerid,dialog_VOTE_START_VALUE,DIALOG_STYLE_INPUT,"{F1F7DC}Abstimmungen","{F1F7DC}Gib einen Benutzernamen oder die PlayerID des Spielers ein,\nden du kicken möchtest:","Weiter","Zurück");
				}
				default: return OnDialogResponse(playerid,dialog_VOTE_MAINRE,1,0,"");
			}
			SetPVarInt(playerid,"new_vote_type",listitem);
			return 1;
		}
		case dialog_VOTE_START_VALUE:
		{
			if(GlobalVote[voteID] || !response) return OnDialogResponse(playerid,dialog_VOTE_MAINRE,1,0,"");
			new vote_type = GetPVarInt(playerid,"new_vote_type");
			switch(vote_type)
			{
				case 0:
				{//Kick
					new kickid = CORE::GetPlayerID(inputtext);
					if(kickid == -1 || IsPlayerNPC(kickid) || !PlayerEvent[kickid][LOGGED_IN] || PlayerInfo[kickid][Admin][0] > 0) return OnDialogResponse(playerid,dialog_VOTE_START_TYPE,1,vote_type,"");
					SetPVarInt(playerid,"new_vote_value",kickid);
					format(string,sizeof(string),"{F1F7DC}Gib einen Grund für den Kick von \"%s\" (ID %d) an:",GetName(kickid),kickid);
					ShowPlayerDialog(playerid,dialog_VOTE_START_REASON,DIALOG_STYLE_INPUT,"{F1F7DC}Abstimmungen",string,"Weiter","Zurück");
					return 1;
				}
			}
			return 1;
		}
		case dialog_VOTE_START_REASON:
		{
			if(GlobalVote[voteID]) return OnDialogResponse(playerid,dialog_VOTE_MAINRE,1,0,"");
			if(!response) return OnDialogResponse(playerid,dialog_VOTE_START_TYPE,1,GetPVarInt(playerid,"new_vote_type"),"");
			if(!IsPlayerConnected(GetPVarInt(playerid,"new_vote_value"))) return 1;

            mysql_real_escape_string(inputtext,query);
			format(string,sizeof(string),"INSERT INTO pnwl_votes (voteType,voteTimestamp,voteStarterID,voteInformation,voteReason) VALUES ('%d','%d','%d','%d','%s')",\
				GetPVarInt(playerid,"new_vote_type"),\
				gettime(_,_,_),\
				PlayerInfo[playerid][PLAYER_ID],\
				PlayerInfo[GetPVarInt(playerid,"new_vote_value")][PLAYER_ID],\
				query\
			);
			mysql_query(string);
			GlobalVote[voteID] 				= mysql_insert_id();
			mysql_free_result();
			GlobalVote[voteStarterID] 		= PlayerInfo[playerid][PLAYER_ID];
			GlobalVote[voteResult][0]		= CORE::CountPlayersOnline(false);
			GlobalVote[voteResult][1]		= 0;
			GlobalVote[voteResult][2]		= 0;
			GlobalVote[voteType] 			= GetPVarInt(playerid,"new_vote_type");
			GlobalVote[voteInformation][0]	= PlayerInfo[GetPVarInt(playerid,"new_vote_value")][PLAYER_ID];
			GlobalVote[voteTimeLeft]        = VOTE_TIME;
			format(GlobalVote[voteReason],144,"%s",query);
			while(strfind(GlobalVote[voteReason],"{") != -1) query[strfind(GlobalVote[voteReason],"{")] = '(';
			while(strfind(GlobalVote[voteReason],")") != -1) query[strfind(GlobalVote[voteReason],"{")] = ')';
			
			format(string,sizeof(string),"VOTE: %s hat eine neue Abstimmung gestartet. Ihr könnt über /vote abstimmen",GetName(playerid));
			SendClientMessageToAll(GRUEN,string);
			return 1;
		}
		case dialog_VOTE_VOTE:
		{
			if(!response) return OnDialogResponse(playerid,dialog_VOTE_MAINRE,1,0,"");
			switch(listitem)
			{
				case 0:
				{//Mit "Ja" abstimmen
					CORE::OnPlayerVote(playerid,1);
				}
				case 1:
				{//Mit "Nein" abstimmen
					CORE::OnPlayerVote(playerid,2);
				}
			}
			return 1;
		}		
	    case dialog_OPTION_TOT:
		{
			if(!response)
			{
			    PlayerOption[playerid][OptionC] |= optCTod;
			    mysql_SetIntByInt("pnwl_user_option","optionc",PlayerOption[playerid][OptionC],"userid",PlayerInfo[playerid][PLAYER_ID]);
			    return 1;
			}
			else return 1;
		}
	    case dialog_OPTION_CROOM:
		{
			if(!response)
			{
			    PlayerOption[playerid][OptionC] |= optCRoom;
			    mysql_SetIntByInt("pnwl_user_option","optionc",PlayerOption[playerid][OptionC],"userid",PlayerInfo[playerid][PLAYER_ID]);
			    return 1;
			}
			else return 1;
		}
	    case dialog_TAKE_MEDICINE:
		{
			ShowPlayerDialog(playerid,dialog_TAKE_MEDICINE_2,DIALOG_STYLE_MSGBOX,"Item/Statussystem","{878375}Mit /items kannst du deinen Rucksack oeffnen und alle Items, die du besitzt, verwalten.\nDu kannst diese zum Beispiel konsumieren, mit ihnen handeln oder sie wegwerfen. Jedes\nItem hat gewisse Eigenschaften, die mit dem Statussystem verknuepft sind. So wird diese\nMilit. Medizin zum Beispiel die Verstrahlung heilen.","Ok","");
			return 1;
		}
	    case dialog_TAKE_MEDICINE_2:
		{
		    ShowPlayerDialog(playerid,dialog_TAKE_MEDICINE_3,DIALOG_STYLE_MSGBOX,"Item/Statussystem","{878375}Dein Charakter hat Durst und Hunger, moechte schlafen und gepflegt werden.\nDurch zum Beispiel einer Flasche Wasser kannst du den Durst stillen. Falls\ndu dich bei Interaktionen verletzt hast wäre ein Verbandskasten sehr hilfreich.\nEs gibt aber auch spezielle Krankheiten, die du nicht heilen kannst, dafuer\nmusst du einen Arzt in einer der Hauptstädte aufsuchen","Ok","");
		    return 1;
		}
	    case dialog_TAKE_MEDICINE_3:
		{
		    format(string,sizeof(string),"{878375}Verschiedene Gegenstände haben auch verschiedene Interaktionen, so wird man\nein Funkgerät zum Beispiel nicht");
		    strcat(string," verzehren koennen, auch wenn es lecker aussieht.\nQuestitems sind mit einem [Q] vor dem Namen versehen, diese kannst du auch nicht\nwegwerfen, wenn du diese in der Quest noch benoetigst. Handeln kannst du diese auch\nnicht. Bevor du einen Handel mit anderen Spielern eingehst, stelle sicher, dass\ndiese keine Betrueger sind, Items werden NICHT zurueckerstattet.");
		    ShowPlayerDialog(playerid,dialog_TAKE_MEDICINE_4,DIALOG_STYLE_MSGBOX,"Item/Statussystem",string,"Ok","");
            return 1;
		}
	    case dialog_TAKE_MEDICINE_4:
		{
		    DisplayInfobox(playerid,"Item konsumieren","Oeffne mit /item den Rucksack und~n~konsumiere die Medizin.");
		    return 1;
		}
	    case dialog_TUTORIAL_ENTERKELLER:
		{//Checkpoint zum kellereingang setzen
		    PlayerEvent[playerid][TutorialStep][1] = 1;
	        SetPlayerMissionCP(playerid,671.8541,-2356.3027,15.8544);
	        quest::OnQuestUpdate(playerid,0,1);
		    return 1;
		}
	    case dialog_ACTION_VOMIT:
		{
			mysql_SetIntByInt("pnwl_user_event","tutorial",4,"userid",PlayerInfo[playerid][PLAYER_ID]);
			PlayerEvent[playerid][TutorialStep][0] = 4;
		    PlayerEvent[playerid][TutorialStep][1] = 1;
			DisplayInfobox(playerid,"Hinweis","Oeffne mit /funk das Interface des~n~Funkgeraetes um Informationen zu erhalten",0);
			ApplyAnimation(playerid,"FOOD","EAT_Vomit_P",3.0,0,0,0,0,0);
			return 1;
		}
	    case dialog_TUTORIAL_BEVOR_PLANE:
		{
		    w_SetPlayerPos(playerid,54.1131,1052.6071,7016.2017,_,3);
		    SetPlayerInterior(playerid,3);
			SetCameraBehindPlayer(playerid);
	        PlayerEvent[playerid][TutorialStep][0] = 1;
	        PlayerEvent[playerid][TutorialStep][1] = 1;
		    fixed_TextDrawHideForPlayer(playerid,Filmstreifen[0]);
		    fixed_TextDrawHideForPlayer(playerid,Filmstreifen[1]);
			return 1;
		}
	    case dialog_TUTORIAL_MT_CHOOSE:
		{
		    SetPlayerMissionCP(playerid,-815.6710,2319.8547,145.7675);
		    ShowPlayerDialog(playerid,dialog_NULL,DIALOG_STYLE_MSGBOX,"Du hast geantwortet...","{C87E35}Unbekannter:\n{F1F7DC}\"Ah ich dachte schon es wuerde sich nie jemand melden...\nIch wohne hier unten in meiner Huette auf einer Insel. Komm\neinfach an den Bergrand, dann muesstest du es schon sehen...\"\n\n\n{878375}Hinweis: Die Checkpoints auf deinem HUD weisen dir die Richtung...","Weiter","");
	        PlayerEvent[playerid][TutorialStep][0] = 3;
	        PlayerEvent[playerid][TutorialStep][1] = 2;//sry leider id verschoben^^
	        SetPlayerVirtualWorld(playerid,(playerid+2000));
		}
	    case dialog_TUTORIAL_WAKE_FIRST:
		{
		    format(string,sizeof(string),"{C87E35}John Wake:\n{F1F7DC}\"Nunja, ich bin leider schwer erkrankt und brauche diese Medizin. Er ist schon\nseit mehreren Tagen nicht aufgetaucht, ich mache mir echt Sorgen - um meine Gesundheit.");
			strcat(string,"\nWenn du mir das Paket bringst habe ich eine nette Belohnung fuer dich,\num in Kontakt zu bleiben nimm dieses mobile Funkgerät und den PDA!\"\n\n\n{878375}Hinweis:\n- Gegenstand erhalten: Mobiles Funkgerät\n- PDA");
		    ShowPlayerDialog(playerid,dialog_TUTORIAL_WAKE_SECOND,DIALOG_STYLE_MSGBOX,"Gespräch mit John Wake",string,"Mobiles Funkgerät","");
		    mysql_SetIntByInt("pnwl_user_option","funklevel",1,"userid",PlayerInfo[playerid][PLAYER_ID]);
		    mysql_SetIntByInt("pnwl_user_option","funkfreq",30,"userid",PlayerInfo[playerid][PLAYER_ID]);
		    return 1;
		}
	    case dialog_TUTORIAL_WAKE_SECOND:
		{
			format(string,sizeof(string),"{878375}Du kannst mit dem mobilen Funkgerät mit anderen Personen in\nKontakt treten, Informationen austauschen oder auch Quests annehmen. Um das\nFunkgerät während des Spielverlaufen zu nutzen, benutze den Befehl \"/funk\". Mit #[Text] sendest du eine Nachricht. In dieser Quest\nwirst du von John Wake weitere Informationen fuer den aktuellen Auftrag erhalten.");
		    ShowPlayerDialog(playerid,dialog_TUTORIAL_WAKE_THIRD,DIALOG_STYLE_MSGBOX,"{878375}Hinweis zum mobilen Funkgerät",string,"Zum PDA","");
		    return 1;
		}
	    case dialog_TUTORIAL_WAKE_THIRD:
		{
			format(string,sizeof(string),"{878375}Mit dem PDA kannst du deine Aufgaben ansehen und verwalten. Das Gerät \nbedienst du mit \"/quest\", die Steuerung folgt interaktiv. Im Hauptmenue\nkannst du die Aufgabe auswählen um genauere Informationen zu erhalten.\nDu kannst eine \"Hauptaufgabe\" auswählen, worueber du in Echtzeit Informationen\nueber den Status erhältst.");
		    ShowPlayerDialog(playerid,dialog_TUTORIAL_WAKE_FOURTH,DIALOG_STYLE_MSGBOX,"{878375}Hinweis zum PDA",string,"Zur Mission","");
		    return 1;
		}
	    case dialog_TUTORIAL_WAKE_FOURTH:
		{
		    SetPlayerVirtualWorld(playerid,(2000+playerid));
		    SetPlayerInterior(playerid,0);
		    PlayerEvent[playerid][TutorialStep][1] = 8;
		    w_SetPlayerPos(playerid,-512.2507,2220.9221,42.3575,_,3);
		    SetPlayerMissionCP(playerid,-795.9550,2259.2598,59.4689);
		    SetCameraBehindPlayer(playerid);
		   	quest::OnQuestUpdate(playerid,0,8);
		   	return 1;
		}
	    case dialog_TUTORIAL_SETVORNAME:
		{
		    if(CheckRealName(inputtext,1) == 1)
		    {
		        SetPVarString(playerid,"tut_vorname",inputtext);
		        format(PlayerInfo[playerid][Vorname],MAX_VORNAME_LEN,inputtext);
		        format(string,sizeof(string),"{F1F7DC}Ok, %s. Jetzt zu deinem Nachnamen.\n\n{C85135}Achtung:\n- 3 bis 15 Zeichen\n- Keine Zahlen\n- Anfang des Namen groß\n- Keine großen Zeichen IM Namen\n- Mehrere Nachnamen erlaubt",inputtext);
				ShowPlayerDialog(playerid,dialog_TUTORIAL_SETNACHNAME,DIALOG_STYLE_INPUT,"{F1F7DC}NACHNAME",string,"Weiter","");
		    }
		    else
		    {
		        ShowPlayerDialog(playerid,dialog_TUTORIAL_SETVORNAME,DIALOG_STYLE_INPUT,"{F1F7DC}Vorname","{F1F7DC}Bitte gebe den VORNAMEN deines InGame Charakters ein.\n\n{C85135}Achtung:\n- 3 bis 15 Zeichen\n- Keine Zahlen\n- Anfang des Namen groß\n- Keine großen Zeichen IM Namen\n- Mehrere Vornamen erlaubt","Weiter","");
		    }
		    return 1;
		}
	    case dialog_TUTORIAL_SETNACHNAME:
		{
		    if(CheckRealName(inputtext,2) == 1)
		    {
		        SetPVarString(playerid,"tut_nachname",inputtext);
		        format(PlayerInfo[playerid][Nachname],MAX_NACHNAME_LEN,inputtext);
				ShowPlayerDialog(playerid,dialog_TUTORIAL_SETGESCHLECHT,DIALOG_STYLE_LIST,"{F1F7DC}Geschlecht","{F1F7DC}--> Männlich\n--> Weiblich","Weiter","");
		    }
		    else
		    {
		        GetPVarString(playerid,"tut_vorname",query,sizeof(query));
		        format(string,sizeof(string),"{F1F7DC}Ok, %s. Jetzt zu deinem Nachnamen.\n\n{C85135}Achtung:\n- 3 bis 15 Zeichen\n- Keine Zahlen\n- Anfang des Namen groß\n- Keine großen Zeichen IM Namen\n- Mehrere Nachnamen erlaubt",query);
				ShowPlayerDialog(playerid,dialog_TUTORIAL_SETNACHNAME,DIALOG_STYLE_INPUT,"NACHNAME",string,"Weiter","");
			}
		    return 1;
		}
	    case dialog_TUTORIAL_SETGESCHLECHT:
		{
		    format(string,sizeof(string),"{F1F7DC}Alles klar, hier nochmals alles auf einen Blick:\n\nGeschlecht:");
			switch(listitem)
			{
			    case 0://Maennlich
			    {
			        PlayerInfo[playerid][Geschlecht] = 0;
			        strcat(string," Männlich");
			    }
				case 1://Weiblich
				{
				    PlayerInfo[playerid][Geschlecht] = 1;
				    strcat(string," Weiblich");
				}
			}
			GetPVarString(playerid,"tut_vorname",query,sizeof(query));
			format(string,sizeof(string),"%s\nVorname: %s",string,query);
			GetPVarString(playerid,"tut_nachname",query,sizeof(query));
			format(string,sizeof(string),"%s\nNachname: %s",string,query);
			ShowPlayerDialog(playerid,dialog_TUTORIAL_CHECKINFO,DIALOG_STYLE_MSGBOX,"{F1F7DC}Informationen",string,"Weiter","Fehler!");
			return 1;
		}
		case dialog_TUT_ENDE_BOX:
		{
			format(string,sizeof(string),"{F1F7DC}Falls du noch Fragen zum Spielverlauf, Server oder anderen Dingen hast\n\
			kannst du dich per /support oder /report gerne an das kompetente Team wenden.\n\
			Wir wuenschen dir auf unserem Server viel Spaß und Erfolg.\n\
			Das PNWL Team\n");
			strcat(string,"\n\
			PS: Falls du nicht weißt was du machen sollst, wir empfehlen dir die Stadt \"Fort Carson\",\n\
			genauer gesagt die Stadthalle zu besuchen. Es ist auf der Map mit einem Icon markiert\n\
			und ein Checkpoint wurde gesetzt ;)");
			//strcat(string,"\n\n\nDu hast nun die Möglichkeit ein paar größere Städte anzugucken. Möchtest\ndu dies tun? (gibt 10 Bonuskronkorken)");
			ShowPlayerDialog(playerid,dialog_NULL/*TUT_ENDE*/,DIALOG_STYLE_MSGBOX,"{F1F7DC}Tutorial beendet",string,"Weiter","");
			return 1;
		}
		case dialog_TUT_ENDE:
		{
		    if(!response) return 1;
		   	SetPVarInt(playerid,"tut_finish",1);
			SetPVarInt(playerid,"tut_finish_step",0);
			OnPlayerFinishCameraMovement(playerid);
		    return 1;
		}
	    case dialog_TUTORIAL_CHECKINFO:
		{
			if(!response) return ShowPlayerDialog(playerid,dialog_TUTORIAL_SETVORNAME,DIALOG_STYLE_INPUT,"{F1F7DC}Charaktername","{F1F7DC}Bitte gebe den VORNAMEN deines InGame Charakters ein.\n\n{C85135}Achtung:\n- 3 bis 15 Zeichen\n- Keine Zahlen\n- Anfang des Namen groß\n- Keine großen Zeichen IM Namen\n- Mehrere Vornamen erlaubt","Weiter","");

	        GetPVarString(playerid,"tut_vorname",query,sizeof(query));
	        SetPVarString(playerid,"vorname",query);
	        GetPVarString(playerid,"tut_nachname",query,sizeof(query));
	        SetPVarString(playerid,"nachname",query);

			DeletePVar(playerid,"tut_vorname");
			DeletePVar(playerid,"tut_nachname");

			format(string,sizeof(string),"SELECT COUNT(*) FROM pnwl_user WHERE vorname='%s' AND nachname='%s' AND userid!='%d'",PlayerInfo[playerid][Vorname],PlayerInfo[playerid][Nachname],PlayerInfo[playerid][PLAYER_ID]);
			if(mysql_GetResultAsInt(string) > 0)
			{
			    ShowPlayerDialog(playerid,dialog_TUTORIAL_SETVORNAME,DIALOG_STYLE_INPUT,"Charaktername","{C85135}Achtung:\nDieser Name wird zur Zeit schon benutzt. Wähle bitte einen anderen Namen.\n\n{F1F7DC}Bitte gebe den VORNAMEN deines InGame Charakters ein.\n\n{C85135}Achtung:\n- 3 bis 15 Zeichen\n- Keine Zahlen\n- Anfang des Namen groß\n- Keine großen Zeichen IM Namen\n- Mehrere Vornamen erlaubt","Weiter","");
			    mysql_free_result();
			    return 1;
			}
			mysql_free_result();
			
	        format(string,sizeof(string),"UPDATE pnwl_user SET vorname='%s', nachname='%s' WHERE userid='%d'",PlayerInfo[playerid][Vorname],PlayerInfo[playerid][Nachname],PlayerInfo[playerid][PLAYER_ID]);
	        mysql_query_once(string);
	        
			start_tutorial(playerid);
	        return 1;
		}
	    case dialog_MAIN_LOGIN:
		{
		    if(!response)
		    {
		        ShowPlayerDialog(playerid,dialog_MAIN_LOGIN_LEAVE,DIALOG_STYLE_MSGBOX,"{C87E35}Login","{C87E35}Möchtest du den Server verlassen?","Ja","Nein");
		        return 1;
		    }
		    if(inputtext[0]) return OnPlayerLogin(playerid,inputtext);
		    format(string,sizeof(string),"{C87E35}Willkommen, %s.\n{F1F7DC}Bitte gebe dein Passwort ein:\n\n\n{878375}Hinweis: Verwende das selbe Passwort wie im Forum",GetName(playerid));
			ShowPlayerDialog(playerid,dialog_MAIN_LOGIN,DIALOG_STYLE_PASSWORD,"{C87E35}Login",string,"Login","Verlassen");
		}
		case dialog_MAIN_LOGIN_LEAVE:
		{
			if(response)
			{
			    ShowPlayerDialog(playerid,dialog_MAIN_LOGIN,DIALOG_STYLE_MSGBOX,"{C87E35}Login","{C87E35}Du hast den Server verlassen. Dennoch würden wir\nuns über einen erneuten Besuch von dir sehr freuen ;)","Verlassen","");
			    Kick(playerid);
			    return 1;
			}
		    format(string,sizeof(string),"{C87E35}Willkommen, %s.\n{F1F7DC}Bitte gebe dein Passwort ein:\n\n\n{878375}Hinweis: Verwende das selbe Passwort wie im Forum",GetName(playerid));
			ShowPlayerDialog(playerid,dialog_MAIN_LOGIN,DIALOG_STYLE_PASSWORD,"{C87E35}Login",string,"Login","Verlassen");
			return 1;
		}
	    case dialog_MAIN_SELECT_SPAWN:
		{
		    return 1;
		}
	}
	return 1;
}

OnPlayerRegister(playerid)
{
	SendClientMessage(playerid,-1,#FORMAT_CHAT_INFO"Spielerdaten werden angelegt...");
	new timestamp	= gettime(_,_,_);
	format(string,sizeof(string),"INSERT INTO pnwl_user (userid,username,ip,gpci,timestamp,gang) VALUES ('%d','%s','%s','%s','%d','-1')",PlayerInfo[playerid][PLAYER_ID],GetName(playerid),GetIP(playerid),GetGPCI(playerid),timestamp);
	mysql_query_once(string);
	format(string,sizeof(string),"INSERT INTO pnwl_user_option (userid,HouseSelect,fightingstyle) VALUES ('%d','-1','4')",PlayerInfo[playerid][PLAYER_ID]);
	mysql_query_once(string);
	format(string,sizeof(string),"INSERT INTO pnwl_user_event (userid,tutorial,lastlogin) VALUES ('%d','0','%d')",PlayerInfo[playerid][PLAYER_ID],gettime(_,_,_));
	mysql_query_once(string);
	format(string,sizeof(string),"INSERT INTO pnwl_user_premium (userid) VALUES ('%d')",PlayerInfo[playerid][PLAYER_ID]);
	mysql_query_once(string);
	format(string,sizeof(string),"INSERT INTO pnwl_user_status (userid) VALUES ('%d')",PlayerInfo[playerid][PLAYER_ID]);
	mysql_query_once(string);
	format(string,sizeof(string),"INSERT INTO pnwl_user_skill (userid,aktivfreiraum,passivfreiraum) VALUES ('%d','100.0','100.0')",PlayerInfo[playerid][PLAYER_ID]);
	mysql_query_once(string);
	format(string,sizeof(string),"INSERT INTO pnwl_user_pos (userid,tot_house,crash_house,log_house) VALUES ('%d','-1','-1','-1')",PlayerInfo[playerid][PLAYER_ID]);
	mysql_query_once(string);
	format(string,sizeof(string),"INSERT INTO pnwl_user_resource (userid) VALUES ('%d')",PlayerInfo[playerid][PLAYER_ID]);
	mysql_query_once(string);
	format(string,sizeof(string),"INSERT INTO pnwl_user_equipment (userid) VALUES ('%d')",PlayerInfo[playerid][PLAYER_ID]);
	mysql_query_once(string);
	format(string,sizeof(string),"INSERT INTO pnwl_user_wt_online (userid) VALUES ('%d')",PlayerInfo[playerid][PLAYER_ID]);
	mysql_query_once(string);
	format(string,sizeof(string),"INSERT INTO pnwl_user_mon_online (userid) VALUES ('%d')",PlayerInfo[playerid][PLAYER_ID]);
	mysql_query_once(string);
	format(string,sizeof(string),"INSERT INTO pnwl_user_time_online (userid) VALUES ('%d')",PlayerInfo[playerid][PLAYER_ID]);
	mysql_query_once(string);
	format(string,sizeof(string),"INSERT INTO pnwl_user_weapon_stats (userid) VALUES ('%d')",PlayerInfo[playerid][PLAYER_ID]);
	mysql_query_once(string);
	format(string,sizeof(string),"INSERT INTO pnwl_user_weapon_skill (userid) VALUES ('%d')",PlayerInfo[playerid][PLAYER_ID]);
	mysql_query_once(string);
    format(string,sizeof(string),"INSERT INTO pnwl_user_npc (userid) VALUES ('%d')",PlayerInfo[playerid][PLAYER_ID]);
    mysql_query_once(string);
	PlayerEvent[playerid][TutorialStep][0] = 0;
	OnPlayerSpawn(playerid);
	return 1;
}

OnPlayerLogin(playerid,passwort[]="",alogin=0)
{
	new bool:r_pw = false;
	if(alogin == 1)
	{
	    SendClientMessage(playerid,GRUEN,"\t\t! Automatischer Login !");
		r_pw = true;
	}
	else
	{
		if(passwort[0])
		{
			if(_WBB_CheckPassword(PlayerInfo[playerid][PLAYER_ID],passwort) == 1)
			{
				r_pw = true;
			}
		}
	}
	
	new count_rows,timestamp=gettime(_,_,_);
	format(string,sizeof(string),"INSERT INTO pnwl_user_logins (userid,ip,gpci,timestamp,success,alogin) VALUES ('%d','%s','%s','%d','%d','%d')",PlayerInfo[playerid][PLAYER_ID],GetIP(playerid),GetGPCI(playerid),timestamp,r_pw?1:0,PlayerOption[playerid][OptionC]&optCAlogin?0:1);
	mysql_query_once(string);
	format(string,sizeof(string),"");

	if(r_pw == true)//Richtiges Passwort
	{
	    SetPlayerScore(playerid,PlayerInfo[playerid][PLAYER_ID]);

		format(query,sizeof(query),"SELECT * FROM pnwl_user_event WHERE userid='%d'",PlayerInfo[playerid][PLAYER_ID]);
		mysql_query(query);
		mysql_store_result();
		if(mysql_num_rows() <= 0)
		{
		    OnQueryError(-5,"No rows found",0,0,"OnPlayerLogin",query,0);
		    SendClientMessage(playerid,ROT,"ERROR: Schwerwiegender Fehler (TB:usEVE missing). Kontaktiere bitte einen Administrator!");
		    Kick(playerid);
		    mysql_free_result();
		    return 1;
		}
		mysql_retrieve_row();
		mysql_fetch_field_row(string,"training"); 		PlayerEvent[playerid][Training] 		= strval(string);
		mysql_fetch_field_row(string,"payday"); 		PlayerEvent[playerid][PayDayTime] 		= strval(string);
		mysql_fetch_field_row(string,"devcomment"); 	PlayerEvent[playerid][DevComment][0]	= strval(string);
	    mysql_fetch_field_row(string,"counttode");		PlayerEvent[playerid][CountTode]		= strval(string);
        PlayerEvent[playerid][DevComment][1] = 0;
		for(new i; i<MAX_DEVELOPER_PICKUPS; i++)
		{
			if(PlayerEvent[playerid][DevComment][0] & (1<<i))
			{
				PlayerEvent[playerid][DevComment][1]++;
			}
		}
		mysql_fetch_field_row(string,"isttot");
		PlayerEvent[playerid][IstTot] = strval(string);
		
		mysql_fetch_field_row(string,"tutorial");
       	PlayerEvent[playerid][TutorialStep][0] = strval(string);
		PlayerEvent[playerid][TutorialStep][1] = 0;
		mysql_free_result();
	    mysql_SetIntByInt("pnwl_user_event","lastlogin",timestamp,"userid",PlayerInfo[playerid][PLAYER_ID]);
	    //End Event load

		new bool:_sleeping_achiev = false;
		if(PlayerEvent[playerid][TutorialStep][0] == -1)
		{//Normaler Login, ist nicht im Tutorial
		    __STATS[USER_CONNECTIONS]++;
		    PlayerInfo[playerid][ConnectedTimes] = (mysql_GetIntByInt("pnwl_user","connections","userid",PlayerInfo[playerid][PLAYER_ID])+1);
		    if(PlayerInfo[playerid][ConnectedTimes] >= 1)
		    {
		        new time = gettime(_,_,_);
				format(query,sizeof(query), "SELECT max(timestamp) FROM pnwl_user_logins WHERE userid='%d' AND timestamp<%d AND success='1'",PlayerInfo[playerid][PLAYER_ID],(time-20));
				mysql_query(query);
				mysql_store_result();
				mysql_fetch_row(query);
				new last_login = strval(query);
				if(last_login > 0)
				{
		    		if((time-last_login) >= (60*60*24))
					{//War länger als 24 Stunden nicht mehr online
						_sleeping_achiev = true;
					}
		    	}
		    }
		    mysql_SetIntByInt("pnwl_user","connections",PlayerInfo[playerid][ConnectedTimes],"userid",PlayerInfo[playerid][PLAYER_ID]);
		}

        status::CreateDraws(playerid);
        
		/////////////////////////////////////USER////////////////////////////////////////////////////////////////////////////
		format(query,sizeof(query),"SELECT * FROM pnwl_user WHERE userid='%d'",PlayerInfo[playerid][PLAYER_ID]);
		mysql_query(query);
		mysql_store_result();
		count_rows = mysql_num_rows();
		if(count_rows == 1)
		{
		    mysql_retrieve_row();
			mysql_fetch_field_row(string,"geschlecht"); PlayerInfo[playerid][Geschlecht]= strval(string);
			mysql_fetch_field_row(string,"fraktion"); 	PlayerInfo[playerid][Fraktion]	= strval(string);
			mysql_fetch_field_row(string,"gang"); 		PlayerInfo[playerid][pGang]		= strval(string);
			mysql_fetch_field_row(string,"grang"); 		PlayerInfo[playerid][pGangRang]	= strval(string);
			mysql_fetch_field_row(string,"job"); 		PlayerInfo[playerid][Job]		= strval(string);
			mysql_fetch_field_row(string,"spielzeit");	PlayerInfo[playerid][Spielzeit]	= strval(string);
			if(PlayerInfo[playerid][pGang] != -1)       SetPlayerTeam(playerid,PlayerInfo[playerid][pGang]);
			mysql_fetch_field_row(PlayerInfo[playerid][Vorname],"vorname");
			mysql_fetch_field_row(PlayerInfo[playerid][Nachname],"nachname");
			mysql_free_result();
			mysql_SetIntByInt("wcf0_user_option_value","userOption80",PlayerInfo[playerid][Spielzeit],"userid",PlayerInfo[playerid][PLAYER_ID]);//Spielzeit
			if(PlayerInfo[playerid][pGang] != -1) gang::OnPlayerConnect(playerid);
		}
		else
		{
		    SendClientMessage(playerid,ROT,"ERROR: Schwerwiegender Fehler (mainstack[us] missing). Kontaktiere bitte einen Administrator!");
		    Kick(playerid);
            mysql_free_result();
            return 1;
		}
        switch(PlayerInfo[playerid][Fraktion])
		{
			case 0: 	format(string,sizeof(string),"Zivilist");
			case 1: 	format(string,sizeof(string),"Armee");
			case 2:		format(string,sizeof(string),"Infizierte");
			default:	format(string,sizeof(string),"Unbekannt");
		}
		format(string,sizeof(string),#FORMAT_CHAT_INFO"Du bist in der Fraktion \"%s\"",string);
		SendClientMessage(playerid,GRUEN,string);
		if(PlayerInfo[playerid][Fraktion] < 0 || PlayerInfo[playerid][Fraktion] > 2) PlayerInfo[playerid][Fraktion] = 0;

		if(PlayerInfo[playerid][Job] >= 1) job_OnPlayerJobInit(playerid);

		///////////////////////////////////////Resourcen der Spieler//////////////////////////////////////////////////////////
		format(query,sizeof(query),"SELECT * FROM pnwl_user_resource WHERE userid='%d'",PlayerInfo[playerid][PLAYER_ID]);
		mysql_query(query);
		mysql_store_result();
		count_rows = mysql_num_rows();
		if(count_rows >= 1)
		{
		    mysql_retrieve_row();
			mysql_fetch_field_row(string,"batterien"); 	PlayerResource[playerid][Batterien] 	= floatstr(string);
			mysql_fetch_field_row(string,"wasser"); 	PlayerResource[playerid][Wasser] 		= floatstr(string);
			mysql_fetch_field_row(string,"benzin"); 	PlayerResource[playerid][Benzin] 		= floatstr(string);
		}
		else
		{
		    format(query,sizeof(query),"INSERT INTO pnwl_user_resource (userid) VALUES ('%d')",PlayerInfo[playerid][PLAYER_ID]);
		    mysql_query_once(query);
		}
		mysql_free_result();
		
        ///////////////////////////////////////Equipment der Spieler//////////////////////////////////////////////////////////
		format(query,sizeof(query),"SELECT * FROM pnwl_user_equipment WHERE userid='%d'",PlayerInfo[playerid][PLAYER_ID]);
		mysql_query(query);
		mysql_store_result();
		count_rows = mysql_num_rows();
		if(count_rows >= 1)
		{
		    mysql_retrieve_row();
		    mysql_fetch_field_row(string,"backpack"); 		PlayerEquipment[playerid][Rucksack] 		= strval(string);
			mysql_fetch_field_row(string,"bought_skins1"); 	PlayerEquipment[playerid][bought_Skins][0]	= strval(string);
			mysql_fetch_field_row(string,"bought_skins2"); 	PlayerEquipment[playerid][bought_Skins][1]	= strval(string);
			mysql_fetch_field_row(string,"unlocked_skins");	PlayerEquipment[playerid][unlocked_Skins]	= strval(string);
			mysql_free_result();
		}
		else
		{
		    mysql_free_result();
		    format(query,sizeof(query),"INSERT INTO pnwl_user_equipment (userid) VALUES ('%d')",PlayerInfo[playerid][PLAYER_ID]);
		    mysql_query_once(query);
		}
		/////////////////////////////////////OPTION////////////////////////////////////////////////////////////////////////////
		format(query,sizeof(query),"SELECT * FROM pnwl_user_option WHERE userid='%d'",PlayerInfo[playerid][PLAYER_ID]);
		mysql_query(query);
		mysql_store_result();
		count_rows = mysql_num_rows();
		if(count_rows >= 1)
		{
		    mysql_retrieve_row();
			mysql_fetch_field_row(string,"skin"); 			PlayerOption[playerid][Skin]			= strval(string);
			mysql_fetch_field_row(string,"houseselect"); 	PlayerOption[playerid][HouseSelect]		= strval(string);
			mysql_fetch_field_row(string,"selectedspawn"); 	PlayerOption[playerid][SelectedSpawn]	= strval(string);
			mysql_fetch_field_row(string,"crashed"); 		PlayerOption[playerid][Crashed]			= strval(string);
			mysql_fetch_field_row(string,"optionc");		PlayerOption[playerid][OptionC]			= strval(string);
			mysql_fetch_field_row(string,"funklevel"); 		PlayerOption[playerid][pFunkgeraet][0]	= strval(string);
			mysql_fetch_field_row(string,"funkfreq"); 		PlayerOption[playerid][pFunkgeraet][1]	= strval(string);
			mysql_fetch_field_row(string,"funkopt"); 		PlayerOption[playerid][pFunkgeraet][2]	= strval(string);
			mysql_fetch_field_row(string,"fightingstyle");	PlayerOption[playerid][FightingStyle]	= strval(string);
			if(!PlayerOption[playerid][FightingStyle]) PlayerOption[playerid][FightingStyle] = 4;
			SetPlayerFightingStyle(playerid,PlayerOption[playerid][FightingStyle]);
			mysql_fetch_field_row(PlayerOption[playerid][GChat],"gchat");
			mysql_fetch_field_row(string,"gchatlen");       PlayerOption[playerid][GChat][3]		= strval(string);
			mysql_free_result();
		}
		else
		{
		    mysql_free_result();
		    format(query,sizeof(query),"INSERT INTO pnwl_user_option (userid,houseselect) VALUES ('%d','-1')",PlayerInfo[playerid][PLAYER_ID]);
		    mysql_query_once(query);
		    PlayerOption[playerid][pFunkgeraet][0] 	= 1;
		    PlayerOption[playerid][pFunkgeraet][1] 	= 30;
		    PlayerOption[playerid][Skin]           	= DEFAULT_SKIN;
		    PlayerOption[playerid][HouseSelect]     = -1;
		}
	    ////////////////////////////////////POS////////////////////////////////////////////////////////////////////////////
		if(PlayerOption[playerid][Crashed] == 1)			PlayerOption[playerid][SelectedSpawn] = 4;
		else if(PlayerOption[playerid][SelectedSpawn] == 4) PlayerOption[playerid][SelectedSpawn] = 0;

		if(PlayerEvent[playerid][IstTot] >= 1)
		{
		    SetPlayerWeather(playerid,133);
		    SetPlayerTime(playerid,6,0);

			format(query,sizeof(query),"SELECT * FROM pnwl_user_pos WHERE userid='%d'",PlayerInfo[playerid][PLAYER_ID]);
			mysql_query(query);
			mysql_store_result();
			count_rows = mysql_num_rows();
			if(count_rows >= 1)
			{
			    mysql_retrieve_row();

                mysql_fetch_field_row(string,"totpos1"); PlayerInfo[playerid][TotPos][0] = floatstr(string);
                mysql_fetch_field_row(string,"totpos2"); PlayerInfo[playerid][TotPos][1] = floatstr(string);
                mysql_fetch_field_row(string,"totpos3"); PlayerInfo[playerid][TotPos][2] = floatstr(string);

                mysql_fetch_field_row(string,"revivepos1"); PlayerInfo[playerid][RevivePos][0] = floatstr(string);
                mysql_fetch_field_row(string,"revivepos2"); PlayerInfo[playerid][RevivePos][1] = floatstr(string);
                mysql_fetch_field_row(string,"revivepos3"); PlayerInfo[playerid][RevivePos][2] = floatstr(string);

                mysql_fetch_field_row(string,"reviveint"); 		PlayerInfo[playerid][ReviveINT] 	= strval(string);
                mysql_fetch_field_row(string,"revivevw"); 		PlayerInfo[playerid][ReviveVW] 		= strval(string);
                mysql_fetch_field_row(string,"revive_house"); 	PlayerInfo[playerid][ReviveHouse] 	= strval(string);
                mysql_free_result();
			}
			else
			{
			    mysql_free_result();
				format(query,sizeof(query),"INSERT INTO pnwl_user_pos (userid) VALUES ('%d')",PlayerInfo[playerid][PLAYER_ID]);
				mysql_query_once(query);
			    PlayerEvent[playerid][IstTot]	= 0;
			    if(PlayerOption[playerid][SelectedSpawn] == 5) PlayerOption[playerid][SelectedSpawn] = 0;
				PlayerInfo[playerid][TotPos][0] = 0.0;
				PlayerInfo[playerid][TotPos][1] = 0.0;
				PlayerInfo[playerid][TotPos][2] = 0.0;
			}
		}
		else
		{
		    if(PlayerOption[playerid][SelectedSpawn] == 5) PlayerOption[playerid][SelectedSpawn] = 0;
		    PlayerInfo[playerid][TotPos][0] = 0.0;
		    PlayerInfo[playerid][TotPos][1] = 0.0;
		    PlayerInfo[playerid][TotPos][2] = 0.0;
		    if(_sleeping_achiev == true)
		    {
		        if(mysql_GetIntByInt("pnwl_user_pos","log_house","userid",PlayerInfo[playerid][PLAYER_ID]) != -1 || mysql_GetIntByInt("pnwl_user_pos","logint","userid",PlayerInfo[playerid][PLAYER_ID]) == 15)
		        {
		            new am_id = __amCache[amSchlafmuetze];
	            	if(am_id != -1) achievement::AddPlayerAchievement(playerid,am_id);
		        }
		    }
		}
		
		///////////////////////////////////////STATUS////////////////////////////////////////////////////////////////////////////
		format(query,sizeof(query),"SELECT * FROM pnwl_user_status WHERE userid='%d'",PlayerInfo[playerid][PLAYER_ID]);
		mysql_query(query);
		mysql_store_result();
		count_rows = mysql_num_rows();
		if(count_rows >= 1)
		{
		    mysql_retrieve_row();
			mysql_fetch_field_row(string,"hunger"); 			PlayerStatus[playerid][Hunger] 			= floatstr(string);
            mysql_fetch_field_row(string,"durst");              PlayerStatus[playerid][Durst] 			= floatstr(string);
            mysql_fetch_field_row(string,"krankheitssumme");    PlayerStatus[playerid][KrankheitsSumme] = floatstr(string);
            mysql_fetch_field_row(string,"radioaktiv");         PlayerStatus[playerid][Radioaktiv] 		= floatstr(string);
            mysql_fetch_field_row(string,"muedigkeit");         PlayerStatus[playerid][Muedigkeit] 		= floatstr(string);
            mysql_free_result();
		}
		else
		{
		    mysql_free_result();
		    format(query,sizeof(query),"INSERT INTO pnwl_user_status (userid) VALUES ('%d')",PlayerInfo[playerid][PLAYER_ID]);
		    mysql_query_once(query);
		}
		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		format(query,sizeof(query),"SELECT * FROM pnwl_user_skill WHERE userid='%d'",PlayerInfo[playerid][PLAYER_ID]);
		mysql_query(query);
		mysql_store_result();
		count_rows = mysql_num_rows();
		if(count_rows >= 1)
		{
		    mysql_retrieve_row();
		    //Aktive Skills
			mysql_fetch_field_row(string,"handwerk"); 		skill::ChangePlayerSkill(playerid,SkillHandwerk,			floatstr(string),	false,	false);//handwerk
			mysql_fetch_field_row(string,"geschick"); 		skill::ChangePlayerSkill(playerid,SkillGeschick,			floatstr(string),	false,	false);//waffen
			mysql_fetch_field_row(string,"medizin"); 		skill::ChangePlayerSkill(playerid,SkillMedizin,				floatstr(string),	false,	false);//medizin
			mysql_fetch_field_row(string,"wissenschaft"); 	skill::ChangePlayerSkill(playerid,SkillWissenschaft,		floatstr(string),	false,	false);//wissenschaft
			//Passive Skills
			mysql_fetch_field_row(string,"kraft"); 			skill::ChangePlayerSkill(playerid,SkillKraft,				floatstr(string),	false,	false);//kraft
			mysql_fetch_field_row(string,"stoffwechsel"); 	skill::ChangePlayerSkill(playerid,SkillStoffwechsel,		floatstr(string),	false,	false);//stoffwechsel
			mysql_fetch_field_row(string,"glueck"); 		skill::ChangePlayerSkill(playerid,SkillGlueck,				floatstr(string),	false,	false);//glueck
			mysql_fetch_field_row(string,"strahlung"); 		skill::ChangePlayerSkill(playerid,SkillStrahlung,			floatstr(string),	false,	false);//strahlung
			//Sonstige Skills
			//mysql_fetch_field_row(string,"drogen"); 		skill::ChangePlayerSkill(playerid,SkillDrogen,				floatstr(string),	false,	false);//drogen
			mysql_fetch_field_row(string,"karma"); 			skill::ChangePlayerSkill(playerid,SkillKarma,				floatstr(string),	false,	false);//karma
			mysql_free_result();
		}
		else
		{
		    mysql_free_result();
		    format(query,sizeof(query),"INSERT INTO pnwl_user_skill (userid,aktivfreiraum,passivfreiraum) VALUES ('%d','100','100')",PlayerInfo[playerid][PLAYER_ID]);
		    mysql_query_once(query);
		}
		
		for(new i; i<11; i++) SetPlayerSkillLevel(playerid,i,0);
		format(query,sizeof(query),"SELECT * FROM pnwl_user_weapon_skill WHERE userid='%d'",PlayerInfo[playerid][PLAYER_ID]);
		mysql_query(query);
		mysql_store_result();
		count_rows = mysql_num_rows();
		if(count_rows >= 1)
		{
		    mysql_retrieve_row();
			mysql_fetch_field_row(string,"WEAPONSKILL_PISTOL");				SetPlayerSkillLevel(playerid,WEAPONSKILL_PISTOL,			strval(string));	SetPVarInt(playerid,"WEAPONSKILL_PISTOL",			strval(string));//ID 22
			mysql_fetch_field_row(string,"WEAPONSKILL_PISTOL_SILENCED");	SetPlayerSkillLevel(playerid,WEAPONSKILL_PISTOL_SILENCED,	strval(string));	SetPVarInt(playerid,"WEAPONSKILL_PISTOL_SILENCED",	strval(string));//ID 23
			mysql_fetch_field_row(string,"WEAPONSKILL_DESERT_EAGLE");		SetPlayerSkillLevel(playerid,WEAPONSKILL_DESERT_EAGLE,		strval(string));	SetPVarInt(playerid,"WEAPONSKILL_DESERT_EAGLE",		strval(string));//ID 24
			mysql_fetch_field_row(string,"WEAPONSKILL_SHOTGUN");			SetPlayerSkillLevel(playerid,WEAPONSKILL_SHOTGUN,			strval(string));	SetPVarInt(playerid,"WEAPONSKILL_SHOTGUN",			strval(string));//ID 25
			mysql_fetch_field_row(string,"WEAPONSKILL_SAWNOFF_SHOTGUN");	SetPlayerSkillLevel(playerid,WEAPONSKILL_SAWNOFF_SHOTGUN,	strval(string));	SetPVarInt(playerid,"WEAPONSKILL_SAWNOFF_SHOTGUN",	strval(string));//ID 26
			mysql_fetch_field_row(string,"WEAPONSKILL_SPAS12_SHOTGUN");		SetPlayerSkillLevel(playerid,WEAPONSKILL_SPAS12_SHOTGUN,	strval(string));	SetPVarInt(playerid,"WEAPONSKILL_SPAS12_SHOTGUN",	strval(string));//ID 27
			mysql_fetch_field_row(string,"WEAPONSKILL_MICRO_UZI");			SetPlayerSkillLevel(playerid,WEAPONSKILL_MICRO_UZI,			strval(string));	SetPVarInt(playerid,"WEAPONSKILL_MICRO_UZI",		strval(string));//ID 28
			mysql_fetch_field_row(string,"WEAPONSKILL_MP5");				SetPlayerSkillLevel(playerid,WEAPONSKILL_MP5,				strval(string));	SetPVarInt(playerid,"WEAPONSKILL_MP5",				strval(string));//ID 29
			mysql_fetch_field_row(string,"WEAPONSKILL_AK47");				SetPlayerSkillLevel(playerid,WEAPONSKILL_AK47,				strval(string));	SetPVarInt(playerid,"WEAPONSKILL_AK47",				strval(string));//ID 30
			mysql_fetch_field_row(string,"WEAPONSKILL_M4");					SetPlayerSkillLevel(playerid,WEAPONSKILL_M4,				strval(string));	SetPVarInt(playerid,"WEAPONSKILL_M4",				strval(string));//ID 31
			mysql_fetch_field_row(string,"WEAPONSKILL_SNIPERRIFLE");		SetPlayerSkillLevel(playerid,WEAPONSKILL_SNIPERRIFLE,		strval(string));	SetPVarInt(playerid,"WEAPONSKILL_SNIPERRIFLE",		strval(string));//ID 34
			mysql_free_result();
		}
		else
		{
		    mysql_free_result();
		    format(query,sizeof(query),"INSERT INTO pnwl_user_weapon_skill (userid) VALUES ('%d')",PlayerInfo[playerid][PLAYER_ID]);
		    mysql_query_once(query);
		}
		
		format(query,sizeof(query),"SELECT * FROM pnwl_user_premium WHERE userid='%d'",PlayerInfo[playerid][PLAYER_ID]);
		mysql_query(query);
		mysql_store_result();
		if(mysql_num_rows() >= 0)
		{
			mysql_retrieve_row();
			mysql_fetch_field_row(string,"PointsBought");	PlayerPremium[playerid][PointsBought]	= strval(string);
			mysql_fetch_field_row(string,"PointsLeft");		PlayerPremium[playerid][PointsLeft] 	= strval(string);
			mysql_fetch_field_row(string,"PointsSpent");	PlayerPremium[playerid][PointsSpent] 	= strval(string);
			mysql_fetch_field_row(string,"ExpTime");		PlayerPremium[playerid][ExpTime] 		= strval(string);
			mysql_fetch_field_row(string,"SkillBoostTime");	PlayerPremium[playerid][SkillBoostTime] = strval(string);
			mysql_fetch_field_row(string,"DoubleSkillTime");PlayerPremium[playerid][DoubleSkillTime]= strval(string);
			mysql_fetch_field_row(string,"GasmaskTime");	PlayerPremium[playerid][GasmaskTime]	= strval(string);
			mysql_fetch_field_row(string,"HelmetTime");		PlayerPremium[playerid][HelmetTime]		= strval(string);
			mysql_fetch_field_row(string,"ArmourTime");		PlayerPremium[playerid][ArmourTime]		= strval(string);
			mysql_fetch_field_row(string,"NightvisionTime");PlayerPremium[playerid][NightvisionTime]= strval(string);
			mysql_free_result();
			
			new time = gettime(_,_,_);
			if(PlayerPremium[playerid][ExpTime] > 0 && PlayerPremium[playerid][ExpTime] <= time)
			{
			    PlayerPremium[playerid][ExpTime] = 0;
			    mysql_SetIntByInt("pnwl_user_premium","ExpTime",0,"userid",PlayerInfo[playerid][PLAYER_ID]);
			    SendClientMessage(playerid,GOLD,"--> PREMIUM: Dein ExpBoost ist abgelaufen");
			}
			if(PlayerPremium[playerid][SkillBoostTime] > 0 && PlayerPremium[playerid][SkillBoostTime] <= time)
			{
			    PlayerPremium[playerid][SkillBoostTime] = 0;
			    mysql_SetIntByInt("pnwl_user_premium","SkillBoostTime",0,"userid",PlayerInfo[playerid][PLAYER_ID]);
			    SendClientMessage(playerid,GOLD,"--> PREMIUM: Dein SkillBoost ist abgelaufen");
			}
			if(PlayerPremium[playerid][DoubleSkillTime] > 0 && PlayerPremium[playerid][DoubleSkillTime] <= time)
			{
			    PlayerPremium[playerid][DoubleSkillTime] = 0;
			    mysql_SetIntByInt("pnwl_user_premium","DoubleSkillTime",0,"userid",PlayerInfo[playerid][PLAYER_ID]);
			    SendClientMessage(playerid,GOLD,"--> PREMIUM: Dein SkillBoost ist abgelaufen");
			}
			if(PlayerPremium[playerid][GasmaskTime] > 0 && PlayerPremium[playerid][GasmaskTime] <= time)
			{
			    PlayerPremium[playerid][GasmaskTime] = 0;
			    mysql_SetIntByInt("pnwl_user_premium","GasmaskTime",0,"userid",PlayerInfo[playerid][PLAYER_ID]);
			    SendClientMessage(playerid,GOLD,"--> PREMIUM: Deine Gasmaske ist abgelaufen");
			}
			if(PlayerPremium[playerid][HelmetTime] > 0 && PlayerPremium[playerid][HelmetTime] <= time)
			{
			    PlayerPremium[playerid][GasmaskTime] = 0;
			    mysql_SetIntByInt("pnwl_user_premium","HelmetTime",0,"userid",PlayerInfo[playerid][PLAYER_ID]);
			    SendClientMessage(playerid,GOLD,"--> PREMIUM: Dein Schutzhelm ist abgelaufen");
			}
			if(PlayerPremium[playerid][ArmourTime] > 0 && PlayerPremium[playerid][ArmourTime] <= time)
			{
			    PlayerPremium[playerid][ArmourTime] = 0;
			    mysql_SetIntByInt("pnwl_user_premium","ArmourTime",0,"userid",PlayerInfo[playerid][PLAYER_ID]);
			    SendClientMessage(playerid,GOLD,"--> PREMIUM: Dein Schutzweste ist abgelaufen");
			}
			if(PlayerPremium[playerid][NightvisionTime] > 0 && PlayerPremium[playerid][NightvisionTime] <= time)
			{
			    PlayerPremium[playerid][NightvisionTime] = 0;
			    mysql_SetIntByInt("pnwl_user_premium","NightvisionTime",0,"userid",PlayerInfo[playerid][PLAYER_ID]);
			    SendClientMessage(playerid,GOLD,"--> PREMIUM: Dein Nachtsichtgerät ist abgelaufen");
			}
		}
		else
		{
		    mysql_free_result();
		    format(query,sizeof(query),"INSERT INTO pnwl_user_premium (userid) VALUES ('%d')",PlayerInfo[playerid][PLAYER_ID]);
		    mysql_query_once(query);
		}
		if(PlayerPremium[playerid][PointsBought] > 0) PlayerPremium[playerid][PremiumLevel] = mysql_GetIntByInt("wcf0_user_option_value","userOption84","userid",PlayerInfo[playerid][PLAYER_ID]);
		
		if(PlayerPremium[playerid][PointsLeft])
		{
		    format(string,sizeof(string),#FORMAT_CHAT_INFO"Du hast noch %d Kronkorken, die du mit /premium benutzen kannst.",PlayerPremium[playerid][PointsLeft]);
		    SendClientMessage(playerid,GRUEN,string);
		}
		mysql_free_result();
		
		SetPlayerSkin(playerid,PlayerOption[playerid][Skin]);

		item::ResetPlayerItems(playerid,false);//Items zurücksetzen
		item::OnPlayerItemLibInit(playerid);//Items laden
  		item::store_OnPlayerInit(playerid);//Gelagerte Items cachen
		achievement::LoadPlayerAchievements(playerid);//Achievements laden
		perm::LoadPlayerAdminPermissions(playerid,true);//Admin Berechtigungen laden
		npc::LoadPlayer(playerid);//Cash und NPC beziehungen laden
		quest::LoadPlayerQuests(playerid);//Quests laden
		mysql_SetIntByInt("pnwl_user","lastlogin",timestamp,"userid",PlayerInfo[playerid][PLAYER_ID]);
		if(PlayerQuestCache[playerid][qAktiv] != 0)
		{//Aktuelle quest anzeigen
			format(string,sizeof(string),#FORMAT_CHAT_INFO"Aktuelle Quest: \"%s\"",QuestInfo[PlayerQuestCache[playerid][qAktiv]][qName]);
			SendClientMessage(playerid,GRUEN,string);
		}
		/////////////////////////////////////
		new hour,minute;
		gettime(hour,minute);
	    format(string,sizeof(string),#FORMAT_CHAT_INFO"[USER] %s hat den Server betreten (%d:%02d Uhr).",PlayerInfo[playerid][pName],hour,minute);
	    SendClientMessageToAll(GRUEN,string);

	    PlayerEvent[playerid][LOGGED_IN] = true;
	    fixed_TextDrawHideForPlayer(playerid,ScreenHide);
		OnPlayerSpawn(playerid);
		return 1;
	}
	else
	{
	    SetPVarInt(playerid,"WrongPW",GetPVarInt(playerid,"WrongPW")+1);
	    if(GetPVarInt(playerid,"WrongPW") > MAX_WRONG_PWS)
	    {
	   		format(string,sizeof(string),"{F1F7DC}Du hast das Passwort \n{FF6347}%d mal\n{F1F7DC}falsch eingegeben. Deine IP-Adresse wird {FF6347}%d {F1F7DC}Minuten\nlang gesperrt. Vielen Dank für dein Verständnis",GetPVarInt(playerid,"WrongPW"),WRONG_PW_BAN_TIME);
	  	 	ShowPlayerDialog(playerid,dialog_MAIN_LOGIN,DIALOG_STYLE_MSGBOX,"Login",string,"-","");
			Kick(playerid);
	        return 0;
	    }
	    format(string,sizeof(string),"{F1F7DC}Du hast das Passwort bereits\n\"{FF6347}%d mal\"\n{F1F7DC}falsch eingegeben. Bitte gebe das richtige\nPasswort unten ein:",GetPVarInt(playerid,"WrongPW"));
	    ShowPlayerDialog(playerid,dialog_MAIN_LOGIN,DIALOG_STYLE_PASSWORD,"Login",string,"Login","Verlassen");
	    return 0;
	}
}

public OnPlayerDisconnect(playerid, reason)
{
	if(playerid < 0) return 1;
	if(IsPlayerFCNPC(playerid)) return 1;
	__SERVER[CONNECTED_PLAYERS]--;
	if(playerid >= (__SERVER[HIGHEST_PLAYER_ID]-1))
	{
	    for(new i=playerid; i>1; i--)
	    {
	        if(IsPlayerConnected(i) && i != playerid && !IsPlayerNPC(playerid))
	        {
	            __SERVER[HIGHEST_PLAYER_ID] = (i+1);
	            break;
	        }
	        __SERVER[HIGHEST_PLAYER_ID] = 1;
	    }
	}
	
	new hour,minute,timestamp = gettime(hour,minute);
	if(IsPlayerNPC(playerid))
	{
	    printf("[NPC] %s hat den Server verlassen",GetName(playerid));
	    format(string,sizeof(string),#FORMAT_CHAT_INFO"[NPC] %s hat den Server verlassen (%d:%02d Uhr).",PlayerInfo[playerid][pName],hour,minute);
	    SendClientMessageToAll(ROT,string);

		new npc_id = npc::IdByName(GetName(playerid));
	    if(npc_list:npc_id == NPC_NONE)
	    {
		}
		else
		{
			Delete3DTextLabel(PlayerInfo[playerid][Nametag]);
	        NpcID[npc_list:npc_id]		= 0;
	        NpcOnline[npc_list:npc_id] 	= 0;
			ConnectNPC(GetName(playerid),"npcidle");
		}
		return 1;
	}

	PlayerTextDrawDestroy(playerid,textdraw_fix_perplayer[playerid]);
	if(WeaponAmmo[playerid] != PlayerText:INVALID_TEXT_DRAW)
	{
	    PlayerTextDrawHide(playerid,WeaponAmmo[playerid]);
		PlayerTextDrawDestroy(playerid,WeaponAmmo[playerid]);
		WeaponAmmo[playerid] = PlayerText:INVALID_TEXT_DRAW;
	}
	ManageAusdauerDraw(playerid,false);
	status::ToggleBloodscreen(playerid,false);
	if(GetPVarInt(playerid,"pev_anrufen") != 0)	CellPhoneFinishCall(playerid);
	if(GetPVarInt(playerid,"pev_train") != 0)	OnSportstudioExit(playerid);
    if(GetPVarInt(playerid,"revivable") == 1)
	{
		DestroyPickup(PlayerInfo[playerid][pTotPickup]);
        Delete3DTextLabel(PlayerInfo[playerid][TotTag]);
	}
	if(PlayerEvent[playerid][TutorialStep][0] == 4 && PlayerEvent[playerid][TutorialStep][1] == 1 && GetPVarInt(playerid,"tut_intera_set") == 1) DestroyPickup(GetPVarInt(playerid,"tut_intera_pick"));//Interaktionssymbol am Tor
	if(PlayerInfo[playerid][pOnMission]) DestroyPlayerObject(playerid,PlayerInfo[playerid][pMissionFlare]);

	cont::PlayerExitContainer(playerid);
	HideInfoMessage(playerid);
	Delete3DTextLabel(PlayerInfo[playerid][Nametag]);
	EndMedicalTreatment(playerid);
	equip::ResetEquipment(playerid);
	
	//Injection for @pnwl_cars->pnwl_EX_autohaus
	if(EX_car[playerid] != -1)
	{
		car::DestroyVehicle(EX_car[playerid]);
		EX_car[playerid] = -1;
	}
	//-Injection

    TextDrawHideForPlayer(playerid,NoDmZoneDraw);
 	TextDrawHideForPlayer(playerid,Filmstreifen[0]);
	TextDrawHideForPlayer(playerid,Filmstreifen[1]);
	achievement::HideInfoDraw(playerid);
	status::DestroyDraws(playerid);

    if(PlayerCamera[playerid][camMoving] == true) KillTimer(PlayerCamera[playerid][camTIMER]);
	PlayerCamera[playerid][camMoving] = false;
	for(new amid; amid<MAX_ACHIEVEMENTS; amid++)
	{
		achievement::PlayerInfo[playerid][amid][am] = false;
		achievement::PlayerInfo[playerid][amid][need] = 0;
	}

	DeletePlayerSpecialObject(playerid,OBJECTS_ALL,OBJECT_TYPE_ALL);
    DeletePlayerSpecial3DText(playerid,TEXT3D_ALL,TEXT3D_TYPE_ALL);

	if(PlayerEvent[playerid][LOGGED_IN])
	{
	    new leave_reason[][] = {
	        {"Timeout"},
	        {"Verlassen"},
	        {"Kicked/Banned"}};
	    format(string,sizeof(string),#FORMAT_CHAT_INFO"[USER] %s hat den Server verlassen (%d:%02d Uhr) [%s]",PlayerInfo[playerid][pName],hour,minute,leave_reason[reason]);
	    SendClientMessageToAll(ROT,string);
		format(string,sizeof(string),"INSERT INTO pnwl_user_logouts (userid,reason,timestamp) VALUES ('%d','%d','%d')",PlayerInfo[playerid][PLAYER_ID],reason,timestamp);
		mysql_query(string);

		if(GlobalVote[voteID] && PlayerOption[playerid][Vote]) GlobalVote[voteResult][PlayerOption[playerid][Vote]]--;//Abstimmung entfernen
	    for(new pid=0; pid<=__SERVER[HIGHEST_PLAYER_ID]; pid++)
	    {
	        if(!IsPlayerConnected(pid) || IsPlayerNPC(pid)) continue;
	    	if(GetPVarInt(pid,"joining_gang") == playerid || GetPVarInt(pid,"invite_joining_gang") == playerid)
			{
				SetPVarInt(pid,"joining_gang",			-1);
				SetPVarInt(pid,"invite_joining_gang",	-1);
			}
	    }
	    
	    //Spielerdaten abspeichern
		PLAYER::SavePlayer(playerid,reason);
		PLAYER::SavePlayerWeapons(playerid);

		if(BoxTime >= 1)
		{
			if(playerid == BoxerID[0] || playerid == BoxerID[1])
			{//Im Kampf verwickelt
				OnEndBoxfight(BoxerID[0]==playerid?BoxerID[1]:BoxerID[0]);
			}
		}
		
	   	format(query,sizeof(query),CACHE_PATH"/user_itemstorage/user_%d.ini",PlayerInfo[playerid][PLAYER_ID]);
		INI::Remove(query);
	}

	PlayerShopDrawHide(playerid);
    if(GetPVarInt(playerid,"EX_autohaus_showing") == 1)
    {
	    HidePlayerDialog(playerid);
	    EX_inuse[GetPVarInt(playerid,"EX_autohaus_nr")] = false;
    }
    
    for(new i; i<MAX_PLAYER_TEXT_DRAWS; i++)
    {
        if(PlayerText:i != PlayerText:INVALID_TEXT_DRAW)
        {
			PlayerTextDrawDestroy(playerid,PlayerText:i);
        }
    }
    
    gang::OnPlayerDisconnect(playerid);
    ResetVars(playerid);
	return 1;
}

public OnPlayerSpawn(playerid)
{
	FCNPC_UnlinkFollowers(playerid);
	status::ToggleBloodscreen(playerid,false);
    if(IsPlayerFCNPC(playerid)) return 1;
	if(IsPlayerNPC(playerid))
	{
	    printf("[BOT]%s spawned",GetName(playerid));
	    new timestamp = gettime(_,_,_);

		new npc_id = npc::IdByName(GetName(playerid));
		if(npc_list:npc_id != NPC_NONE)
		{
			NpcID[npc_list:npc_id]  = playerid;
			NpcOnline[npc_list:npc_id] = timestamp<=0?1:timestamp;
			TogglePlayerControllable(playerid,false);
			SetPlayerInterior(playerid,NPCData[npc_list:npc_id][npc_int]);
			SetPlayerVirtualWorld(playerid,NPCData[npc_list:npc_id][npc_vw]);
			w_SetPlayerPos(playerid,NPCData[npc_list:npc_id][npc_pos][0],NPCData[npc_list:npc_id][npc_pos][1],NPCData[npc_list:npc_id][npc_pos][2]);
			SetPlayerFacingAngle(playerid,NPCData[npc_list:npc_id][npc_pos][3]);
			SetPlayerSkin(playerid,NPCData[npc_list:npc_id][npc_skin]);
			if(NPCData[npc_list:npc_id][npc_additional][0] != 0)
			{
			    GivePlayerWeapon(playerid,NPCData[npc_list:npc_id][npc_additional][0],999);
			    SetPlayerArmedWeapon(playerid,NPCData[npc_list:npc_id][npc_additional][0]);
			}
		}
		return 1;
	}
	
	if(GetPVarInt(playerid,"anim_libs_cached") != 1)
	{
   		/*PreloadAnimLib(playerid,"BOMBER");
    	PreloadAnimLib(playerid,"SHOP");
   		PreloadAnimLib(playerid,"SMOKING");
    	PreloadAnimLib(playerid,"FOOD");
    	PreloadAnimLib(playerid,"ON_LOOKERS");
    	PreloadAnimLib(playerid,"DEALER");
		PreloadAnimLib(playerid,"CRACK");
		PreloadAnimLib(playerid,"CARRY");
		PreloadAnimLib(playerid,"PARK");
		PreloadAnimLib(playerid,"INT_HOUSE");
		PreloadAnimLib(playerid,"FOOD");
		PreloadAnimLib(playerid,"GYMNASIUM");
		PreloadAnimLib(playerid,"Freeweights");
		PreloadAnimLib(playerid,"UZI");*/
		new AnimLibraries[][] =
		{
			"AIRPORT","Attractors","BAR","BASEBALL","BD_FIRE","BEACH","benchpress","BF_injection","BIKED","BIKEH",
			"BIKELEAP","BIKES","BIKEV","BIKE_DBZ","BLOWJOBZ","BMX","BOMBER","BOX","BSKTBALL","BUDDY","BUS","CAMERA",
			"CAR","CARRY","CAR_CHAT","CASINO","CHAINSAW","CHOPPA","CLOTHES","COACH","COLT45","COP_AMBIENT","COP_DVBYZ",
			"CRACK","CRIB","DAM_JUMP","DANCING","DEALER","DILDO","DODGE","DOZER","DRIVEBYS","FAT","FIGHT_B","FIGHT_C",
			"FIGHT_D","FIGHT_E","FINALE","FINALE2","FLAME","Flowers","FOOD","Freeweights","GANGS","GHANDS","GHETTO_DB",
			"goggles","GRAFFITI","GRAVEYARD","GRENADE","GYMNASIUM","HAIRCUTS","HEIST9","INT_HOUSE","INT_OFFICE",
			"INT_SHOP","JST_BUISNESS","KART","KISSING","KNIFE","LAPDAN1","LAPDAN2","LAPDAN3","LOWRIDER","MD_CHASE",
			"MD_END","MEDIC","MISC","MTB","MUSCULAR","NEVADA","ON_LOOKERS","OTB","PARACHUTE","PARK","PAULNMAC","ped",
			"PLAYER_DVBYS","PLAYIDLES","POLICE","POOL","POOR","PYTHON","QUAD","QUAD_DBZ","RAPPING","RIFLE","RIOT",
			"ROB_BANK","ROCKET","RUSTLER","RYDER","SCRATCHING","SHAMAL","SHOP","SHOTGUN","SILENCED","SKATE","SMOKING",
			"SNIPER","SPRAYCAN","STRIP","SUNBATHE","SWAT","SWEET","SWIM","SWORD","TANK","TATTOOS","TEC","TRAIN","TRUCK",
			"UZI","VAN","VENDING","VORTEX","WAYFARER","WEAPONS","WUZI"
		};
		for(new i; i<sizeof(AnimLibraries); i++) PreloadAnimLib(playerid,AnimLibraries[i]);
		SetPVarInt(playerid,"anim_libs_cached",1);
	}
	if(!PlayerEvent[playerid][LOGGED_IN]) return 1;
	SetPlayerSkin(playerid,PlayerOption[playerid][Skin]>0?PlayerOption[playerid][Skin]:DEFAULT_SKIN);
	if(PlayerEvent[playerid][TutorialStep][0] != -1)//Tutorial noch nicht gemacht
	{
	    GameTextForPlayer(playerid,"~g~Du wirst in das Einführungslevel gesetzt",3000,3);
	    SetPlayerVirtualWorld(playerid,(playerid+2000));
		PlayerInfo[playerid][IsInCRoom] 		= 0;
		PlayerInfo[playerid][CRoomAction] 		= 0;
		PlayerInfo[playerid][CRoomSubAction] 	= 0;
	    //Tutorialstart
	    if(PlayerEvent[playerid][TutorialStep][0] != 0) status::ShowDraws(playerid);
		switch(PlayerEvent[playerid][TutorialStep][0])
		{
	        case 0:
	        {
				SetPlayerPos(playerid, -2171.9487,973.8623,-4.0091);
			    SetPlayerFacingAngle(playerid,30.0);
                SetPlayerCameraInfoEx(playerid,Float:{-2174.5470703125, 975.0400390625, -3.5115416049957},Float:{-2168.2316894531, 968.06512451172, 61.956909179688}); //c1
				SetPlayerFacingAngle(playerid,30.0);
				SetPlayerInterior(playerid,0);
				SetPlayerVirtualWorld(playerid,(playerid+2000));
				language_menu(playerid);//Sprachauswahl
			}
			case 1:
			{
				//Statisch, es gibt keine Missionsziele
			    PlayerEvent[playerid][TutorialStep][0] = 1;
			    PlayerEvent[playerid][TutorialStep][1] = 1;
			    //old w_SetPlayerPos(playerid,54.1131,1052.6071,2016.2017,3);
		        w_SetPlayerPos(playerid,54.1131,1052.6071,7016.2017,_,3);
				SetCameraBehindPlayer(playerid);
		        Currentstep[playerid] = 0;
			}
			case 2,3:
			{//Auf der Insel
	            w_SetPlayerPos(playerid,54.1131,1052.6071,2016.2017,210.0,3);
	            SetPlayerMissionCP(playerid,-774.2107,2419.3347,157.0974);
                PlayerEvent[playerid][TutorialStep][0] = 2;
                PlayerEvent[playerid][TutorialStep][1] = 0;
                DeletePlayerSpecialObject(playerid,OBJECT_TYPE_ALL);
			}
			case 4:
			{
			    PlayerEvent[playerid][TutorialStep][0] = 3;
			    PlayerEvent[playerid][TutorialStep][1] = 9;
			    SetPlayerInterior(playerid,2);
			    SetPlayerVirtualWorld(playerid,(playerid+2000));
			    w_SetPlayerPos(playerid,660.6028,-2361.5930,15.6427,_,3);
			}
			/*case 5:
			{
				SetPlayerInterior(playerid,0);
				SetPlayerVirtualWorld(playerid,0);
				PlayerEvent[playerid][TutorialStep][0] = 5;
				PlayerEvent[playerid][TutorialStep][1] = 0;
				w_SetPlayerPos(playerid,-311.68264770508,2775.1477050781,65.567085266113,_,3);
			}*/
			default: printf("tutorial non valid id, pid: %d, t0, t1",playerid,PlayerEvent[playerid][TutorialStep][0],PlayerEvent[playerid][TutorialStep][1]);
		}
	    return 1;
	}

	if(PlayerEvent[playerid][IstTot] >= 1)//Ist tot
	{
	    PlayerInfo[playerid][IsInCRoom] 		= 2;//damit er gespawnt wird
	    PlayerOption[playerid][SelectedSpawn] 	= 5;//todesspawn
	}

	if(PlayerInfo[playerid][IsInCRoom] == 2)//Im CRaum, hat Spawn ausgewaehlt
	{
		OnPlayerRealSpawn(playerid);
		return 1;
	}
	//In den Kontrollraum setzen ;)
	if(!(PlayerOption[playerid][OptionC]&optCRoom))
	{
		format(string,sizeof(string),"{F1F7DC}...dies ist der OOC User Kontrollraum.\nHier kannst du Statistiken, Erfolge, Sammelobjekte, Fortschritte und\nvieles mehr ueber deinen InGame Charakter einsehen. Dies ist scheinbar\ndein erster Besuch bei Postnuke Wasteland, daher empfehlen wir die die Spielwelt\nzu betreten und das Tutorial zu starten.");
		strcat(string," Im Kontrollraum bewegst du dich mit PFEIL LINKS und RECHTS\n nach links und rechts, bestätigen tust du mit der ENTER Taste. Viel Spaß\nDas Postnuke Team\n\n\nDu kannst diese Meldung deaktivieren");
		ShowPlayerDialog(playerid,dialog_OPTION_CROOM,DIALOG_STYLE_MSGBOX,"Herzlich Willkommen...",string,"Weiter","X");
	}
    fixed_TextDrawHideForPlayer(playerid,Filmstreifen[0]);
    fixed_TextDrawHideForPlayer(playerid,Filmstreifen[1]);
	PlayerInfo[playerid][IsInCRoom] 		= 1;
	PlayerInfo[playerid][CRoomAction] 		= 0;
	PlayerInfo[playerid][CRoomSubAction] 	= 0;

	w_SetPlayerPos(playerid, -2171.9487,973.8623,-4.0091);
	SetPlayerFacingAngle(playerid,30.0);
	SetPlayerInterior(playerid,0);
	SetPlayerVirtualWorld(playerid,(playerid+2000));

    TogglePlayerControllable(playerid,false);
	SetPlayerCameraInfoEx(playerid, Float:{-2165.1530, 980.1178, -3.4176}, Float:{-2140.8876, 980.1178, -3.4176}); //Raummitte
	ShowInfoMessage(playerid,"Skin~<~Spielwelt beitreten~>~Karte~n~ENTER = Bestaetigen");
	return 1;
}

OnPlayerRealSpawn(playerid)
{
    SetPVarInt(playerid,"first_connection",1);
 	HideInfoMessage(playerid);
 	SetCameraBehindPlayer(playerid);
	PlayerInfo[playerid][IsInCRoom] 		= 0;
	PlayerInfo[playerid][CRoomAction] 		= 0;
	PlayerInfo[playerid][CRoomSubAction] 	= 0;
	equip::ResetEquipment(playerid);
	switch(PlayerEquipment[playerid][Rucksack])
	{
	    case 1: equip::UseEquipment(playerid,363,Spine,0.317999,-0.152999,0.243000,0.000000,89.400001,0.000000,1.385999,1.473001,1.451000,.oslot=BACKPACK_SLOT);//Klein
	    case 2: equip::UseEquipment(playerid,3026,Spine,-0.235999,-0.082999,-0.009999,0.000000,0.000000,0.000000,1.162000,1.180998,1.205999,.oslot=BACKPACK_SLOT);//Mittel
	    case 3: equip::UseEquipment(playerid,371,Spine,-0.020000,-0.134999,-0.019000,0.000000,87.100028,0.000000,1.409001,1.505001,1.221000,.oslot=BACKPACK_SLOT);//Groß
	}
	if(PlayerOption[playerid][SelectedSpawn] != 2)
	{//Reset house info
		PlayerOption[playerid][HouseCache][0] = -1;
		PlayerEvent[playerid][InteractHouse] = -1;
	}
	if(PlayerEvent[playerid][IstTot] == 0)
	{
		status::ShowDraws(playerid);
		if(!PlayerEvent[playerid][WeaponsGiven])
		{
			PLAYER::LoadPlayerWeapons(playerid);
			PlayerEvent[playerid][WeaponsGiven] = true;
		}
	}
    if(PlayerOption[playerid][Crashed] == 1)
    {
        PlayerOption[playerid][Crashed] = 0;
        mysql_SetIntByInt("pnwl_user_option","crashed",0,"userid",PlayerInfo[playerid][PLAYER_ID]);
    }
    CORE::DisplayGangzones(playerid);
    if(PlayerEvent[playerid][IstTot] == 0)
	{
	    DisablePlayerMissionCP(playerid);
		new questid 	= PlayerQuestCache[playerid][qAktiv],
			questslot	= quest::PlayerQuestSlotByQuestID(playerid,questid);
		if(questid > 0) quest::OnQuestUpdate(playerid,questid,PlayerQuest[playerid][questslot][qStep],true);
		fixed_TextDrawShowForPlayer(playerid,RealClock);
		SetPlayerWeather(playerid,__SERVER[GLOBAL_WEATHER]);
    }
	switch(PlayerOption[playerid][SelectedSpawn])
	{
		case 0:
		{//noob spawn (hotel)
			w_SetPlayerPos(playerid,2237.6450195313,-1154.6309814453,1029.796875,_,3);
			SetPlayerVirtualWorld(playerid,0);
			SetPlayerInterior(playerid,15);
			if(PlayerEvent[playerid][IstTot] == 0) 	SetPlayerVirtualWorld(playerid,1234);
			else 									SetPlayerVirtualWorld(playerid,1235);
		}
		case 1:
		{//log spawn
			PlayerOption[playerid][SelectedSpawn] = 0;
			w_SetPlayerPos(playerid,mysql_GetFloatByInt("pnwl_user_pos","logpos1","userid",PlayerInfo[playerid][PLAYER_ID]),mysql_GetFloatByInt("pnwl_user_pos","logpos2","userid",PlayerInfo[playerid][PLAYER_ID]),mysql_GetFloatByInt("pnwl_user_pos","logpos3","userid",PlayerInfo[playerid][PLAYER_ID]),_,3);
			SetPlayerVirtualWorld(playerid,mysql_GetIntByInt("pnwl_user_pos","logvw","userid",PlayerInfo[playerid][PLAYER_ID]));
			SetPlayerInterior(playerid,mysql_GetIntByInt("pnwl_user_pos","logint","userid",PlayerInfo[playerid][PLAYER_ID]));
			LoadPlayerHouseSpawnSettings(playerid,"log_house");
			if(PlayerOption[playerid][HouseCache][0] != -1) OnEnterHouse(playerid,PlayerEvent[playerid][InteractHouse],false);
		}
		case 2:
		{//haus spawn
		    new spawn_house = -1;
		    for(new hid=0; hid<MAX_HOUSES; hid++)
		    {
		        if(HouseInfo[hid][hID] == PlayerOption[playerid][HouseSelect])
		        {
		            spawn_house = hid;
		            break;
		        }
		    }
		    if(spawn_house == -1)
		    {//Haus gibts nicht
		        format(string,sizeof(string),"ERROR: Das gewählte Haus mit der ID %d konnte nicht lokalisiert werden.",PlayerOption[playerid][HouseSelect]);
		        SendClientMessage(playerid,ROT,string);
		        PlayerOption[playerid][SelectedSpawn] = 0;
		        PlayerOption[playerid][HouseSelect] = -1;
		        OnPlayerSpawn(playerid);
				return 1;
		    }
		    else
		    {
		        format(string,sizeof(string),"SPAWN_HOUSE = %d",spawn_house);
				SendClientMessage(playerid,GRUEN,string);
		    	OnEnterHouse(playerid,spawn_house,false);
		    	switch(HouseInfo[spawn_house][hInterior])
		    	{
		    	    case 2:
		    	    {
		    	    }
					default:
					{//1 und alle invaliden
						w_SetPlayerPos(playerid,795.300781,-2723.40087,101.0799,_,3);
					}
				}
		    	return 1;
		    }

		}
		case 3:
		{//fraktionsspawn
		    switch(PlayerInfo[playerid][Fraktion])
		    {
		        case 1:
		        {//Basis der Armee
					w_SetPlayerPos(playerid,2237.6450195313,-1154.6309814453,1029.796875,_,3);
					SetPlayerVirtualWorld(playerid,0);
					SetPlayerInterior(playerid,15);
					if(PlayerEvent[playerid][IstTot] == 0) SetPlayerVirtualWorld(playerid,1234);
					else SetPlayerVirtualWorld(playerid,1235);
		        }
		        case 2:
		        {//Basis der Infizierten
					w_SetPlayerPos(playerid,-1464.63,-274.6,6.0,_,3);
					SetPlayerVirtualWorld(playerid,0);
					SetPlayerInterior(playerid,0);
					if(PlayerEvent[playerid][IstTot] == 0) SetPlayerVirtualWorld(playerid,0);
					else SetPlayerVirtualWorld(playerid,1000);
		        }
		        default:
		        {//Hotel in FC
					w_SetPlayerPos(playerid,2237.6450195313,-1154.6309814453,1029.796875,_,3);
					SetPlayerVirtualWorld(playerid,0);
					SetPlayerInterior(playerid,15);
					if(PlayerEvent[playerid][IstTot] == 0) SetPlayerVirtualWorld(playerid,1234);
					else SetPlayerVirtualWorld(playerid,1235);
		        }
		    }
			return 1;
		}
		case 4:
		{//crash spawn
			PlayerOption[playerid][SelectedSpawn] = 0;
			PlayerOption[playerid][Crashed] = 0;
			mysql_SetIntByInt("pnwl_user_option","crashed",0,"userid",PlayerInfo[playerid][PLAYER_ID]);

			w_SetPlayerPos(playerid,mysql_GetFloatByInt("pnwl_user_pos","crashedpos1","userid",PlayerInfo[playerid][PLAYER_ID]),mysql_GetFloatByInt("pnwl_user_pos","crashedpos2","userid",PlayerInfo[playerid][PLAYER_ID]),mysql_GetFloatByInt("pnwl_user_pos","crashedpos3","userid",PlayerInfo[playerid][PLAYER_ID]),_,3);
			SetPlayerVirtualWorld(playerid,mysql_GetIntByInt("pnwl_user_pos","crashvw","userid",PlayerInfo[playerid][PLAYER_ID]));
			SetPlayerInterior(playerid,mysql_GetIntByInt("pnwl_user_pos","crashint","userid",PlayerInfo[playerid][PLAYER_ID]));
			LoadPlayerHouseSpawnSettings(playerid,"crash_house");
			if(PlayerOption[playerid][HouseCache][0] != -1) OnEnterHouse(playerid,PlayerEvent[playerid][InteractHouse],false);
		}
		case 5:
		{//tot spawn
		    SetPlayerWeather(playerid,113);
		    SetPlayerTime(playerid,6,0);
			SetPlayerInterior(playerid,mysql_GetIntByInt("pnwl_user_pos","totint","userid",PlayerInfo[playerid][PLAYER_ID]));
			SetPlayerVirtualWorld(playerid,mysql_GetIntByInt("pnwl_user_pos","totvw","userid",PlayerInfo[playerid][PLAYER_ID]));
			w_SetPlayerPos(playerid,PlayerInfo[playerid][TotPos][0],PlayerInfo[playerid][TotPos][1],PlayerInfo[playerid][TotPos][2],_,2);
			if(!(PlayerOption[playerid][OptionC]&optCTod))
			{
			    format(string,sizeof(string),"%s, du bist bereits %d mal gestorben...\nDu bist jetzt fünf Minuten lang tot, das heißt du wirst nur andere tote\nSpieler sehen und dich mit ihnen unterhalten koennen. Du bist nicht in der Lage den CRaum\nzu besuchen, mit NPC zu interagieren, Items zu farmen, Quests zu machen und weiteres. Nach\n5 Minuten wirst du wieder normal spawnen.\n\n\nDu kannst diese Meldungen deaktivieren",GetName(playerid),PlayerEvent[playerid][CountTode]);
				ShowPlayerDialog(playerid,dialog_OPTION_TOT,DIALOG_STYLE_MSGBOX,"Du bist gestorben...",string,"Ok","X");
			}
			PlayerOption[playerid][SelectedSpawn] = 0;//auf den noobspawn zurücksetzen
			LoadPlayerHouseSpawnSettings(playerid,"tot_house");
			if(PlayerOption[playerid][HouseCache][0] != -1) OnEnterHouse(playerid,PlayerEvent[playerid][InteractHouse],false);

		    if(GetPVarInt(playerid,"revivable") == 1)
			{
				DestroyPickup(PlayerInfo[playerid][pTotPickup]);
		        Delete3DTextLabel(PlayerInfo[playerid][TotTag]);
			}
            PlayerInfo[playerid][pTotPickup] = CreatePickup(1254,1,PlayerInfo[playerid][RevivePos][0],PlayerInfo[playerid][RevivePos][1],PlayerInfo[playerid][RevivePos][2],0);
            format(string,sizeof(string),"R.I.P.\n%s\n/revive",PlayerInfo[playerid][pName]);
            PlayerInfo[playerid][TotTag] = Create3DTextLabel(string,ROT,PlayerInfo[playerid][RevivePos][0],PlayerInfo[playerid][RevivePos][1],PlayerInfo[playerid][RevivePos][2],10.0,0,0);
            SetPVarInt(playerid,"revivable",1);
		}
	}
    return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    FCNPC_UnlinkFollowers(playerid);
	if(IsPlayerNPC(playerid)) return 1;
	ResetPlayerWeapons(playerid);
	PlayerCache[playerid][current_weapon_id] = 0;
	PlayerCurrentWeaponSlot[playerid] = 0;
	equip::ResetEquipment(playerid);
	PlayerCache[playerid][equip_fist_item] = 0;
	
    HidePlayerDialog(playerid);
    fixed_TextDrawHideForPlayer(playerid,RealClock);
    ManageAusdauerDraw(playerid,false);
    
    fixed_SetPlayerWorldBounds(playerid,-20000.0,20000.0,-20000.0,20000.0);
	if(GetPVarInt(playerid,"attacked_time") > 0)
	{
		if(killerid == INVALID_PLAYER_ID && GetPVarInt(playerid,"attacked_by") != INVALID_PLAYER_ID && IsPlayerConnected(GetPVarInt(playerid,"attacked_by"))) killerid = GetPVarInt(playerid,"attacked_by");
		SetPVarInt(playerid,"attacked_by",-1);
		SetPVarInt(playerid,"attacked_time",0);
	}
	if(IsPlayerConnected(killerid) && !PlayerEvent[playerid][LOGGED_IN]) killerid = -1;

	if(PlayerEvent[playerid][LOGGED_IN])
	{
	    status::HideDraws(playerid);
	    EndMedicalTreatment(playerid);
	    DisablePlayerMissionCP(playerid);
		
		__STATS[USER_DEATHS]++;
		if(GetPVarInt(playerid,"pev_anrufen") != 0) CellPhoneFinishCall(playerid);
	    if(PlayerInfo[playerid][IsInCRoom] == 1)
	    {//Ist im Kontrollraum
	    }
	    else
	    {
	        if(PlayerEvent[playerid][TutorialStep][0] != -1)
	        {//Im Tutorial
	        }
	        else
	        {
	            GetPlayerPos(playerid,PlayerInfo[playerid][TotPos][0],PlayerInfo[playerid][TotPos][1],PlayerInfo[playerid][TotPos][2]);
	            new totvw = GetPlayerVirtualWorld(playerid);

	            if(GetPVarInt(playerid,"revivable") == 1)
				{//ist schon tot, sollte eigentlich nicht passieren XD
					DestroyPickup(PlayerInfo[playerid][pTotPickup]);
					Delete3DTextLabel(PlayerInfo[playerid][TotTag]);
					SetPVarInt(playerid,"revivable",0);
	            }
	            if(GetPVarInt(playerid,"pev_train") != 0) OnSportstudioExit(playerid);

				if(PlayerEvent[playerid][IstTot] >= 1)
		        {//ist schon tot, sollte eigentlich nicht passieren XD
		        }
		        else
		        {//spielt normal
		            __STATS[USER_KILLS]++;
		        
		            new bool:died_in_gw = false;
					if(killerid != INVALID_PLAYER_ID && PlayerInfo[playerid][pGang] != -1 && IsPlayerConnected(killerid) && !IsPlayerNPC(killerid) && PlayerInfo[killerid][pGang] != -1)
					{
					    if(PlayerInfo[playerid][pGang] != PlayerInfo[killerid][pGang])
					    {
						    new tid = GangInfo[PlayerInfo[playerid][pGang]][gTurfFight];
						    if(tid >= 0 && tid < MAX_TURFS)
						    {
							    if(tid == GangInfo[PlayerInfo[killerid][pGang]][gTurfFight])
							    {
						    	    /*if(IsPlayerInArea(playerid,TurfInfo[tid][tPosData][0]-EXTEND_GW_ZONE,TurfInfo[tid][tPosData][1]-EXTEND_GW_ZONE,TurfInfo[tid][tPosData][2]+EXTEND_GW_ZONE,TurfInfo[tid][tPosData][3]+EXTEND_GW_ZONE))
						    	    {//Im Gebiet*/
						    	    turf::OnFightScore(PlayerInfo[playerid][pGang],PlayerInfo[killerid][pGang]);
									died_in_gw = true;
						    	    //}
							    }
							}
						}
					}
			        PlayerEvent[playerid][IstTot]		= (died_in_gw?GANGWAR_DEATH_TIME:PLAYER_DEATH_TIME);
			        PlayerEvent[playerid][CountTode]	+= 1;
			        format(query,sizeof(query),"UPDATE pnwl_user_event SET counttode=counttode+1,isttot='%d' WHERE userid='%d'",PlayerEvent[playerid][IstTot],PlayerEvent[playerid][CountTode],PlayerInfo[playerid][PLAYER_ID]);
			        mysql_query_once(query);

	                SetPVarInt(playerid,"revivable",1);
	                GetPlayerPos(playerid,PlayerInfo[playerid][RevivePos][0],PlayerInfo[playerid][RevivePos][1],PlayerInfo[playerid][RevivePos][2]);

				    if(PlayerOption[playerid][HouseCache][0] != -1) mysql_SetIntByInt("pnwl_user_pos","revive_house",PlayerOption[playerid][HouseCache][0],"userid",PlayerInfo[playerid][PLAYER_ID]);
					else mysql_SetIntByInt("pnwl_user_pos","revive_house",-1,"userid",PlayerInfo[playerid][PLAYER_ID]);

					PlayerInfo[playerid][ReviveHouse] 	= PlayerOption[playerid][HouseCache][0];
                    PlayerInfo[playerid][ReviveVW] 		= GetPlayerVirtualWorld(playerid);
                    PlayerInfo[playerid][ReviveINT] 	= GetPlayerInterior(playerid);

					format(query,sizeof(query),"UPDATE pnwl_user_pos SET revivepos1='%f',revivepos2='%f',revivepos3='%f',reviveint='%d',revivevw='%d' WHERE userid='%d'",PlayerInfo[playerid][RevivePos][0],PlayerInfo[playerid][RevivePos][1],PlayerInfo[playerid][RevivePos][2],GetPlayerInterior(playerid),GetPlayerVirtualWorld(playerid),PlayerInfo[playerid][PLAYER_ID]);
					mysql_query_once(query);
					
					if(killerid != INVALID_PLAYER_ID && IsPlayerConnected(killerid))
					{
					    if(reason >= 0 && reason < 43)
					    {
							if(GetWeaponSlot(reason) == 0)
							{
								if(PlayerCurrentWeaponSlot[killerid] == 1 && PlayerCache[killerid][equip_fist_item] >= 1)
								{
								    switch(item_ItemInfo[PlayerCache[killerid][equip_fist_item]][iObjectID])
								    {
								        case 18634: reason = 43;//Brechstange
								        case 337: 	reason = 44;//Schaufel
								        case 18635: reason = 45;//Hammer
								        case 18633: reason = 46;//Schraubenschlüssel
								        case 335: 	reason = 47;//Messer
								        case 18642: reason = 48;//Tazer
								    }
								}
							}
					
						    if(WeaponInfo[reason][wType] & wNahkampf)
						    {
							    new am_id = __amCache[amKneipenschlaeger];//Gegner K.O. schlagen
							    if(am_id != -1) achievement::SetPlayerAchievementData(killerid,am_id,1,true);
							}
						    if(WeaponInfo[reason][wType] & wSchuss)
						    {
							    new am_id = __amCache[amSchiesswuetig];//Mit dem Gewehr umbringen
							    if(am_id != -1) achievement::SetPlayerAchievementData(killerid,am_id,1,true);
							    if(WeaponInfo[reason][wType] & wOnehand)
							    {
								    am_id = __amCache[amRevolverheld];//Mit einer Pistole töten
								    if(am_id != -1) achievement::SetPlayerAchievementData(killerid,am_id,1,true);
							    }
							}
						    if(WeaponInfo[reason][wType] & wSpecial)
						    {
							    new am_id = __amCache[amDafuq];//Unübliche Waffen
							    if(am_id != -1) achievement::SetPlayerAchievementData(killerid,am_id,1,true);
							}
						    if(reason == 47)//MesserID
						    {
							    new am_id = __amCache[amHundemarke];//Mit dem Messer töten
							    if(am_id != -1) achievement::SetPlayerAchievementData(killerid,am_id,1,true);
							}
							//Weaponstats
							new wstring[15];
							format(wstring,sizeof(wstring),"w_%d_KILLS",reason);
							SetPVarInt(killerid,wstring,GetPVarInt(killerid,wstring)+1);
						}
					}
					
				    if(GetPVarInt(playerid,"pev_training_fightstyle_step") >= 1)
				    {
						DeletePVar(playerid,"cache_fightstyle");
						DeletePVar(playerid,"pev_training_fightstyle_step");
						DeletePVar(playerid,"pev_training_fightstyle_value");
						SetPlayerFightingStyle(playerid,PlayerOption[playerid][FightingStyle]);
					}
				}

	            if(PlayerEvent[playerid][InteractHouse] == -1)
				{
		            if(totvw == 0) 			totvw = 1000;
		            else if(totvw == 1234) 	totvw = 1235;
				}
				else totvw = (PlayerEvent[playerid][InteractHouse]<<3)+2;
				SetPlayerVirtualWorld(playerid,totvw);

				format(string,sizeof(string),"UPDATE pnwl_user_pos SET totpos1='%f',totpos2='%f',totpos3='%f',totint='%d',totvw='%d' WHERE userid='%d'",PlayerInfo[playerid][TotPos][0],PlayerInfo[playerid][TotPos][1],PlayerInfo[playerid][TotPos][2],GetPlayerInterior(playerid),totvw,PlayerInfo[playerid][PLAYER_ID]);
				mysql_query_once(string);
				mysql_SetIntByInt("pnwl_user_event","isttot",PlayerEvent[playerid][IstTot],"userid",PlayerInfo[playerid][PLAYER_ID]);

			    if(PlayerOption[playerid][HouseCache][0] != -1) mysql_SetIntByInt("pnwl_user_pos","tot_house",PlayerOption[playerid][HouseCache][0],"userid",PlayerInfo[playerid][PLAYER_ID]);
				else mysql_SetIntByInt("pnwl_user_pos","tot_house",-1,"userid",PlayerInfo[playerid][PLAYER_ID]);

		        SetPlayerWeather(playerid,113);
		        SetPlayerTime(playerid,6,0);

		        SetPVarInt(playerid,"revivable",0);
		        
		        if(BoxTime >= 1 && (BoxerID[0] == playerid || BoxerID[1] == playerid))
		        {//Im Boxkampf
					SetPVarFloat(playerid,"box_hp",0.0);
					OnEndBoxfight();
				}
				else
				{
					PLAYER::SavePlayerWeapons(playerid);
					PLAYER::ResetPlayerWeapons(playerid,false);
				}
			}
	    }
	}
	else
	{
	    //Nicht eingeloggt
	}
	return 1;
}

public OnVehicleSpawn(vehicleid)
{
	CallLocalFunction("car_OnVehicleSpawn","d",vehicleid);
	return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
	CallLocalFunction("car_OnVehicleDeath","dd",vehicleid,killerid);
	return 1;
}

public OnPlayerText(playerid, text[])
{
    if(IsPlayerNPC(playerid)) return 1;
	if(!PlayerEvent[playerid][LOGGED_IN] || PlayerInfo[playerid][IsInCRoom] != 0) return false;//Nicht eingeloggt oder im Kontrollraum
	new bool:allowed_to_send = true,bool:try_send = true;
    if(GetPVarInt(playerid,"onplayertext_muted") == 1 || GetPVarInt(playerid,"onplayertext_ms") >= MAX_CHAT_MESSAGES_PER_10_SECONDS || GetPVarInt(playerid,"used_badwords") >= MAX_BADWORD_WARNINGS || GetPVarInt(playerid,"badword_mute") >= 1) allowed_to_send = false;

	if(text[0] == '#')
	{
	    if(strlen(text) == 1)
		{
			OnPlayerFunk(playerid,"",1);
			try_send = false;
			return 0;
		}
		else
	    {
	        if(allowed_to_send == true)
	        {
		        SetPVarInt(playerid,"onplayertext_ms",GetPVarInt(playerid,"onplayertext_ms")+1);
		        format(string,sizeof(string),"");
		        strmid(string,text,1,strlen(text));
		        OnPlayerFunk(playerid,string);
		        return 0;
			}
	    }
	}

	if(PlayerInfo[playerid][pGang] != -1)
	{//ist in einer gang
		if(PlayerOption[playerid][GChat][0] && strlen(text) > PlayerOption[playerid][GChat][3])
		{//vll gangchat
			new bool:g_valid=true;
		    for(new gchat; gchat<PlayerOption[playerid][GChat][3]; gchat++)
		    {
		        if(text[gchat] != PlayerOption[playerid][GChat][gchat])
		        {
		            g_valid = false;
		            break;
		        }
		    }
			if(g_valid == true)
			{//Gangchat
			    if(allowed_to_send == true)
			    {
				    SetPVarInt(playerid,"onplayertext_ms",GetPVarInt(playerid,"onplayertext_ms")+1);
				    format(string,sizeof(string)," ");
				    strmid(string,text,PlayerOption[playerid][GChat][3],strlen(text));
				    format(string,sizeof(string),"GChat %s %s (%d) => %s",PlayerInfo[playerid][Vorname],PlayerInfo[playerid][Nachname],playerid,string);
				    gang::SendMessageToGang(PlayerInfo[playerid][pGang],BLAU,string);
				    return 0;
				}
			}
		}
	}
	
	if(allowed_to_send == false && try_send == true)
	{
	    if(GetPVarInt(playerid,"onplayertext_ms") >= MAX_CHAT_MESSAGES_PER_10_SECONDS)
	    {
			format(query,sizeof(query),#FORMAT_CHAT_ERROR"Du hast in 10 Sekunden mehr als %d Nachrichten gesendet. Du wirst für %s Sekunden gemuted...",MAX_CHAT_MESSAGES_PER_10_SECONDS,MAX_MUTE_TIME);
			SendClientMessage(playerid,ROT,query);
			SetPVarInt(playerid,"onplayertext_muted",MAX_MUTE_TIME);
	    	return 0;
	    }
	    if(GetPVarInt(playerid,"used_badwords") >= MAX_BADWORD_WARNINGS)
	    {
	        format(string,sizeof(string),#FORMAT_CHAT_ERROR"Du wurdest für %d Sekunden gemuted, pass auf deine Sprache auf!",GetPVarInt(playerid,"badword_mute"));
	        SendClientMessage(playerid,ROT,string);
	        return 0;
	    }
	}

	//Normaler Umgebungschat
	new Float:p[3],part=0;
	GetPlayerPos(playerid,p[0],p[1],p[2]);
    SetPVarInt(playerid,"onplayertext_ms",GetPVarInt(playerid,"onplayertext_ms")+1);
    
	/*
		144 Text[]
		5   Name (ID): Text[]
		3   PlayerID
		24  Name
		1   \0
		__________
		161 Converted Message
	*/
	new message[144],
		bwords = 0;//has_badwords(text);
    if(bwords >= 1)
    {
        SetPVarInt(playerid,"used_badwords",GetPVarInt(playerid,"used_badwords")+1);
        format(string,sizeof(string),#FORMAT_CHAT_INFO"Pass auf deine Sprache auf! (Warnung %d/%d)",GetPVarInt(playerid,"used_badwords"),MAX_BADWORD_WARNINGS);
        SendClientMessage(playerid,ROT,string);
        if(GetPVarInt(playerid,"used_badwords") >= MAX_BADWORD_WARNINGS)
        {
            SetPVarInt(playerid,"badword_mute",MAX_BADWORD_MUTE_TIME);
            format(string,sizeof(string),#FORMAT_CHAT_INFO"Du wurdest für %d Sekunden gemuted!",MAX_BADWORD_MUTE_TIME);
            SendClientMessage(playerid,ROT,string);
        }
    }
    

	new bool:_handy = GetPVarInt(playerid,"pev_anrufen")==3?true:false;	
	while(__SERVER[TRUE])
	{
        strmid(message,text,(MAX_CHAT_LEN*part),MAX_CHAT_LEN+(MAX_CHAT_LEN*part));
        format(message,sizeof(message),"%s %s (%d%s): %s",PlayerInfo[playerid][Vorname],PlayerInfo[playerid][Nachname],playerid,_handy?(", Handy"):(""),message);
        new pvw = GetPlayerVirtualWorld(playerid);

		for(new pir; pir<=__SERVER[HIGHEST_PLAYER_ID]; pir++)
		{
		    if(IsPlayerInRangeOfPoint(pir,MAX_UCHAT_RANGE,p[0],p[1],p[2]) && GetPlayerVirtualWorld(pir) == pvw)
		    {
		        if(!_handy) SendClientMessage(pir,SEPIA,message);
		        else        SendClientMessage(pir,0xA0906BFF,message);//Heller
		    }
		}

		part++;
		if(strlen(text) < (part*MAX_CHAT_LEN)) break;
	}
	if(!_handy) SetPlayerChatBubble(playerid,text,WEISS,15.0,3000);
	format(message,sizeof(message),"HANDY (%s %s): %s",PlayerInfo[playerid][Vorname],PlayerInfo[playerid][Nachname],text);
	SendClientMessage(GetPVarInt(playerid,"pev_anrufen_id"),GOLD,message);
	return 0;
}

stock OnPlayerFunk(playerid,text[],option=0)
{
	if(option == 1)
	{
	    if(PlayerOption[playerid][pFunkgeraet][0] >= 1)
	    {
	        ncom_funk(playerid);
	        SendClientMessage(playerid,GRUEN,#FORMAT_CHAT_INFO"Du kannst auch \"/funk\" benutzen");
	        return 1;
	    }
	    else return 1;
	}
	else
	{
	    new Float:p_pos[6],Float:dist,bool:is_in_range,to_people_sent;
	    GetPlayerPos(playerid,p_pos[0],p_pos[1],p_pos[2]);
	    for(new i; i<(__SERVER[HIGHEST_PLAYER_ID]+1); i++)
	    {
	        if(i != playerid && !IsPlayerNPC(i) && PlayerOption[i][pFunkgeraet][1] == PlayerOption[playerid][pFunkgeraet][1])
	        {
	            if(PlayerOption[i][pFunkgeraet][1] != PlayerOption[playerid][pFunkgeraet][1] && PlayerOption[playerid][pFunkgeraet][1] >= 3) continue;
	            if(PlayerOption[i][pFunkgeraet][1] != PlayerOption[playerid][pFunkgeraet][1] && PlayerOption[i][pFunkgeraet][3] == 1) continue;
				is_in_range = false;
	            GetPlayerPos(i,p_pos[3],p_pos[4],p_pos[5]);
				dist = floatsqroot(((p_pos[3] - p_pos[0]) * (p_pos[3] - p_pos[0])) + ((p_pos[4] - p_pos[1]) * (p_pos[4] - p_pos[1])) + ((p_pos[5] - p_pos[2]) * (p_pos[5] - p_pos[2])));
				if(dist <= 300.0 && PlayerOption[i][pFunkgeraet][0] >= 1 && PlayerOption[playerid][pFunkgeraet][0] >= 1) is_in_range = true;
				else if(dist <= 600.0 && PlayerOption[i][pFunkgeraet][0] >= 2 && PlayerOption[playerid][pFunkgeraet][0] >= 2) is_in_range = true;
				else if(dist <= 900.0 && PlayerOption[i][pFunkgeraet][0] >= 3 && PlayerOption[playerid][pFunkgeraet][0] >= 3) is_in_range = true;
				else if(dist <= 1200.0 && PlayerOption[i][pFunkgeraet][0] >= 4 && PlayerOption[playerid][pFunkgeraet][0] >= 4) is_in_range = true;
				else if(dist <= 1500.0 && PlayerOption[i][pFunkgeraet][0] >= 5 && PlayerOption[playerid][pFunkgeraet][0] >= 5) is_in_range = true;
				if(is_in_range == true)
				{
					format(string,sizeof(string),"[FUNK] %s (%d): %s",PlayerInfo[playerid][pName],playerid,text);
			    	SendClientMessage(i,BLAU,string);
					to_people_sent++;
				}
	        }
	    }
	    format(string,sizeof(string),"Funk gesendet (-> %d): \"%s\"",to_people_sent,text);
	    SendClientMessage(playerid,BLAU,string);
	}
	return 1;
}

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
	if(IsPlayerNPC(playerid)) return 1;
	if(VehicleInfo[vehicleid][cIsDead])
	{
	    TogglePlayerControllable(playerid,0);
	    new Float:p[3];
	    GetPlayerPos(playerid,p[0],p[1],p[2]);
	    SetPlayerPos(playerid,p[0],p[1],p[2]);
	    TogglePlayerControllable(playerid,1);
	    return 1;
	}
	return 1;
}

public OnPlayerExitVehicle(playerid, vehicleid)
{
	if(IsPlayerNPC(playerid)) return 1;
	return 1;
}

public OnPlayerStateChange(playerid,newstate,oldstate)
{
	if(IsPlayerNPC(playerid)) return 1;
	if(newstate == PLAYER_STATE_DRIVER)
	{
	    new vehicleid = GetPlayerVehicleID(playerid);
	    if(IsVehicleConnected(vehicleid))
	    {
			if(VehicleInfo[vehicleid][cIsDead])
			{
			    RemovePlayerFromVehicle(playerid);
			    new Float:p[3];
			    GetPlayerPos(playerid,p[0],p[1],p[2]);
			    SetPlayerPos(playerid,p[0],p[1],p[2]);
			    return 1;
			}
			TextDrawShowForPlayer(playerid, tcar_FuelBackground);
			TextDrawShowForPlayer(playerid, tcar_Heading);
			car::UpdatePlayerTextdraws(playerid);
			
			if(pSpeedoObjects[playerid] != -1) DestroyPlayerObject(playerid,pSpeedoObjects[playerid]), pSpeedoObjects[playerid] = -1;
		    pSpeedoObjects[playerid] = CreatePlayerObject(playerid,19482,0.0,0.0,0.0,0.0,0.0,0.0,30.0);
		    new Float:x,Float:y,Float:z;
			GetVehicleModelInfo(GetVehicleModel(GetPlayerVehicleID(playerid)),VEHICLE_MODEL_INFO_SIZE,x,y,z);
			SetPlayerObjectMaterialText(playerid,pSpeedoObjects[playerid],"0.0 km/h",0,OBJECT_MATERIAL_SIZE_512x256,"Arial",64,true,0xFF00FF00,.textalignment=OBJECT_MATERIAL_TEXT_ALIGN_CENTER);
			AttachPlayerObjectToVehicle(playerid,pSpeedoObjects[playerid],GetPlayerVehicleID(playerid),0.0,0.0,z*0.6,0.0,0.0,270.0);
		}
	}
	else if(oldstate == PLAYER_STATE_DRIVER)
	{
		if(pSpeedoObjects[playerid] != -1) DestroyPlayerObject(playerid,pSpeedoObjects[playerid]), pSpeedoObjects[playerid] = -1;
	    for(new i; i<4; i++)
	    {
		    TextDrawHideForPlayer(playerid, tcar_StatusENG[i]);
			TextDrawHideForPlayer(playerid, tcar_StatusHUL[i]);
			TextDrawHideForPlayer(playerid, tcar_StatusWHL[i]);
			TextDrawHideForPlayer(playerid, tcar_StatusBAT[i]);
	    }
		TextDrawHideForPlayer(playerid, tcar_FuelBackground);
		TextDrawHideForPlayer(playerid, tcar_Heading);
		if(_:tcar_PLAYER_Fuel[playerid] != -1)
		{
			PlayerTextDrawHide(playerid, tcar_PLAYER_Fuel[playerid]);
			PlayerTextDrawDestroy(playerid, tcar_PLAYER_Fuel[playerid]);
		}
	}
	return 1;
}

public OnPlayerLeaveCheckpoint(playerid)
{
	if(IsPlayerNPC(playerid)) return 1;
	return 1;
}

public OnPlayerEnterRaceCheckpoint(playerid)
{
	if(IsPlayerNPC(playerid)) return 1;
	return 1;
}

public OnPlayerLeaveRaceCheckpoint(playerid)
{
	if(IsPlayerNPC(playerid)) return 1;
	return 1;
}

public OnRconCommand(cmd[])
{
	return 1;
}

public OnPlayerRequestSpawn(playerid)
{
	if(IsPlayerNPC(playerid)) return 1;
	return 1;
}

public OnObjectMoved(objectid)
{
	return 1;
}

public OnPlayerObjectMoved(playerid, objectid)
{
	if(IsPlayerNPC(playerid)) return 1;
	return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
	if(pickupid == 0 || IsPlayerNPC(playerid)) return 1;
	if(pickupid == __SERVER[TUT_PICKUP] && PlayerEvent[playerid][TutorialStep][1] == 4)
	{
   	    item::GivePlayerItem(playerid,item::GetItemByName("[Q] Milit. Medizin"),1);
		MovePlayerObject(playerid,GetPVarInt(playerid,"tutorial_gate_oid"),583.58001709,-2429.06860352,11.83831120,5.0);
	    PlayerEvent[playerid][TutorialStep][1] = 5;
		format(string,sizeof(string),"{C87E35}John Wake (Funkgerät):\n{F1F7DC}\"Alles klar, du hast die Medizin, jetzt verschwinde von dort, schnell!");
		strcat(string,"\n\n\n{878375}Hinweis:\n- Verlasse den Bunker\nGegenstand erhalten: 1x [Q] Milit. Medizin\n- Verwende /items um dein Inventar zu oeffnen");
        ShowPlayerDialog(playerid,dialog_TAKE_MEDICINE,DIALOG_STYLE_MSGBOX,"Funkverkehr mit John Wake",string,"Ok!","");
        quest::OnQuestUpdate(playerid,0,5);
        return 1;
	}
	
    if(pickupid == PublicPickup[0])
    {//Unterwelt (außen -> rein)
        if(IsPlayerInAnyVehicle(playerid) && GetPlayerVehicleSeat(playerid) == 0)
        {
            new veh = GetPlayerVehicleID(playerid);
            for(new i; i<=__SERVER[HIGHEST_PLAYER_ID]; i++)
            {
                if(IsPlayerConnected(i) && GetPlayerVehicleID(i) == veh)
                {
                    SetPlayerInterior(i,2);
                    DisplayInfobox(playerid,"Unterwelt betreten","~g~Du hast die Unterwelt betreten!",2);
                }
            }
            
            LinkVehicleToInterior(veh,2);
            VehicleInfo[veh][cVINT][1] = 2;
            SetVehiclePos(veh,471.1996,873.5583,78.2819);
			SetVehicleZAngle(veh,276.3963);
            return 1;
        }
        DisplayInfobox(playerid,"Unterwelt betreten","~r~Achtung: ~w~Du musst in einem Auto sitzen, um~n~die Unterwelt betreten zu koennen!",4);
        return 1;
    }
    else if(pickupid == PublicPickup[1])
    {
        if(IsPlayerInAnyVehicle(playerid) && GetPlayerVehicleSeat(playerid) == 0)
        {
            new veh = GetPlayerVehicleID(playerid);
            for(new i; i<=__SERVER[HIGHEST_PLAYER_ID]; i++)
            {
                if(IsPlayerConnected(i) && GetPlayerVehicleID(i) == veh)
                {
                    SetPlayerInterior(i,0);
                    DisplayInfobox(playerid,"Unterwelt verlassen","~g~Du hast die Unterwelt verlassen!",2);
                }
            }

            LinkVehicleToInterior(veh,0);
            VehicleInfo[veh][cVINT][1] = 0;
            SetVehiclePos(veh,1031.7758,2564.9998,28.7354);
			SetVehicleZAngle(veh,63.3025);
            return 1;
        }
        SetPlayerInterior(playerid,0);
        w_SetPlayerPos(playerid,1031.7758,2564.9998,28.7354,63.3025,2);
        DisplayInfobox(playerid,"Unterwelt verlassen","~g~Du hast die Unterwelt verlassen!",2);
        return 1;
    }
	for(new i; i<MAX_MUELLTONNEN; i++)
	{
		if(pickupid == Muelltonne[i][mPickup] && Muelltonne[i][mActive])
		{//Pickup ist eine Mülltonne
		    DisplayInfobox(playerid,"Muelltonne durchsuchen","~w~Du kannst diese Muelltonne mit dem Command~n~/durchsuchen nach nuetzlichen Items durchsuchen",3);
		}
	}

	for(new i; i<sizeof(OilKeypad); i++)
	{
	    if(pickupid == OilKeypad[i])
	    {
	        new questid = quest::QuestIdByName("Oelproblem");
	        if(questid == -1) break;
    		new slot = quest::PlayerQuestSlotByQuestID(playerid,questid);
    		if(slot == -1) break;
    		if(PlayerQuest[playerid][slot][qStep] >= 0)
    		{
    		    new tmpstr[30];
    		    format(tmpstr,sizeof(tmpstr),"tmp_quest_oil_%d",i);
    		    if(GetPVarInt(playerid,tmpstr) == 1)
    		    {
    		        DisplayInfobox(playerid,"~w~Pumpe aktivieren","~w~Du hast diese Pumpe schon ~g~aktiviert~w~. Suche eine~n~andere Anlage zum aktivieren.",3,false);
    		        return 1;
    		    }
      		    SetPVarInt(playerid,tmpstr,1);
      		    quest::OnQuestUpdate(playerid,questid,(PlayerQuest[playerid][slot][qStep]+1));
      		    return 1;
    		}
	    }
	}
	
	for(new pickup=1; pickup<(MAX_DEVELOPER_PICKUPS+1); pickup++)
	{
		if(pickupid == __PICKUP[pickup])
		{
		    if(!(PlayerEvent[playerid][DevComment][0] & (1<<pickup)))
		    {
		        PlayerEvent[playerid][DevComment][0] += (1<<pickup);
		        PlayerEvent[playerid][DevComment][1] += 1;
		        SetPVarInt(playerid,"devc_new",1);
		        mysql_SetIntByInt("pnwl_user_event","devcomment",PlayerEvent[playerid][DevComment][0],"userid",PlayerInfo[playerid][PLAYER_ID]);
		        ShowPlayerDevComment(playerid,pickup);

 				if(PlayerEvent[playerid][DevComment][1] >= MAX_DEVELOPER_PICKUPS)
				{//Hat alle
					new am_id = __amCache[amEntwicklungshelfer];
					if(am_id != -1) achievement::SetPlayerAchievementData(playerid,am_id,1,true);
					format(query,sizeof(query),"Herzlichen Glückwunsch, du hast alle %d Entwicklerkommentare gefunden!",MAX_DEVELOPER_PICKUPS);
					SendClientMessage(playerid,GRUEN,query);
				}
		    }
		}
	}
	return 1;
}

public OnVehicleMod(playerid, vehicleid, componentid)
{
	if(IsPlayerNPC(playerid)) return 1;
	return 1;
}

public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
    if(IsPlayerNPC(playerid)) return 1;
	return 0;
}

public OnVehicleRespray(playerid, vehicleid, color1, color2)
{
    if(IsPlayerNPC(playerid)) return 1;
    ChangeVehicleColor(vehicleid,VehicleInfo[vehicleid][cColor][0],VehicleInfo[vehicleid][cColor][1]);
	return 0;
}

public OnPlayerSelectedMenuRow(playerid, row)
{
	if(IsPlayerNPC(playerid)) return 1;
	return 1;
}

public OnPlayerExitedMenu(playerid)
{
	if(IsPlayerNPC(playerid)) return 1;
	return 1;
}

public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
    FCNPC_UnlinkFollowers(playerid);
	if(IsPlayerNPC(playerid)) return 1;
	return 1;
}

public OnPlayerKeyStateChange(playerid,newkeys,oldkeys)
{
	if(IsPlayerNPC(playerid))					return 1;
	if(!PlayerEvent[playerid][LOGGED_IN])       return 1;
    if(PlayerInfo[playerid][pScreenHide] >= 1)	return 1;
    if(PlayerCamera[playerid][camMoving])       return 1;
    new keys,ud,lr;
    GetPlayerKeys(playerid,keys,ud,lr);

    if(GetPVarInt(playerid,"skinauswahl") == 1)
    {
        printf("skinauswahl");
	    DeletePVar(playerid,"skinauswahl");
		new __LIST[MAX_GENERATED_SKINS];
        new skin = GenerateSkinList(playerid,__LIST,GetPVarInt(playerid,"skinauswahl_selected_offset"));
		SetPlayerSkin(playerid,skin);
		mysql_SetIntByInt("pnwl_user_option","skin",skin,"userid",PlayerInfo[playerid][PLAYER_ID]);
		print("test");
	    if(Currentstep[playerid] != 0)
		{
		    //Spieler ist im Tutorial
			MovePlayerCamera(playerid,Float:{-2170.8876,980.1259,-3.5658},Float:{-2139.3183,980.2666,-3.6778},0.1); //c2 zu c3
			PlayAudioStreamForPlayer(playerid,#SOUND_PATH"/misc/intro.mp3");
			HideInfoMessage(playerid);
		}
		else if(PlayerInfo[playerid][IsInCRoom] == 1)
		{
		    //Spieler ist im CRaum
		    ShowInfoMessage(playerid,"Optionen~<~Skinauswahl~>~Spawn~n~ENTER = Bestaetigen");
		}
		else print("FATALER FEHLER OPKSCSKINAUSWAHL");
		return 1;
    }
	if(PlayerInfo[playerid][IsInCRoom] == 1)
	{
		if(oldkeys == KEY_SECONDARY_ATTACK)
		{
		    switch(cam_Ort[playerid])
		    {
		        case 0:
		        {
					PlayerInfo[playerid][IsInCRoom] = 2;//Damit der Spawn validiert wird
		            OnPlayerSpawn(playerid);//Spawn des Spielers
		            return 1;
		        }
		        case 1:
		        {//karte
		            /*
						0 = noob spawn
						1 = log spawn
						2 = haus spawn
						3 = fraktions spawn
						4 = crash spawn
						5 = tot spawn
		            */
		            new spawn_loop = 0;
		            if(PlayerOption[playerid][SelectedSpawn] == 0) format(string,sizeof(string),"{77AE35}==> Hotel in Fort Carson");
		            else format(string,sizeof(string),"{F1F7DC}Hotel in Fort Carson");
					CSpawn[playerid][spawn_loop] = 0;
					spawn_loop++;
					
					if(PlayerInfo[playerid][Fraktion] == 1)
					{//Armee
			        	if(PlayerOption[playerid][SelectedSpawn] == 3) 	strcat(string,"\n{77AE35}==> Basis der Armee");
			        	else 											strcat(string,"\n{F1F7DC}Basis der Armee");
			        	CSpawn[playerid][spawn_loop] = 3;
			        	spawn_loop++;
					}
					if(PlayerInfo[playerid][Fraktion] == 2)
					{//Infizierte
			        	if(PlayerOption[playerid][SelectedSpawn] == 3) 	strcat(string,"\n{77AE35}==> Basis der Infizierten");
			        	else 											strcat(string,"\n{F1F7DC}Basis der Infizierten");
			        	CSpawn[playerid][spawn_loop] = 3;
			        	spawn_loop++;
					}
					
		            if(PlayerInfo[playerid][ConnectedTimes] >= 1 && GetPVarInt(playerid,"first_connection") == 0)
		            {
			            if(PlayerOption[playerid][SelectedSpawn] == 1) strcat(string,"\n{77AE35}==> Letzte Position");
			            else 											strcat(string,"\n{F1F7DC}Letzte Position");
						CSpawn[playerid][spawn_loop] = 1;
						spawn_loop++;
		            }
		            if(PlayerOption[playerid][Crashed] == 1)
		            {
			            if(PlayerOption[playerid][SelectedSpawn] == 4) 	strcat(string,"\n{77AE35}==> Crashed Position");
			            else 											strcat(string,"\n{F1F7DC}Crashed Position");
						CSpawn[playerid][spawn_loop] = 4;
						spawn_loop++;
		            }
			        if(PlayerOption[playerid][HouseSelect] != -1)
			        {
			            if(PlayerOption[playerid][SelectedSpawn] == 2) format(string,sizeof(string),"%s\n{77AE35}==> Haus (ID %d)",string,PlayerOption[playerid][HouseSelect]);
			            else format(string,sizeof(string),"%s\n{F1F7DC}Haus (ID %d)",string,PlayerOption[playerid][HouseSelect]);
						CSpawn[playerid][spawn_loop] = 2;
						spawn_loop++;
			        }
		            ShowPlayerDialog(playerid,dialog_SELECT_SPAWN_MAIN,DIALOG_STYLE_LIST,"{F1F7DC}Spawn auswählen",string,"Auswählen","Beenden");
		            return 1;
		        }
		        case 2:
		        {//achievements
		            achievement::ShowPlayerAchievementList(playerid,am_PlayerCache[playerid][am_page]);
		            return 1;
		        }
		        case 3:
		        {//statistik
		            ShowPlayerDialog(playerid,dialog_NULL,DIALOG_STYLE_MSGBOX,"{F1F7DC}Statistiken","{F1F7DC}Diese Funktion ist noch nicht verfügbar.","Zurück","");
		            return 1;
		        }
		        case 4:
		        {//sammelobjekte
		            format(string,sizeof(string),"{F1F7DC}Entwicklerkommentare (%d/%d)",PlayerEvent[playerid][DevComment][1],MAX_DEVELOPER_PICKUPS);
					ShowPlayerDialog(playerid,dialog_CROOM_SI_MAIN,DIALOG_STYLE_LIST,"{F1F7DC}Sammelobjekte",string,"Ok","Zurück");
					return 1;
		        }
		        case 5:
		        {//einstellungen
		            OnDialogResponse(playerid,dialog_OPTION_SET,0,0,"");
		            return 1;
		        }
		        case 6:
		        {//skinauswahl
					Skinauswahl(playerid);
					return 1;
		        }
		    }
		}
	}
	else
	{
		if(oldkeys == KEY_WALK && newkeys == 0)
		{
		    printf("reloading = %d",GetPVarInt(playerid,"_reloading"));
		    if(GetPVarInt(playerid,"_reloading") == 0)
		    {
		        new w = 0,slot,cammo = 0;
				w = GetPlayerWeapon(playerid);
				if(w <= 2)
				{
				    printf("slot = %d",PlayerCurrentWeaponSlot[playerid]);
				    if(PlayerCurrentWeaponSlot[playerid] == 2 || PlayerCurrentWeaponSlot[playerid] == 3)
					{
						w = PlayerWeapon[playerid][PlayerCurrentWeaponSlot[playerid]][wWeaponID];
						printf("w = %d",w);
					}
				}
				else
				{
					cammo = GetPlayerAmmo(playerid);
					PlayerWeapon[playerid][PlayerCurrentWeaponSlot[playerid]][wMagAmmo] = cammo;
				}
				if(w != 0)
				{
					slot = gun_SlotByID(w);
			    	if((ud == 0 && lr == 0) || CanReloadWhileMoving(playerid,w))
			    	{
			    	    new clipsize = GetWeaponClipsize(playerid,w);
						if(clipsize >= 1)
						{
						    printf("cammo = %d",cammo);
						    printf("clipsize = %d",clipsize);
						    if(cammo >= clipsize)
						    {//Magazin bereits voll
						    }
						    else
						    {
						        new ammo_storage = gun_GetAmmoStorage(playerid,w),
									reload_ammo = (ammo_storage>=(clipsize-cammo))?(clipsize-cammo):ammo_storage;
					        	PlayerWeapon[playerid][slot][wMagAmmo] = cammo;//Im Magazin
								if(reload_ammo >= 1)
								{
								    printf("reload_ammo = %d",reload_ammo);
									ammo_storage -= reload_ammo;
									PlayerWeapon[playerid][slot][wMagAmmo] += reload_ammo;
									SetPVarInt(playerid,"_reloading",1);
									SetPlayerArmedWeapon(playerid,0);
									ResetPlayerWeapons(playerid);
									GivePlayerWeapon(playerid,w,PlayerWeapon[playerid][slot][wMagAmmo]);
									PlayerCache[playerid][current_weapon_id] = w;
									SetPlayerArmedWeapon(playerid,w);
									SetPVarInt(playerid,"_reloading_w",w);
									gun_UpdateAmmoDisplay(playerid,ammo_storage);
									ApplyAnimation(playerid,"UZI","UZI_reload",4.1,0,1,1,0,0,1);
									SetTimerEx("pevent_ReloadFinished",1500,false,"dd",playerid,w);
									gun_GivePlayerAmmo(playerid,w,-reload_ammo);
								}
							}
						}
					}
				}
			}
		}
	    else if(GetPVarInt(playerid,"pev_train") != 0)
	    {
			if(newkeys == KEY_SPRINT)
			{
				switch(GetPVarInt(playerid,"pev_train"))
				{
					case 1:
					{//Fahrrad
						SetPVarInt(playerid,"pev_train_ticks",GetPVarInt(playerid,"pev_train_ticks")+1);
					}
					case 2:
					{//Laufband
						SetPVarInt(playerid,"pev_train_ticks",GetPVarInt(playerid,"pev_train_ticks")+1);
					}
					case 3:
					{//Hanteln
						SetPVarInt(playerid,"pev_train_ticks",GetPVarInt(playerid,"pev_train_ticks")+1);
					}
				}
			}
			else if(newkeys == KEY_SECONDARY_ATTACK) return ncom_trainieren(playerid);//Beenden
			return 1;
	    }
	    else if(GetPVarInt(playerid,"pev_training_fightstyle_step") >= 1)
	    {
	        if(GetPVarInt(playerid,"pev_train_abkling") != 0) return 1;
	    	switch(GetPVarInt(playerid,"pev_training_fightstyle_step"))
	    	{
	    	    case 1:
	    	    {//Blocken
	    	        if(oldkeys == (KEY_AIM | KEY_JUMP))
					{
					    SetPVarInt(playerid,"pev_training_fightstyle_value",10);
					    DisplayInfobox(playerid,"Training: ~r~Abwehr","~w~Gehe ~r~10~w~ Sekunden lang in die Abwehrposition.~n~=> Tastenkombo: ~g~RMB~w~+~g~LSHIFT");
					}
	    	    }
	    	    case 2:
	    	    {//Schlagen
	    	        if(newkeys == KEY_FIRE || newkeys == (KEY_FIRE | KEY_AIM))
	    	        {
	    	            new fvalue = GetPVarInt(playerid,"pev_training_fightstyle_value");
	    	            if(++fvalue == 10)
	    	            {
	    	                SetPVarInt(playerid,"pev_training_fightstyle_step",3);
	    	                HideInfobox(playerid);
	    	                SetPVarInt(playerid,"pev_training_fightstyle_value",0);
                            DisplayInfobox(playerid,"Training: ~r~Angriff 2","~w~Greife den Boxsack ~r~10~w~ mal mit einem ~n~schweren Angriff an.~n~=> Tastenkombo: ~g~RMB~w~+~g~F~w~");
						    format(string,sizeof(string),"{C87E35}Chuck (Kampfsportler):\n\"{F1F7DC}\
						    Sehr schön! Jetzt kommen die etwas stärkeren Angriffe. Greife den Boxsack\n\
							zehn (10) mal mit einem schweren Angriff an, indem du dich vor ihn stellst,\n\
							die linke Maustaste drückst und dann die Taste \"F\" antippst.{C87E35}\"");
						    ShowPlayerDialog(playerid,dialog_NULL,DIALOG_STYLE_MSGBOX,"{C87E35}Gespräch mit Chuck",string,"Weiter","");
							SetPlayerPos(playerid,-1471.5801,2614.0835,41.5738);
							SetPlayerFacingAngle(playerid,272.6473);
							SetCameraBehindPlayer(playerid);
	    	                return 1;
	    	            }
	    	            format(string,sizeof(string),"~w~Schlage den Boxsack ~r~%d~w~ mal im Stand~n~=> Tastenkombo: ~g~LMB",(10-fvalue));
	    	            DisplayInfobox(playerid,"Training: ~r~Angriff 1",string);
	    	            SetPVarInt(playerid,"pev_training_fightstyle_value",fvalue);
	    	            SetPVarInt(playerid,"pev_train_abkling",1);
	    	        }
	    	    }
	    	    case 3:
	    	    {//Treten
					if(newkeys == (KEY_AIM | KEY_SECONDARY_ATTACK))
					{
	    	            new fvalue = GetPVarInt(playerid,"pev_training_fightstyle_value");
	    	            if(++fvalue == 10)
	    	            {
	    	                SetPVarInt(playerid,"pev_training_fightstyle_step",4);
	    	                HideInfobox(playerid);
	    	                SetPVarInt(playerid,"pev_training_fightstyle_value",0);
	    	                DisplayInfobox(playerid,"Training: ~r~Bewegungsangriff","~w~Greife den Boxsack ~r~5~w~ mal mit~n~einer Bewegungsattacke an.~n~=> Tastenkombo: ~g~W~w~+~g~RMB~w~+~g~F~w~");
	    	                
						    format(string,sizeof(string),"{C87E35}Chuck (Kampfsportler):\n\"{F1F7DC}\
						    Ausgezeichnet! Zum Schluss kombiniert man das erlernte und wendet es\n\
							während der Bewegung an. Laufe dazu mit \"W\" auf deinen Gegner zu, halte\n\
							die rechts Maustaste \"RMB\" und tippe zum Angriff \"F\" an.{C87E35}\"");
						    ShowPlayerDialog(playerid,dialog_NULL,DIALOG_STYLE_MSGBOX,"{C87E35}Gespräch mit Chuck",string,"Weiter","");

							SetPlayerPos(playerid,-1471.5801,2614.0835,41.5738);
							SetPlayerFacingAngle(playerid,272.6473);
							SetCameraBehindPlayer(playerid);
	    	                return 1;
	    	            }
	    	            format(string,sizeof(string),"~w~Greife den Boxsack ~r~%d~w~ mal mit einem ~n~schweren Angriff.~n~=> Tastenkombo: ~g~RMB~w~+~g~F~w~",(10-fvalue));
                        DisplayInfobox(playerid,"Training: ~r~Angriff 2",string);
	    	            SetPVarInt(playerid,"pev_training_fightstyle_value",fvalue);
	    	            SetPVarInt(playerid,"pev_train_abkling",1);
					}
	    	    }
	    	    case 4:
	    	    {
	    	        if(newkeys == (KEY_AIM | KEY_SECONDARY_ATTACK) && ud == -128)
	    	        {
	    	            new fvalue = GetPVarInt(playerid,"pev_training_fightstyle_value");
	    	            if(++fvalue == 5)
	    	            {
	    	                DeletePVar(playerid,"pev_training_fightstyle_step");
	    	                DeletePVar(playerid,"pev_training_fightstyle_value");
	    	                HideInfobox(playerid);
						    format(string,sizeof(string),"{C87E35}Chuck (Kampfsportler):\n\"{F1F7DC}\
						    Super! Du bist nun in die Geheimnisse des ");
							switch(GetPVarInt(playerid,"cache_fightstyle"))
							{
							    case 0:		strcat(string,"normalen Kampfes");
							    case 1:		strcat(string,"Boxkampfes");
							    case 2:     strcat(string,"Kung Fu");
	   							case 3:     strcat(string,"Kneehead");
	   							case 4:     strcat(string,"Grabkick");
	   							case 5:     strcat(string,"Elbow");
							    default:    strcat(string,"normalen Kampfes");
							}
							strcat(string," eingeweiht. Setze die\n\
							dieses Wissen ein um diesen Mutanten den Arsch auf zu reißen!{C87E35}\"");
						    ShowPlayerDialog(playerid,dialog_NULL,DIALOG_STYLE_MSGBOX,"{C87E35}Gespräch mit Chuck",string,"Weiter","");
						    SendClientMessage(playerid,-1,#FORMAT_CHAT_INFO"Du hast eine neue Kampftechnik erlernt");
						    new style[] = {4,5,6,15,16};
						    if(GetPVarInt(playerid,"cache_fightstyle") >= 0 && GetPVarInt(playerid,"cache_fightstyle") < sizeof(style))
							{
								SetPlayerFightingStyle(playerid,style[GetPVarInt(playerid,"cache_fightstyle")]);
								PlayerOption[playerid][FightingStyle] = style[GetPVarInt(playerid,"cache_fightstyle")];
								mysql_SetIntByInt("pnwl_user_option","fightingstyle",PlayerOption[playerid][FightingStyle],"userid",PlayerInfo[playerid][PLAYER_ID]);
						    }
						    fixed_SetPlayerWorldBounds(playerid,-20000.0,20000.0,-20000.0,20000.0);
							SetPlayerPos(playerid,-1465.6041,2609.8149,40.6853);
							SetPlayerFacingAngle(playerid,310.0);
							SetCameraBehindPlayer(playerid);
							return 1;
						}
	    	            format(string,sizeof(string),"~w~Greife den Boxsack ~r~%d~w~ mal mit~n~einer Bewegungsattacke an.~n~=> Tastenkombo: ~g~W~w~+~g~RMB~w~+~g~F~w~",(5-fvalue));
                        DisplayInfobox(playerid,"Training: ~r~Bewegungsangriff",string);
	    	            SetPVarInt(playerid,"pev_training_fightstyle_value",fvalue);
	    	            SetPVarInt(playerid,"pev_train_abkling",1);
	    	        }
	    	    }
	    	}
	    	return 1;
	    }
		if(PlayerEvent[playerid][IstTot] == 0)
		{
		    if(newkeys == KEY_SECONDARY_ATTACK)
		    {
				if((PlayerCache[playerid][holding_item] >= 1 && PlayerCurrentWeaponSlot[playerid] == 0) || (PlayerCache[playerid][equip_fist_item] >= 1 && PlayerCurrentWeaponSlot[playerid] == 1))
				{
				    new itemid = (PlayerCache[playerid][holding_item] >= 1 && PlayerCurrentWeaponSlot[playerid] == 0)?PlayerCache[playerid][holding_item]:PlayerCache[playerid][equip_fist_item];
					if(item_ItemInfo[itemid][iAction] & canUse || item_ItemInfo[itemid][iAction] & canInteract)
					{
					    format(string,sizeof(string),"item_Interact_%s",item::ConvertNameToFunc(itemid),string);
					    new result = CallRemoteFunction(string,"d",playerid);
					    if(result)
					    {
				            SetPVarInt(playerid,"holding_f_iFAct",1);
				            SetPVarInt(playerid,"holding_f_iFAct_item",itemid);
					    }
					}
				}
		    }
		    if(oldkeys == KEY_SECONDARY_ATTACK)
		    {//ENTER
		        if(GetPVarInt(playerid,"holding_f_iFAct") >= 1)
		        {
		            item::StopPlayerInteract(playerid);
		            return 1;
		        }
		        ncom_trainieren(playerid);
				if(GetPVarInt(playerid,"waffenladen") == 1)
				{
			        new wpreis = waffenpreis[GetPVarInt(playerid,"waffe")];
			        if(PlayerNPC[playerid][NPC_DIMITRY][cash] >= wpreis)
			        {//Hat genug Items gegeben
			            format(string,sizeof(string),#SOUND_PATH"/npc/dimitry/kaufen/k%d-128k.mp3",random(8));
			            aPlayAudioStreamForPlayer(playerid,string);
			            switch(GetPVarInt(playerid,"waffe"))
			            {
							case 0: { format(string,sizeof(string),"Gewehr"); 		fixed_GivePlayerWeapon(playerid,33,50); }
							case 1: { format(string,sizeof(string),"Sniper"); 		fixed_GivePlayerWeapon(playerid,34,50); }
							case 2: { format(string,sizeof(string),"AK-47"); 		fixed_GivePlayerWeapon(playerid,30,50); }
							case 3: { format(string,sizeof(string),"M4"); 			fixed_GivePlayerWeapon(playerid,31,50); }
							case 4: { format(string,sizeof(string),"Schrotgewehr"); fixed_GivePlayerWeapon(playerid,25,50); }
							case 5: { format(string,sizeof(string),"SawnOff"); 		fixed_GivePlayerWeapon(playerid,26,50); }
							case 6: { format(string,sizeof(string),"9mm Pistole"); 	fixed_GivePlayerWeapon(playerid,22,50); }
							case 7: { format(string,sizeof(string),"Desert Eagle"); fixed_GivePlayerWeapon(playerid,24,50); }
			            }
			            format(string,sizeof(string),"{C87E35}Du hast eine \"%s\" gekauft.",string);
	                    ShowPlayerDialog(playerid,dialog_NPC_WAFFENDEALER_KAUF,DIALOG_STYLE_LIST,string,"{F1F7DC}Laden verlassen\nWeiter einkaufen","Weiter","");
	                    PlayerNPC[playerid][NPC_DIMITRY][cash] -= wpreis;

						new am_id = __amCache[amWarlord];
						if(am_id != -1) achievement::SetPlayerAchievementData(playerid,am_id,1,true);
			        }
			        else
			        {//Hat nicht genug Items gegeben
			            format(string,sizeof(string),#SOUND_PATH"/npc/dimitry/zuwenig/n%d-128k.mp3",random(5));
			            aPlayAudioStreamForPlayer(playerid,string);
			            format(string,sizeof(string),"{F1F7DC}Andere Waffen angucken\nItems bieten\nFeilschen (Wortgewandheit %d)\nEinschüchtern (Stärke %d)\nShop verlassen",floatround(PlayerSkill[playerid][SkillWortgewandt]),floatround(PlayerSkill[playerid][SkillKraft]));
			            format(query,sizeof(query),"{C87E35}Du bietest Dimitry zu wenig (%d/%d)",PlayerNPC[playerid][NPC_DIMITRY][cash],wpreis);
			            ShowPlayerDialog(playerid,dialog_NPC_WAFFENDEALER_WENIG,DIALOG_STYLE_LIST,query,string,"Ok","");
			        }
			        return 1;
			    }
				else if(GetPVarInt(playerid,"hosp_cam") == 1)
				{
				    if(!PlayerCamera[playerid][camMoving])
				    {
					    switch(cam_Ort[playerid])
					    {
					        case 1:
							{//Wiederbelebung
							    if(PlayerEvent[playerid][Training] & CanRevive)
							    {
							    	format(string,sizeof(string),"{C87E35}Dr. Riviera (Arzt):\n\"{F1F7DC}\
									Du hast dieses Training schon absolviert. Wie bereits gesagt,\n\
									hocke dich neben die Todesstelle eines verstorbenen Spielers\n\
									und benutze den Command \"/revive\" um diesen zu reanimieren.");
									strcat(string,"\n\
									Damit untersuchst du die Todesursache. Aufgrund dessen musst\n\
									du dann die passende Behandlungsmethode auswählen, mit der\n\
									der Patient zurück ins Reich der Lebenden geholt werden soll.{C87E35}\"");
							        ShowPlayerDialog(playerid,dialog_NULL,DIALOG_STYLE_MSGBOX,"{C87E35}Gespräch mit Dr. Riviera",string,"Nein","Ja");
							    }
							    else
							    {
							    }
							}
							case 3:
							{//Medizin
							    if(PlayerEvent[playerid][Training] & CanCureDisease)
							    {
							    }
							    else
							    {
							    }
							}
					        case 5:
							{//Operation
							    if(PlayerEvent[playerid][Training] & CanHeal)
							    {
							    	format(string,sizeof(string),"{C87E35}Dr. Riviera (Arzt):\n\"{F1F7DC}\
									Du hast dieses Training schon absolviert. Wie bereits gesagt,\n\
									stelle dich einfach neben einen anderen Spieler und benutze\n\
									den Command \"/heilen [ID]\" um diesen zu heilen.");
									strcat(string," Dabei verlierst\n\
									du selber ein wenig Energie aber je höher dein Medizinskill ist,\n\
									desto mehr erhält der andere Spieler und desto weniger HP\n\
									verliert dein Charakter.{C87E35}\"");
							        ShowPlayerDialog(playerid,dialog_NULL,DIALOG_STYLE_MSGBOX,"{C87E35}Gespräch mit Dr. Riviera",string,"Nein","Ja");
							    }
							    else
							    {
							    	format(string,sizeof(string),"{C87E35}Dr. Riviera (Arzt):\n\"{F1F7DC}\
									Wunderbar, dass du dich für das operative Training interessierst!\n\
									Mit dem Abschluss ist es möglich einen Anteil der eigenen HP\n\
									zu opfern um einen anderen Spieler einen größeren Teil zu geben.\n\
									Je höher dein Medizinskill ist, desto weniger Energie verlierst\n\
									du bei der Aktion und desto mehr HP erhält der Spieler,");
									format(string,sizeof(string),"%s den du\n\
									operierst.\nMöchtest du das Training absolvieren?{C87E35}\"\n\n\n{878375}\
									Hinweies:\n\
									- Kosten des Trainings: 5000 (%d gezahlt)\
									- Prüfung: \t\t\t\tKeine",\
							        string,PlayerNPC[playerid][NPC_NICK][cash]);
							        ShowPlayerDialog(playerid,dialog_NULL,DIALOG_STYLE_MSGBOX,"{C87E35}Gespräch mit Dr. Riviera",string,"Ja","Nein");
							    }
							}
				     	}
						//HideInfoMessage(playerid);
					}
					return 1;
				}
				else if(GetPVarInt(playerid,"pizzaladen") == 1)
				{//KAUFEN
					new g_preis = food_PizzaMenu[GetPVarInt(playerid,"menue")][mpreis];
	    			if(PlayerNPC[playerid][NPC_JOE][cash] > g_preis)
	    			{//Genug
	    			    if(PlayerStatus[playerid][Hunger] > 0.0)
	    			    {//kann essen
		    			    ApplyAnimation(playerid,"FOOD","EAT_Burger",3.0,0,0,0,0,0);
		    			    PlayerStatus[playerid][Hunger] -= food_PizzaMenu[GetPVarInt(playerid,"menue")][mhunger];
		    			    if(PlayerStatus[playerid][Hunger] < 0.0) PlayerStatus[playerid][Hunger] = 0.0;
		    			    PlayerStatus[playerid][Durst] -= food_PizzaMenu[GetPVarInt(playerid,"menue")][mdurst];
		    			    if(PlayerStatus[playerid][Durst] < 0.0) PlayerStatus[playerid][Durst] = 0.0;

		    			    PlayerNPC[playerid][NPC_JOE][cash] -= g_preis;
		    			    TogglePlayerControllable(playerid,true);
		    			    SetCameraBehindPlayer(playerid);
		    			    UpdatePlayerShopScreen(playerid,SHOPSCREEN_PIZZA,false);
		    			    ApplyAnimation(playerid,"FOOD","EAT_Burger",3.0,0,0,0,0,0);
							new am_id = __amCache[amVielfrass];
							if(am_id != -1) achievement::SetPlayerAchievementData(playerid,am_id,1,true);
	    			    }
	    			    else
	    			    {//kann nicht essen
	    			    	GameTextForPlayer(playerid,"~w~Du hast ~r~keinen ~w~Hunger",2000,5);
	    			    	ClearAnimations(playerid);
	    			    	ApplyAnimation(playerid,"PED","IDLE_CHAT",4.0,0,0,0,0,1);
	    			    }
	    			}
	    			else
	    			{//zu wenig
			            format(string,sizeof(string),"{F1F7DC}Andere Gerichte angucken\nItems bieten\nFeilschen (Wortgewandheit %d)\nEinschüchtern (Stärke %d)\nShop verlassen",floatround(PlayerSkill[playerid][SkillWortgewandt]),floatround(PlayerSkill[playerid][SkillKraft]));
			            format(query,sizeof(query),"{C87E35}Du bietest Joe zu wenig (%d/%d)",PlayerNPC[playerid][NPC_JOE][cash],g_preis);
			            ShowPlayerDialog(playerid,dialog_NPC_PIZZA_WENIG,DIALOG_STYLE_LIST,query,string,"Ok","");
    			    	ClearAnimations(playerid);
    			    	ApplyAnimation(playerid,"PED","IDLE_CHAT",4.0,0,0,0,0,1);
					}
				    return 1;
				}
				else if(GetPVarInt(playerid,"EX_autohaus_in") == 1)
				{//autohaus verlassen
					autohaus_OnLeavePlayerAH(playerid);
				    autohaus_ResetToJason(playerid);
					SetPVarInt(playerid,"EX_autohaus_in",0);
					SetPVarInt(playerid,"EX_autohaus_nr",0);
					SetPVarInt(playerid,"EX_autohaus_showing",0);
					DeletePVar(playerid,"EX_autohaus_showing");
					DeletePVar(playerid,"EX_autohaus_in");
					DeletePVar(playerid,"EX_autohaus_nr");
					DeletePVar(playerid,"EX_autohaus_car");
					DeletePVar(playerid,"EX_autohaus_watchpos");
					TogglePlayerControllable(playerid,true);
					HidePlayerDialog(playerid);
					SetCameraBehindPlayer(playerid);
					return 1;
				}
				else if(GetPVarInt(playerid,"liq_store") == 1)
				{
				    return 1;
				}
				
				if(IsPlayerInRangeOfPoint(playerid,3.0,373.6715,-119.2490,1001.4922))//Pizza man FC
				{//Gespräch mit dem Pizzamann Joe
				    EndMedicalTreatment(playerid);
				    OnDialogResponse(playerid, dialog_NPC_PIZZA_MAIN, 1,-1, "");//Hauptmenü öffnen
			    	ClearAnimations(playerid);
			    	ApplyAnimation(playerid,"PED","IDLE_CHAT",4.0,0,0,0,0,1);
				    return 1;
				}
				for(new ah_id; ah_id<EX_MAX_AUTOHOUSES; ah_id++)
				{//@pnwl_cars->pnwl_EX_autohaus
					if(IsPlayerInRangeOfPoint(playerid,2.0,AutohausBotPos[ah_id][0],AutohausBotPos[ah_id][1],AutohausBotPos[ah_id][2]) && GetPVarInt(playerid,"EX_autohaus_in") == 0 && GetPVarInt(playerid,"EX_autohaus_showing") == 0)
					{
					    SetPVarInt(playerid,"EX_autohaus_nr",ah_id);
					    EndMedicalTreatment(playerid);
						autohaus_DisplayMainDialog(playerid);
						return 1;
					}
				}
				if(IsPlayerInRangeOfPoint(playerid,1.0,-172.4694,1163.9000,87.5824))
				{
	    			if(PlayerInfo[playerid][Fraktion] == 0 || PlayerInfo[playerid][Fraktion] == 1)
	    			{
					    EndMedicalTreatment(playerid);
					    new welcome_sound = random(6);
			            ShowPlayerDialog(playerid,dialog_NPC_WAFFENDEALER_MAIN,DIALOG_STYLE_LIST,"{C87E35}Gespräch mit Dimitry","{F1F7DC}Waffen ansehen\nAuf Wiedersehen","Ok","Bye");
						format(string,sizeof(string),#SOUND_PATH"/npc/dimitry/willkommen/w%d-128k.mp3",welcome_sound);
			            aPlayAudioStreamForPlayer(playerid,string);
    			    	ClearAnimations(playerid);
    			    	ApplyAnimation(playerid,"PED","IDLE_CHAT",4.0,0,0,0,0,1);
			            return 1;
			        }
					ShowPlayerDialog(playerid,dialog_NULL,DIALOG_STYLE_MSGBOX,"{F1F7DC}Gespräch mit Dimitry","{C87E35}Dimitry:\n\"{F1F7DC}Was willst du hier, Abschaum?{C87E35}\"\n\n\n{878375}Hinweis: Der NPC möchte nicht mit dir sprechen","Zurück","");
		            return 1;
				}
				if(IsPlayerInRangeOfPoint(playerid,1.0,-233.8613,2619.1128,62.9020))
				{
				    EndMedicalTreatment(playerid);
		            OnDialogResponse(playerid,dialog_NPC_MATHEO_MAINRE,1,0,"");//Hauptmenü öffnen
			    	ClearAnimations(playerid);
			    	ApplyAnimation(playerid,"PED","IDLE_CHAT",4.0,0,0,0,0,1);
		            return 1;
				}
				if(IsPlayerInRangeOfPoint(playerid,4.0,-223.1800,1406.0132,27.7734))//UFO BAR BARKEEPER
				{//Gespräch mit dem Barkeeper in der UFOBar
				    EndMedicalTreatment(playerid);
				    OnDialogResponse(playerid, dialog_NPC_BARKEEPER_UFO_MAIN, 1,-1, "");//Hauptmenü öffnen
			    	ClearAnimations(playerid);
			    	ApplyAnimation(playerid,"PED","IDLE_CHAT",4.0,0,0,0,0,1);
				    return 1;
				}
	            if(IsPlayerInRangeOfPoint(playerid,3.0,-838.3779,2762.0925,46.0000))//indianer
				{//Gespräch mit dem Indianerleiter
				    EndMedicalTreatment(playerid);
			    	ClearAnimations(playerid);
			    	ApplyAnimation(playerid,"PED","IDLE_CHAT",4.0,0,0,0,0,1);
					return 1;
				}
	            if(IsPlayerInRangeOfPoint(playerid,3.0,-677.3391,940.6191,12.9519))//travis holzfäller
				{//Gespräch mit dem job holzfäller
				    EndMedicalTreatment(playerid);
				    OnDialogResponse(playerid,dialog_NPC_TRAVIS_MAINRE,1,0,"");
			    	ClearAnimations(playerid);
			    	ApplyAnimation(playerid,"PED","IDLE_CHAT",4.0,0,0,0,0,1);
					return 1;
				}
				if(IsPlayerInRangeOfPoint(playerid,2.0,-210.8343,1116.7026,123.7506))
				{//Gespräch mit dem Bürgermeister "Richard"
				    EndMedicalTreatment(playerid);
	    			OnDialogResponse(playerid,dialog_NPC_RICHARD_MAINRE,1,0,"");
			    	ClearAnimations(playerid);
			    	ApplyAnimation(playerid,"PED","IDLE_CHAT",4.0,0,0,0,0,1);
		            return 1;
				}
				if(IsPlayerInRangeOfPoint(playerid,2.0,2864.8806,-259.7420,52.7608))
				{//Gespräch mit dem Arzt "Dr. Nick Riviera"
				    EndMedicalTreatment(playerid);
	    			OnDialogResponse(playerid,dialog_NPC_NICK_MAINRE,1,0,"");
			    	ClearAnimations(playerid);
			    	ApplyAnimation(playerid,"PED","IDLE_CHAT",4.0,0,0,0,0,1);
		            return 1;
				}
				if(IsPlayerInRangeOfPoint(playerid,2.0,-216.0638,1115.6230,120.2511))
				{//Gespräch mit der küchenhilfe "wilfried" in der stadthalle (fc)
				    EndMedicalTreatment(playerid);
	    			if(PlayerInfo[playerid][Fraktion] == 0 || PlayerInfo[playerid][Fraktion] == 1) OnDialogResponse(playerid,dialog_NPC_WILFRIED_MAINRE,1,0,"");
					else ShowPlayerDialog(playerid,dialog_NULL,DIALOG_STYLE_MSGBOX,"{F1F7DC}Gespräch mit Wilfried","{C87E35}Wilfried (Küchengehilfe):\n\"{F1F7DC}Was willst du denn hier? Ich rede nur mit Einwohnern von\nFort Carson!{C87E35}\"\n\n\n{878375}Hinweis: Der NPC möchte nicht mit dir sprechen","Zurück","");
			    	ClearAnimations(playerid);
			    	ApplyAnimation(playerid,"PED","IDLE_CHAT",4.0,0,0,0,0,1);
		            return 1;
		        }
				if(IsPlayerInRangeOfPoint(playerid,2.0,-149.4137,1902.9531,43.3191))
				{//Gespräch mit Mike (Questgeber leichen verbrennen)
				    EndMedicalTreatment(playerid);
	    			OnDialogResponse(playerid,dialog_NPC_MIKE_MAINRE,1,0,"");
			    	ClearAnimations(playerid);
			    	ApplyAnimation(playerid,"PED","IDLE_CHAT",4.0,0,0,0,0,1);
		            return 1;
				}
				if(IsPlayerInRangeOfPoint(playerid,2.0,-839.5128,436.1732,7.3449))
				{//Gespräch mit henry (pirat)
				    EndMedicalTreatment(playerid);
	    			//OnDialogResponse(playerid,dialog_NPC_HENRY_MAINRE,1,0,"");
			    	ClearAnimations(playerid);
			    	ApplyAnimation(playerid,"PED","IDLE_CHAT",4.0,0,0,0,0,1);
		            return 1;
				}
				if(IsPlayerInRangeOfPoint(playerid,2.0,-1465.6041,2609.8149,40.6853))
				{
				    EndMedicalTreatment(playerid);
	    			OnDialogResponse(playerid,dialog_NPC_CHUCK_MAINRE,1,0,"");
			    	ClearAnimations(playerid);
			    	ApplyAnimation(playerid,"PED","IDLE_CHAT",4.0,0,0,0,0,1);
		            return 1;
				}
			}
			if(oldkeys == KEY_SPRINT)
			{//SPACE
				if(GetPVarInt(playerid,"EX_autohaus_showing") == 1)
				{//IM AUTOHAUS, AUTO KAUFEN
				    if(GetPVarInt(playerid,"car_keystate_fix") == 1) return 1;
					new buy_id	 	= GetPVarInt(playerid,"EX_autohaus_car"),
					    model_id    = AutohausInfo[buy_id][model],
					    kraftstoff  = car::GetModelFuelType(model_id),
					    buy_preis   = AutohausInfo[buy_id][preis],
					    npc_cash    = PlayerNPC[playerid][NPC_JASON][cash];
					misc_FetchFuelTypes(string,kraftstoff);
				   	format(string,sizeof(string),"{C87E35}Jason (Autohändler):\n\"{F1F7DC}Nette Karre\n\
					   Name:	   %s\n\
					   Preis:	   %d\n\
					   Verbrauch:  %0.1f/100km\n\
					   Tank:       %0.1f Liter\n\
					   Kraftstoff: %s\n\
					   Möchtest du den Wagen kaufen?{C87E35}\"\n\n\n{878375}Kauffortschritt: %0.1f%%",AutohausInfo[buy_id][carname],buy_preis,car::GetModelVerbrauch(model_id),car::GetModelMaxTank(model_id),string,((npc_cash/buy_preis)*100));
				    car::ShowPlayerDialog(playerid,dialog_EX_car_INFO_BUY,DIALOG_STYLE_MSGBOX,"{C87E35}Gespräch mit Jason",string,"Kaufen","Zurück");
				}
			}
			if(newkeys == KEY_FIRE)
			{//LMB
	            if(JOB_LIST:PlayerInfo[playerid][Job] == JOB_JAEGER && GetPlayerWeapon(playerid) == 6 && GetPVarInt(playerid,"can_mine") == 0)//Schaufel
			    {//Jaeger
	      			new targetid = jaegers_InRangeOfTarget(playerid,5.0);
	      			if(targetid >= 0)
	      			{
	      			    new Float:damage = (200.0+skill::GetPlayerSkill(playerid,SkillKraft));
			    	    format(query,sizeof(query),#FORMAT_CHAT_INFO"Du hast dem Tier %0.2f Schaden hinzugefügt",damage);
			    	    SendClientMessage(playerid,GRUEN,query);
			    	    SetPVarInt(playerid,"can_mine",1);
			    	    if((JaegersHealth[targetid]-=damage) <= 0.0)
			    	    {//Tier erlegt
			    	        new Float:droprate = 25.0;
							droprate = ((droprate/100.0)*__SERVER[OPT_DROPRATE]);
			    	        droprate = (droprate+(skill::GetPlayerSkill(playerid,SkillGlueck)*0.6));
			    	        if(frandom(100.0) < droprate)
			    	        {
								SendClientMessage(playerid,ROT,#FORMAT_CHAT_INFO"Du hast das Tier erlegt, findest aber nichts nützliches");
				    	        ShowPlayerDialog(playerid,dialog_NULL,DIALOG_STYLE_MSGBOX,"{F1F7DC}Tier erlegt","{F1F7DC}\
								Du hast das Tier erlegt und nichts brauchbares gefunden. Du bist\n\
								erschöpft und kannst das nächste Tier erst wieder in 3 Minuten\n\
								erlegen.","Zurück","");
							}
							else
							{
								SendClientMessage(playerid,ROT,#FORMAT_CHAT_INFO"Du hast das Tier erlegt und findest ein Item");
				    	        ShowPlayerDialog(playerid,dialog_NULL,DIALOG_STYLE_MSGBOX,"{F1F7DC}Tier erlegt","{F1F7DC}\
								Du hast das Tier erlegt und findest:\n\
								{C85135}Xx Itemname{F1F7DC}.\n\
								Du bist erschöpft und kannst das nächste Tier erst in 3\n\
								Minuten erlegen.","Zurück","");
							}
			    	        jaegers_DestroyTarget(targetid);
			    	        SetPVarInt(playerid,"can_mine",3*60);
						    new am_id = __amCache[amJaeger];
						    if(am_id != -1) achievement::SetPlayerAchievementData(playerid,am_id,1,true);
			    	    }
	      			}
			    }
			    if(JOB_LIST:PlayerInfo[playerid][Job] == JOB_MINENARBEITER && GetPlayerWeapon(playerid) == 6 && GetPVarInt(playerid,"can_mine") == 0)//Schaufel
			    {//Minenarbeiter
			    	new rockid = miners_InRangeOfRock(playerid,6.0);
			    	if(rockid >= 0)
			    	{
			    	    new Float:damage = (25.0+skill::GetPlayerSkill(playerid,SkillKraft));
			    	    format(query,sizeof(query),#FORMAT_CHAT_INFO"Du hast dem Stein %0.2f Schaden hinzugefügt",damage);
			    	    SendClientMessage(playerid,GRUEN,query);
			    	    SetPVarInt(playerid,"can_mine",1);

			    	    if((MinersHealth[rockid]-=damage) <= 0.0)
			    	    {//Stein zerstört
			    	        new Float:droprate = 25.0;
							droprate = ((droprate/100.0)*__SERVER[OPT_DROPRATE]);
			    	        droprate = (droprate+(skill::GetPlayerSkill(playerid,SkillGlueck)*0.6));

			    	        if(frandom(100.0) < droprate)
			    	        {
								SendClientMessage(playerid,ROT,#FORMAT_CHAT_INFO"Du hast den Stein zerstört und findest nichts als Staub");
				    	        ShowPlayerDialog(playerid,dialog_NULL,DIALOG_STYLE_MSGBOX,"{F1F7DC}Stein zertrümmert","{F1F7DC}\
								Du hast den Stein zerstört und findest nichts als {C85135}Geröll{F1F7DC}. Du\n\
								bist erschöpft und kannst den nächsten Stein erst in 3\n\
								Minuten zertrümmern.","Zurück","");
							}
							else
							{
								SendClientMessage(playerid,ROT,#FORMAT_CHAT_INFO"Du hast den Stein zerstört und findest ein Item");
				    	        ShowPlayerDialog(playerid,dialog_NULL,DIALOG_STYLE_MSGBOX,"{F1F7DC}Stein zertrümmert","{F1F7DC}\
								Du hast den Stein zerstört und findest:\n\
								{C85135}Xx Itemname{F1F7DC}.\n\
								Du bist erschöpft und kannst den nächsten Stein erst in 3\n\
								Minuten zertrümmern.","Zurück","");
							}
			    	        miners_DestroyRock(rockid);
			    	        SetPVarInt(playerid,"can_mine",3*60);
						    new am_id = __amCache[amMinenarbeiter];
						    if(am_id != -1) achievement::SetPlayerAchievementData(playerid,am_id,1,true);
			    	    }
			    	    return 1;
			    	}
	   			}
			}
		}
		
		//Kann auch tot sein
		if(newkeys == KEY_SPRINT)
		{
		    if(GetPVarInt(playerid,"waffenladen") == 1)
		    {
		        OnDialogResponse(playerid,dialog_NPC_WAFFENDEALER_MAIN,0,0,"");
		        UpdatePlayerShopScreen(playerid,SHOPSCREEN_WAFFEN,false);
		        return 1;
		    }
			else if(GetPVarInt(playerid,"pizzaladen") == 1)
			{//ABBRECHEN
				OnDialogResponse(playerid,dialog_NPC_PIZZA_MAIN,0,-1,"");
			    return 1;
			}
			else if(GetPVarInt(playerid,"hosp_cam") == 1)
			{//Menü verlassen
			    if(!PlayerCamera[playerid][camMoving])
			    {
					HideInfoMessage(playerid);
					cam_Ort[playerid] 	= 0;
					cam_Ziel[playerid] 	= 0;
					TogglePlayerControllable(playerid,true);
					SetCameraBehindPlayer(playerid);
					SetPVarInt(playerid,"hosp_cam",0);
				}
				return 1;
			}
			else if(GetPVarInt(playerid,"liq_store") == 1)
			{
				UpdatePlayerShopScreen(playerid,SHOPSCREEN_LIQUOR,false);
				TogglePlayerControllable(playerid,true);
				SetPVarInt(playerid,"liq_store",0);
				SetPVarInt(playerid,"liq_pos",0);
				DeletePVar(playerid,"liq_store");
				DeletePVar(playerid,"liq_pos");
				SetCameraBehindPlayer(playerid);
		        OnDialogResponse(playerid,dialog_NPC_MATHEO_MAINRE,0,0,"");
			}
		}
		else if(oldkeys == KEY_SECONDARY_ATTACK)
		{//F or ENTER
		    if(GetPVarInt(playerid,"EX_autohaus_showing") == 1)
		    {//Zurück ins Hauptmenü
			    car::ShowPlayerDialog(playerid,dialog_EX_car_LEAVE,DIALOG_STYLE_MSGBOX,"{C87E35}Gespräch mit Jason","{C87E35}Jason (Autohändler):\n\"{F1F7DC}Möchtest du den Autokauf wirklich abbrechen?{C87E35}\"","Nein","Ja");
          		return 1;
		    }
		    if(!IsPlayerInAnyVehicle(playerid))
		    {
				if(IsPlayerInRangeOfPoint(playerid,4.0,-177.41159057617,1110.8359375,19.7421875))//Hotel aussen
				{//Ins Hotel reingehen
				    SetPlayerInterior(playerid,15);//Interior Jefferson Hotel
				    if(PlayerEvent[playerid][IstTot] == 0) SetPlayerVirtualWorld(playerid,1234);
				    else SetPlayerVirtualWorld(playerid,1235);
					w_SetPlayerPos(playerid,2214.9211425781,-1150.5350341797,1025.796875,_,3);//Hotel Innenraum
					EndMedicalTreatment(playerid);
					return 1;
				}
				if(IsPlayerInRangeOfPoint(playerid,4.0,2214.9211425781,-1150.5350341797,1025.796875))//Hotel innen
				{//Raus dem hotel gehen
				    if(PlayerEvent[playerid][IstTot] == 0) SetPlayerVirtualWorld(playerid,0);
				    else SetPlayerVirtualWorld(playerid,1000);
				    SetPlayerInterior(playerid,0);
					w_SetPlayerPos(playerid,-177.41159057617,1110.8359375,19.7421875,_,3);//Hotel Ausgang
					EndMedicalTreatment(playerid);
					return 1;
				}
				if(IsPlayerInRangeOfPoint(playerid,4.0,-207.45960998535,1119.2337646484,20.078912734985))//SH außen
				{//In die SH reingehen
				    SetPlayerInterior(playerid,2);
				    if(PlayerEvent[playerid][IstTot] == 0) SetPlayerVirtualWorld(playerid,1234);
					else SetPlayerVirtualWorld(playerid,1235);
					w_SetPlayerPos(playerid,-209.48828125,1119.3564453125,119.89750671387,_,3);//SH innen
					EndMedicalTreatment(playerid);
					return 1;
				}
				if(IsPlayerInRangeOfPoint(playerid,4.0,-209.48828125,1119.3564453125,119.89750671387))//SH innen
				{//Aus die SH
				    SetPlayerInterior(playerid,0);
				    if(PlayerEvent[playerid][IstTot] == 0) SetPlayerVirtualWorld(playerid,0);
				    else SetPlayerVirtualWorld(playerid,1000);
					w_SetPlayerPos(playerid,-207.45960998535,1119.2337646484,20.078912734985,_,3);//SH außen
					EndMedicalTreatment(playerid);
					return 1;
				}
				if(IsPlayerInRangeOfPoint(playerid,4.0,-181.5202,1163.3854,19.7500))//Waffenladen außen
				{//In dden Waffenladen gehen
				    if(PlayerInfo[playerid][Fraktion] == 0 || PlayerInfo[playerid][Fraktion] == 1)
				    {
					    SetPlayerInterior(playerid,2);
					    if(PlayerEvent[playerid][IstTot] == 0) SetPlayerVirtualWorld(playerid,1234);
					    else SetPlayerVirtualWorld(playerid,1235);
						w_SetPlayerPos(playerid,-173.6472,1160.8484,87.5898,354.0,3);//Waffenladen innen
						EndMedicalTreatment(playerid);
						return 1;
					}
					DisplayInfobox(playerid,"Du bist unerwuenscht!","Du kannst den Laden wegen deiner Fraktion nicht betreten",3);
					return 1;
				}
				if(IsPlayerInRangeOfPoint(playerid,1.0,-173.6472,1160.8484,87.5898))//Waffenladen innen
				{//Aus dem Waffenladen
				    SetPlayerInterior(playerid,0);
				    if(PlayerEvent[playerid][IstTot] == 0) SetPlayerVirtualWorld(playerid,0);
				    else SetPlayerVirtualWorld(playerid,1000);
					w_SetPlayerPos(playerid,-181.5202,1163.3854,19.7500,_,3);//waffenladen außen
					EndMedicalTreatment(playerid);
					return 1;
				}
				if(IsPlayerInRangeOfPoint(playerid,4.0,-174.65170288086,1092.0603027344,52.612545013428))//BAR INNEN
				{//AUS DER BAR
				    SetPlayerInterior(playerid,0);
				    if(PlayerEvent[playerid][IstTot] == 0) SetPlayerVirtualWorld(playerid,0);
				    else SetPlayerVirtualWorld(playerid,1000);
					w_SetPlayerPos(playerid,-180.7499,1088.3792,19.7422,_,3);//BAR AUSSEN
					EndMedicalTreatment(playerid);
					return 1;
				}
				if(IsPlayerInRangeOfPoint(playerid,4.0,-180.7499,1088.3792,19.7422))//BAR AUSSEN
				{//IN DIE BAR
				    SetPlayerInterior(playerid,2);
				    if(PlayerEvent[playerid][IstTot] == 0) SetPlayerVirtualWorld(playerid,1234);
				    else SetPlayerVirtualWorld(playerid,1235);
					w_SetPlayerPos(playerid,-174.65170288086,1092.0603027344,52.612545013428,_,3);//BAR INNEN
					EndMedicalTreatment(playerid);
					return 1;
				}
				if(IsPlayerInRangeOfPoint(playerid,2.0,-227.3721,1401.3967,27.7656))//UFO BAR INNEN
				{//AUS BER UFO BAR
				    SetPlayerInterior(playerid,0);
				    if(PlayerEvent[playerid][IstTot] == 0) SetPlayerVirtualWorld(playerid,0);
				    else SetPlayerVirtualWorld(playerid,1000);
					w_SetPlayerPos(playerid,-87.8159,1378.5374,10.2734,278.0,2);//BAR AUSSEN
					EndMedicalTreatment(playerid);
					return 1;
				}
				if(IsPlayerInRangeOfPoint(playerid,2.0,-87.8159,1378.5374,10.2734))//UFO BAR AUSSEN
				{//IN DIE BAR
				    SetPlayerInterior(playerid,18);
				    if(PlayerEvent[playerid][IstTot] == 0) SetPlayerVirtualWorld(playerid,1234);
				    else SetPlayerVirtualWorld(playerid,1235);
					w_SetPlayerPos(playerid,-227.3721,1401.3967,27.7656,295.0,2);//BAR INNEN
					EndMedicalTreatment(playerid);
					CheckPlayerNoDM(playerid);
					return 1;
				}
				if(IsPlayerInRangeOfPoint(playerid,2.0,372.30459594727,-132.77249145508,1001.4921875))//PIZZA INNEN
				{
				    SetPlayerInterior(playerid,0);
				    if(PlayerEvent[playerid][IstTot] == 0) SetPlayerVirtualWorld(playerid,0);
				    else SetPlayerVirtualWorld(playerid,1000);
					w_SetPlayerPos(playerid,-152.1429,1083.1031,19.7422,5.7,2);//PIZZA AUSSEN
					EndMedicalTreatment(playerid);
					return 1;
				}
				if(IsPlayerInRangeOfPoint(playerid,2.0,-152.20358276367,1081.6214599609,19.7421875))//PIZZA AUSSEN
				{
				    SetPlayerInterior(playerid,5);
				    if(PlayerEvent[playerid][IstTot] == 0) SetPlayerVirtualWorld(playerid,1234);
				    else SetPlayerVirtualWorld(playerid,1235);
					w_SetPlayerPos(playerid,372.2249,-130.7730,1001.4922,5.0,2);//PIZZA INNEN
					EndMedicalTreatment(playerid);
					return 1;
				}
				if(IsPlayerInRangeOfPoint(playerid,2.0,838.12023,2674.04589,21.58206))//DUNGEON 1 AUSSEN
				{
				    SetPlayerInterior(playerid,2);
				    if(PlayerEvent[playerid][IstTot] == 0) SetPlayerVirtualWorld(playerid,1234);
				    else SetPlayerVirtualWorld(playerid,1235);
					w_SetPlayerPos(playerid,853.96,2660.0165,-56.858,_,2);//Dungeon 1 innen
					EndMedicalTreatment(playerid);
					return 1;
				}
				if(IsPlayerInRangeOfPoint(playerid,2.0,853.96502,2660.01635,-56.858341))//DUNGEON 1 innen
				{
				    SetPlayerInterior(playerid,0);
				    if(PlayerEvent[playerid][IstTot] == 0) SetPlayerVirtualWorld(playerid,0);
				    else SetPlayerVirtualWorld(playerid,1000);
					w_SetPlayerPos(playerid,838.12,2674.0459,21.582,_,2);//Dungeon 1 aussen
					EndMedicalTreatment(playerid);
					return 1;
				}
				if(IsPlayerInRangeOfPoint(playerid,2.0,17.084,1569.0345,13.5565))//DDC CLUB AUSSEN
				{
				    SetPlayerInterior(playerid,3);
				    if(PlayerEvent[playerid][IstTot] == 0) SetPlayerVirtualWorld(playerid,1234);
				    else SetPlayerVirtualWorld(playerid,1235);
					w_SetPlayerPos(playerid,-2636.73461,1403.31787,906.4609,_,2);//DDC CLUB INNEN
					EndMedicalTreatment(playerid);
					return 1;
				}
				if(IsPlayerInRangeOfPoint(playerid,2.0,-2636.73461,1403.31787,906.4609))//DDC CLUB INNEN
				{
				    SetPlayerInterior(playerid,0);
				    if(PlayerEvent[playerid][IstTot] == 0) SetPlayerVirtualWorld(playerid,0);
				    else SetPlayerVirtualWorld(playerid,1000);
					w_SetPlayerPos(playerid,17.084,1569.0345,13.5565,_,2);//DDC AUSSEN
					EndMedicalTreatment(playerid);
					return 1;
				}
				if(IsPlayerInRangeOfPoint(playerid,2.0,-204.9497,1171.9120,19.7422))//Arztpraxis AUSSEN
				{
				    SetPlayerInterior(playerid,2);
				    if(PlayerEvent[playerid][IstTot] == 0) SetPlayerVirtualWorld(playerid,1234);
				    else SetPlayerVirtualWorld(playerid,1235);
					w_SetPlayerPos(playerid,2853.2663,-262.9061,52.7608,281.2148,2);//Arztpraxis INNEN
					EndMedicalTreatment(playerid);
					return 1;
				}
				if(IsPlayerInRangeOfPoint(playerid,2.0,2853.2663,-262.9061,52.7608))//Arztpraxis INNEN
				{
				    SetPlayerInterior(playerid,0);
				    if(PlayerEvent[playerid][IstTot] == 0) SetPlayerVirtualWorld(playerid,0);
				    else SetPlayerVirtualWorld(playerid,1000);
					w_SetPlayerPos(playerid,-204.9497,1171.9120,19.7422,_,2);//Arztpraxis AUSSEN
					EndMedicalTreatment(playerid);
					return 1;
				}
				if(IsPlayerInRangeOfPoint(playerid,2.0,-1635.3093,1315.1174,13.0133))//Dungeon2 (milit) aussen
				{
				    SetPlayerInterior(playerid,2);
				    if(PlayerEvent[playerid][IstTot] == 0) SetPlayerVirtualWorld(playerid,1234);
				    else SetPlayerVirtualWorld(playerid,1235);
					w_SetPlayerPos(playerid,-2920.8359,180.0761,257.95202,_,2);//Dungeon2 (milit) innen
					EndMedicalTreatment(playerid);
					return 1;
				}
				if(IsPlayerInRangeOfPoint(playerid,2.0,-2920.8359,180.0761,257.95202))//Dungeon2 (milit) innen
				{
				    SetPlayerInterior(playerid,0);
				    if(PlayerEvent[playerid][IstTot] == 0) SetPlayerVirtualWorld(playerid,0);
				    else SetPlayerVirtualWorld(playerid,1000);
					w_SetPlayerPos(playerid,-1635.3093,1315.1174,13.0133,300.0,2);//Dungeon2 (milit) aussen
					EndMedicalTreatment(playerid);
					return 1;
				}
				if(IsPlayerInRangeOfPoint(playerid,2.0,-1507.5150,2560.2803,55.8359))//Sportstudio aussen
				{
				    SetPlayerInterior(playerid,2);
				    if(PlayerEvent[playerid][IstTot] == 0) SetPlayerVirtualWorld(playerid,1234);
				    else SetPlayerVirtualWorld(playerid,1235);
					w_SetPlayerPos(playerid,-1479.5000,2603.6999,40.9000,_,2);//Sportstudio innen
					EndMedicalTreatment(playerid);
					return 1;
				}
				if(IsPlayerInRangeOfPoint(playerid,2.0,-1479.5000,2603.6999,40.9000))//Sportstudio innen
				{
				    SetPlayerInterior(playerid,0);
				    if(PlayerEvent[playerid][IstTot] == 0) SetPlayerVirtualWorld(playerid,0);
				    else SetPlayerVirtualWorld(playerid,1000);
					w_SetPlayerPos(playerid,-1507.5150,2560.2803,55.8359,_,2);//Sportstudio aussen
					EndMedicalTreatment(playerid);
					return 1;
				}
				if(IsPlayerInRangeOfPoint(playerid,2.0,-227.4635,2710.5784,62.9766))//Bekleidung TAILOR aussen
				{
				    SetPlayerInterior(playerid,2);
				    if(PlayerEvent[playerid][IstTot] == 0) SetPlayerVirtualWorld(playerid,1234);
				    else SetPlayerVirtualWorld(playerid,1235);
					w_SetPlayerPos(playerid,3180.0,2301.1000,72.09999,_,2);//Bekleidung TAILOR innen
					EndMedicalTreatment(playerid);
					return 1;
				}
				if(IsPlayerInRangeOfPoint(playerid,2.0,3180.0,2301.1000,72.09999))//Bekleidung TAILOR innen
				{
				    SetPlayerInterior(playerid,0);
				    if(PlayerEvent[playerid][IstTot] == 0) SetPlayerVirtualWorld(playerid,0);
				    else SetPlayerVirtualWorld(playerid,1000);
					w_SetPlayerPos(playerid,-227.4635,2710.5784,62.9766,_,2);//Bekleidung TAILOR aussen
					EndMedicalTreatment(playerid);
					return 1;
				}
				if(IsPlayerInRangeOfPoint(playerid,2.0,-523.4921,1900.0576,95.7179))//Kirche aussen
				{
				    SetPlayerInterior(playerid,2);
				    if(PlayerEvent[playerid][IstTot] == 0) SetPlayerVirtualWorld(playerid,1234);
				    else SetPlayerVirtualWorld(playerid,1235);
					w_SetPlayerPos(playerid,353.6480,132.4546,1624.6776,357.0513,2);//Kirche innen
					EndMedicalTreatment(playerid);
					return 1;
				}
				if(IsPlayerInRangeOfPoint(playerid,2.0,353.6480,132.4546,1624.6776))//Kirche innen
				{
				    SetPlayerInterior(playerid,0);
				    if(PlayerEvent[playerid][IstTot] == 0) SetPlayerVirtualWorld(playerid,0);
				    else SetPlayerVirtualWorld(playerid,1000);
					w_SetPlayerPos(playerid,-523.4921,1900.0576,95.7179,275.8592,2);//Kirche aussen
					EndMedicalTreatment(playerid);
					return 1;
				}
				if(IsPlayerInRangeOfPoint(playerid,2.0,345.9581,170.1965,1627.6061))//kirche kapsel unten
				{
					w_SetPlayerPos(playerid,344.1536,170.1965,1627.5990,83.96);//Kirche kapsel oben
					EndMedicalTreatment(playerid);
					return 1;
				}
				if(IsPlayerInRangeOfPoint(playerid,2.0,344.1536,170.1965,1627.5990))//kirche kapsel oben
				{
					w_SetPlayerPos(playerid,345.9581,170.1965,1627.6061,335.4879);//Kirche kapsel unten
					EndMedicalTreatment(playerid);
					return 1;
				}
			}
		}
		else if(oldkeys == KEY_YES)
		{//Z
		    if(PlayerEvent[playerid][IstTot] >= 1) return 1;
		    if(PlayerCache[playerid][holding_item] >= 1)
		    {//Einstecken
				new response = item::GivePlayerItem(playerid,PlayerCache[playerid][holding_item],1);
				if(response == -3) DisplayInfobox(playerid,"Zu wenig Platz","~r~Du hast zu wenig Platz im Inventar. Lege das~n~Item erst mit der Taste 'N' weg.",2);
				else if(response == 1)
				{
				    ResetPlayerWeapons(playerid);
				    SetPlayerArmedWeapon(playerid,0);
				    PlayerCurrentWeaponSlot[playerid] = 0;
				    PlayerCache[playerid][holding_item] = 0;
				    equip::RemoveSlot(playerid,ITEM_ACTION_SLOT);
				    DisplayInfobox(playerid,"Item eingesteckt","~g~Du hast das Item eingesteckt",2);
				    SetPlayerSpecialAction(playerid,SPECIAL_ACTION_NONE);
				    ClearAnimations(playerid);
				    return 1;
				}
		        return 1;
		    }
		    else
		    {
		        if(GetPVarInt(playerid,"changing_Weapon") == 1) return 1;
			    //Waffe wechseln
			    PlayerTextDrawHide(playerid,WeaponAmmo[playerid]);
				new oldslot = PlayerCurrentWeaponSlot[playerid],
					w = PlayerWeapon[playerid][oldslot][wWeaponID],
					newslot = 0;
				if(w >= 1)
				{
				    new data[2];
				    GetPlayerWeaponData(playerid,GetWeaponSlot(w),data[0],data[1]);
					PlayerWeapon[playerid][oldslot][wMagAmmo] = data[1];
				}
				SetPVarInt(playerid,"_guns_event",1);
				PlayerCache[playerid][current_weapon_id] = 0;
				SetPlayerArmedWeapon(playerid,0);
				ResetPlayerWeapons(playerid);
				for(new i; i<MAX_PLAYER_WEAPONS; i++)
				{
				    PlayerCurrentWeaponSlot[playerid]++;
					if(PlayerCurrentWeaponSlot[playerid] == 4) PlayerCurrentWeaponSlot[playerid] = 0;
				    newslot = PlayerCurrentWeaponSlot[playerid];
				    if(newslot == 0 || newslot == 1)
				    {
						if(newslot == 1)
						{//Equipment
						    w = 0;
						    if(PlayerCache[playerid][equip_fist_item] <= 0) continue;//Hat nichts ausgerüstt
				            break;
						}
						//Faust
						w = 0;
						break;
				    }
				    else
				    {
					    if(PlayerWeapon[playerid][newslot][wWeaponID] <= 0) continue;
					    if(GetPVarInt(playerid,"in_no_dm_zone") == 1)       continue;
						w = PlayerWeapon[playerid][newslot][wWeaponID];
						break;
					}
				}
				switch(newslot)
				{
					case 0:
					{
					    if(oldslot == 1 || oldslot == 2)
					    {
							ApplyAnimation(playerid,"PED","PHONE_IN",1.7,0,0,0,0,400);
							SetPVarInt(playerid,"changing_Weapon",1);
							SetTimerEx("pevent_RemoveAttachedObject",400,false,"dd",playerid,oldslot==1?EQUIPMENT_SLOT:ITEM_ACTION_SLOT);
						}
						else if(oldslot == 3)
						{
						    ApplyAnimation(playerid,"GOGGLES","GOGGLES_PUT_ON",1.7,0,0,0,0,800);
						    SetPVarInt(playerid,"changing_Weapon",1);
							SetTimerEx("pevent_RemoveAttachedObject",800,false,"dd",playerid,ITEM_ACTION_SLOT);
						}
					}
					case 1:
				    {//Equipment
		                if(oldslot == 1) 	equip::RemoveSlot(playerid,EQUIPMENT_SLOT);
		                else            	equip::RemoveSlot(playerid,ITEM_ACTION_SLOT);
				        ApplyAnimation(playerid,"GOGGLES","GOGGLES_PUT_ON",1.7,0,0,0,0,500);
				        SetPVarInt(playerid,"changing_Weapon",1);
						new item = PlayerCache[playerid][equip_fist_item];
		                equip::UseEquipment(playerid,item_ItemInfo[item][iObjectID],item_ItemInfo[item][iWearInfo][1],item_ItemInfo[item][iWearAttachInfo][0],item_ItemInfo[item][iWearAttachInfo][1],item_ItemInfo[item][iWearAttachInfo][2],item_ItemInfo[item][iWearAttachInfo][3],item_ItemInfo[item][iWearAttachInfo][4],item_ItemInfo[item][iWearAttachInfo][5],item_ItemInfo[item][iWearAttachInfo][6],item_ItemInfo[item][iWearAttachInfo][7],item_ItemInfo[item][iWearAttachInfo][8],.oslot=EQUIPMENT_SLOT,.itemID=item);
		                SetTimerEx("pevent_RemoveAttachedObject",500,false,"dd",playerid,-1);
		            }
		            case 2,3:
		            {
		                if(oldslot == 1) 	equip::RemoveSlot(playerid,EQUIPMENT_SLOT);
		                else            	equip::RemoveSlot(playerid,ITEM_ACTION_SLOT);
		                
		                if(newslot == 2)
		                {
							ApplyAnimation(playerid,"PED","PHONE_IN",1.7,0,0,0,0,400);
							SetPVarInt(playerid,"changing_Weapon",1);
		                    SetTimerEx("pevent_RemoveAttachedObject",400,false,"dd",playerid,-1);
		                }
		                else if(newslot == 3)
		                {
		                    ApplyAnimation(playerid,"GOGGLES","GOGGLES_PUT_ON",1.7,0,0,0,0,800);
		                    SetPVarInt(playerid,"changing_Weapon",1);
		                    SetTimerEx("pevent_RemoveAttachedObject",800,false,"dd",playerid,-1);
		                }
						new clipsize = GetWeaponClipsize(playerid,w);
					    if(clipsize == 0)
						{
			                PlayerWeapon[playerid][PlayerCurrentWeaponSlot[playerid]][wMagAmmo] = 0;
			                equip::UseEquipment(playerid,WeaponInfo[w][wObjectID],RightHand,.oslot=ITEM_ACTION_SLOT);
			                w = 0;
						}
						else if(PlayerWeapon[playerid][newslot][wMagAmmo] >= 1)
						{
						    gun_UpdateAmmoDisplay(playerid,gun_GetAmmoStorage(playerid,w));
						    GivePlayerWeapon(playerid,PlayerWeapon[playerid][newslot][wWeaponID],PlayerWeapon[playerid][newslot][wMagAmmo]);
						}
						else if(PlayerWeapon[playerid][newslot][wMagAmmo] <= 0)
					    {
					        PlayerWeapon[playerid][newslot][wMagAmmo] = 0;
					        gun_UpdateAmmoDisplay(playerid,gun_GetAmmoStorage(playerid,w));
			                equip::UseEquipment(playerid,WeaponInfo[w][wObjectID],RightHand,.oslot=ITEM_ACTION_SLOT);
			                w = 0;
					    }
		            }
		        }
				SetPlayerArmedWeapon(playerid,w);
				PlayerCache[playerid][current_weapon_id] = w;
				equip::UpdateWeapons(playerid);
				return 1;
			}
		}
		else if(oldkeys == KEY_CTRL_BACK)
		{//H
		    //Inventar
		    if(PlayerEvent[playerid][IstTot] == 0 && !IsPlayerInAnyVehicle(playerid)/*scroll down bug (?)*/)
		    {
		        ncom_items(playerid);
		        return 1;
		    }
		}
		else if(oldkeys == KEY_NO)
		{//N
		    //Aktionsknopf
		    if(PlayerEvent[playerid][IstTot] == 0)
		    {
		        if(PlayerCache[playerid][holding_item] >= 1)
		        {//Item wegstellen
		            if(GetPVarInt(playerid,"pevent_ImanTake") || IsPlayerInAnyVehicle(playerid)) return 1;
		            if(!(item_ItemInfo[PlayerCache[playerid][holding_item]][iAction] & canThrowAway)) return SendClientMessage(playerid,-1,#FORMAT_CHAT_ERROR"Dieses Item kannst du nicht wegwerfen."),1;
		            if(PlayerCurrentWeaponSlot[playerid] == 0)
		            {
		            	SetPVarInt(playerid,"pevent_ImanTake",1);
						if(item_ItemInfo[PlayerCache[playerid][holding_item]][iSize] == iSize_carry) ApplyAnimation(playerid,"CARRY","putdwn",5.0,0,0,0,0,0);
						else ApplyAnimation(playerid,"BOMBER","BOM_PLANT_IN",5.0,1,0,0,0,450);
		            	SetTimerEx("pevent_DropItem",500,false,"d",playerid);
					}
					return 1;
		        }
		        if(IsPlayerInAnyVehicle(playerid)) ncom_auto(playerid);
		        else
		        {
			        if(ncom_reisen(playerid) == 2)				return 1;
			        else if(ncom_ofen(playerid,1) == 2)			return 1;
			        else if(ncom_craft(playerid,1) == 2)		return 1;
			        else if(ncom_durchsuchen(playerid,1) == 2)	return 1;
			        else if(ncom_trainieren(playerid) == 2)		return 1;
			        else if(ncom_nehmen(playerid,1) == 2)		return 1;
			        else if(ncom_pflanze(playerid,1) == 2)		return 1;
			        else if(ncom_container(playerid,1) == 2)	return 1;
				}
		    }
		}
		
	    if(PlayerEvent[playerid][MedicalEvent][0] == 0) house_OnPlayerKeyStateChange(playerid, newkeys, oldkeys);
		if(newkeys == KEY_SECONDARY_ATTACK && PlayerEvent[playerid][TutorialStep][0] == 4 && PlayerEvent[playerid][TutorialStep][1] == 3 && IsPlayerInRangeOfPoint(playerid,8.0,584.41088867188,-2430.8786621094,10.902749061584))
		{
		    DisablePlayerMissionCP(playerid);
            HideInfobox(playerid);
		    MovePlayerObject(playerid,GetPVarInt(playerid,"tutorial_gate_oid"),583.57910156,-2429.06835938,14.11331844,0.6);
            PlayerEvent[playerid][TutorialStep][1] = 4;
            return 1;
		}
	}
	return 1;
}

public OnPlayerUpdate(playerid)
{
    if(IsPlayerNPC(playerid)) return 1;
    new keys,ud,lr,
		animindex	= GetPlayerAnimationIndex(playerid),
		weaponid	= GetPlayerWeapon(playerid);
    GetPlayerKeys(playerid,keys,ud,lr);
	if(PlayerCache[playerid][current_weapon_id] != weaponid) OnPlayerWeaponChange(playerid,PlayerCache[playerid][current_weapon_id],weaponid);
    if(GetPVarInt(playerid,"EX_autohaus_in") >= 1) return autohaus_EX_OnPlayerUpdate(playerid,ud,lr);
	if(PlayerInfo[playerid][IsInCRoom] == 0 && keys & 8 && (animindex == 1231 || ud != 0 || lr != 0))
	{//Rennt
	    SetPVarInt(playerid,"running",1);
    	if(!IsPlayerInAnyVehicle(playerid))
		{
		    if(PlayerEvent[playerid][Ausdauer] < 2.0)
			{
				ApplyAnimation(playerid,"FAT","IDLE_tired",4.0,1,0,0,0,0,1);
				PlayerEvent[playerid][CanRun] = false;
			}
		    else if(PlayerCache[playerid][item_Gewicht] > PlayerEvent[playerid][MaxWeight])
		    {
				new Float:velo[3];
				GetPlayerVelocity(playerid,velo[0],velo[1],velo[2]);
				SetPlayerVelocity(playerid,0.0,0.0,velo[2]);
		    }
			else if(PlayerEvent[playerid][Ausdauer] < 20.0)
			{
				new Float:velo[3];
				GetPlayerVelocity(playerid,velo[0],velo[1],velo[2]);
				SetPlayerVelocity(playerid,velo[0]*0.6,velo[1]*0.6,velo[2]);
			}
		}
	}
	if(IsPlayerInAnyVehicle(playerid) && GetPlayerVehicleSeat(playerid) == 0)
	{
	    new Float:velo[3],str[12],Float:kmh;
	    GetVehicleVelocity(GetPlayerVehicleID(playerid),velo[0],velo[1],velo[2]);
	    kmh = VelocityToKmh(velo);
	    format(str,12,"%.0f km/h",kmh);
	    SetPlayerObjectMaterialText(playerid,pSpeedoObjects[playerid],str,0,OBJECT_MATERIAL_SIZE_512x256,"Arial",64,true,RGB_Verlauf(kmh/200.0)|(0xFF<<24),0,OBJECT_MATERIAL_TEXT_ALIGN_CENTER);
	}
	if(PlayerEvent[playerid][FrozenTime])
	{
	    TogglePlayerControllable(playerid,true);
	    new Float:pos[3];
	    GetPlayerPos(playerid,pos[0],pos[1],pos[2]);
	    if(!IsPlayerInRangeOfPoint(playerid,2.0,pos[0],pos[1],pos[2])) SetPlayerPos(playerid,PlayerEvent[playerid][FrozenPos][0],PlayerEvent[playerid][FrozenPos][1],PlayerEvent[playerid][FrozenPos][2]);
	    return 1;
    }
    
	if(GetPVarInt(playerid,"skinauswahl") == 1)
	{
	    if(lr < 0)
	    {//Links
	        skin_Prevskin(playerid);
	        return 1;
	    }
	    else if(lr > 0)
	    {//Rechts
	        skin_Nextskin(playerid);
	        return 1;
	    }
	}
	if(lr != 0 && PlayerInfo[playerid][IsInCRoom] == 1 && !PlayerCamera[playerid][camMoving])
	{
	    if(lr > 0)
		{//Rechts
		    cam_Ziel[playerid] = (cam_Ort[playerid]+1);
		    if(cam_Ziel[playerid] > 6) cam_Ziel[playerid] = 0;
		}
		else if(lr < 0)
	    {//LINKS
		    cam_Ziel[playerid] = (cam_Ort[playerid]-1);
		    if(cam_Ziel[playerid] < 0) cam_Ziel[playerid] = 6;
	    }
	    if(lr > 0 || lr < 0)
	    {
			HideInfoMessage(playerid);
			switch(cam_Ziel[playerid])
			{
			    case 0:
			    {
					if(cam_Ort[playerid] == 1) cam_Ort[playerid] = 0;
					ShowInfoMessage(playerid,"Skin~<~Spielwelt beitreten~>~Karte~n~ENTER = Bestaetigen");
			    	if (cam_Ort[playerid] == 6) MovePlayerCamera(playerid, Float:{-2170.8876953125, 980.1259765625, -3.5658991336823}, Float:{-2165.8876953125, 980.1259765625, -3.5658991336823}, SLOW/3); // Zwischenschritt von Skinwahl weg
		        	else MovePlayerCamera(playerid, Float:{-2165.1530761719, 980.11785888672, -3.4176735877991}, Float:{-2140.8876953125, 980.11785888672, -3.4176735877991}, SLOW); // Zwischenschritt zur Raummitte
			    }
			    case 1:
			    {
			        ShowInfoMessage(playerid,"Spawn~<~Karte~>~Erfolge~n~ENTER = Bestaetigen");
		      		if (cam_Ort[playerid] == 6) MovePlayerCamera(playerid, Float:{-2170.8876953125, 980.1259765625, -3.5658991336823}, Float:{-2165.8876953125, 980.1259765625, -3.5658991336823}, SLOW); // Zwischenschritt von Skinwahl weg
		      		else MovePlayerCamera(playerid, Float:{-2165.1530761719, 980.11785888672, -3.4176735877991}, Float:{-2140.8876953125, 980.11785888672, -3.4176735877991}, SLOW); // Zwischenschritt zur Raummitte
			    }
			    case 2:
			    {
			        ShowInfoMessage(playerid,"Karte~<~Achievements~>~Statistik~n~ENTER = Bestaetigen");
			        if (cam_Ort[playerid] == 6) MovePlayerCamera(playerid, Float:{-2170.8876953125, 980.1259765625, -3.5658991336823}, Float:{-2165.8876953125, 980.1259765625, -3.5658991336823}, SLOW); // Zwischenschritt von Skinwahl weg
			        else if (cam_Ort[playerid] == 1) MovePlayerCamera(playerid, Float:{-2165.1530761719, 980.11785888672, -3.4176735877991}, Float:{-2140.8876953125, 980.11785888672, -3.4176735877991}, SLOW); // Zwischenschritt zur Raummitte
				    else OnPlayerFinishCameraMovement(playerid);
			    }
			    case 3:
			    {
			        ShowInfoMessage(playerid,"Erfolge~<~Statistiken~>~Sammelobjekte~n~ENTER = Bestaetigen");
			        if (cam_Ort[playerid] == 6) MovePlayerCamera(playerid, Float:{-2170.8876953125, 980.1259765625, -3.5658991336823}, Float:{-2165.8876953125, 980.1259765625, -3.5658991336823}, SLOW); // Zwischenschritt von Skinwahl weg
			        else if (cam_Ort[playerid] == 1) MovePlayerCamera(playerid, Float:{-2165.1530761719, 980.11785888672, -3.4176735877991}, Float:{-2140.8876953125, 980.11785888672, -3.4176735877991}, SLOW); // Zwischenschritt zur Raummitte
				    else OnPlayerFinishCameraMovement(playerid);
			    }
			    case 4:
			    {
			        ShowInfoMessage(playerid,"Statistik~<~Sammelobjekte~>~Optionen~n~ENTER = Bestaetigen");
			        if (cam_Ort[playerid] == 6) MovePlayerCamera(playerid, Float:{-2170.8876953125, 980.1259765625, -3.5658991336823}, Float:{-2165.8876953125, 980.1259765625, -3.5658991336823}, SLOW); // Zwischenschritt von Skinwahl weg
			        else if (cam_Ort[playerid] == 1) MovePlayerCamera(playerid, Float:{-2165.1530761719, 980.11785888672, -3.4176735877991}, Float:{-2140.8876953125, 980.11785888672, -3.4176735877991}, SLOW); // Zwischenschritt zur Raummitte
				    else OnPlayerFinishCameraMovement(playerid);
				}
				case 5:
				{
				    ShowInfoMessage(playerid,"Sammelobjekte~<~Einstellungen~>~Skinauwahl~n~ENTER = Bestaetigen");
			        if (cam_Ort[playerid] == 6) MovePlayerCamera(playerid, Float:{-2170.8876953125, 980.1259765625, -3.5658991336823}, Float:{-2165.8876953125, 980.1259765625, -3.5658991336823}, SLOW/2); // Zwischenschritt von Skinwahl weg
			        else if (cam_Ort[playerid] == 1) MovePlayerCamera(playerid, Float:{-2165.1530761719, 980.11785888672, -3.4176735877991}, Float:{-2140.8876953125, 980.11785888672, -3.4176735877991}, SLOW); // Zwischenschritt zur Raummitte
				    else OnPlayerFinishCameraMovement(playerid);
				}
				case 6:
				{
				    ShowInfoMessage(playerid,"Optionen~<~Skinauswahl~>~Spawn~n~ENTER = Bestaetigen");
				    if(cam_Ort[playerid] == 5) MovePlayerCamera(playerid, Float:{-2165.1530761719, 980.11785888672, -3.4176735877991}, Float:{-2140.8876953125, 980.11785888672, -3.4176735877991}, SLOW/4); // Zwischenschritt zur Raummitte
		        	else if(cam_Ort[playerid] != 0) MovePlayerCamera(playerid, Float:{-2165.1530761719, 980.11785888672, -3.4176735877991}, Float:{-2140.8876953125, 980.11785888672, -3.4176735877991}, SLOW); // Zwischenschritt zur Raummitte
					else OnPlayerFinishCameraMovement(playerid);
				}
			}
		}
	}
	else if(lr != 0 && !PlayerCamera[playerid][camMoving] && GetPVarInt(playerid,"cam_move_block") == 0)
	{//Nicht im Kontrollraum
	    if(PlayerEvent[playerid][IstTot] == 0)
	    {
	   		if(GetPVarInt(playerid,"hosp_cam") == 1)
			{
			    new new_aim = -1;
			    if(lr < 0)
			    {//Links
			        switch(cam_Ort[playerid])
			        {
			            case 4: new_aim = 3;//Start->Medizin
			            case 1: new_aim = 5;//Wiederbelebung->Operation
			            case 3: new_aim = 1;//Medizin->Wiederbelebung
			            case 5: new_aim = 3;//Operation->Medizin
			        }
			    }
			    else if(lr > 0)
			    {//Rechts
			        switch(cam_Ort[playerid])
			        {
			            case 4: new_aim = 5;//Start->Operation
			            case 1: new_aim = 3;//Wiederbelebung->Medizin
			            case 3: new_aim = 5;//Medizin->Operation
			            case 5: new_aim = 1;//Operation->Wiederbelebung
			        }
			    }
			    if(new_aim != -1)
			    {
					if(new_aim != 1 && new_aim != 3 && new_aim != 5) return 1;
					HideInfoMessage(playerid);
					cam_Ziel[playerid] = new_aim;
					OnPlayerFinishCameraMovement(playerid);
				}
				return 1;
			}
			if(GetPVarInt(playerid,"pizzaladen") == 1)
			{
			    HideInfoMessage(playerid);
				fixed_TextDrawHideForPlayer(playerid,PBarRAussen[0]);
				fixed_TextDrawHideForPlayer(playerid,PBarRAussen[2]);
				fixed_TextDrawHideForPlayer(playerid,PBarRInnen[0]);
				fixed_TextDrawHideForPlayer(playerid,PBarRInnen[2]);
				fixed_PlayerTextDrawHide(playerid,PBarStatus[playerid][0]);
				fixed_PlayerTextDrawHide(playerid,PBarStatus[playerid][2]);
				fixed_PlayerTextDrawHide(playerid,PBarText[playerid][0]);
				fixed_PlayerTextDrawHide(playerid,PBarText[playerid][1]);
				fixed_PlayerTextDrawHide(playerid,PBarText[playerid][2]);
				if(lr > 0)
				{
					SetPVarInt(playerid,"menue",GetPVarInt(playerid,"menue")+1);
					if(GetPVarInt(playerid,"menue") >= MAX_PIZZA_MENUES) SetPVarInt(playerid,"menue",0);
				}
				else if(lr < 0)
				{
	    			SetPVarInt(playerid,"menue",GetPVarInt(playerid,"menue")-1);
	    			if(GetPVarInt(playerid,"menue") < 0) SetPVarInt(playerid,"menue",MAX_PIZZA_MENUES-1);
				}
				new new_obj = GetPVarInt(playerid,"pizza_menu_oid");
				DeletePlayerSpecialObject(playerid,GetPlayerSlotBySpecialObject(playerid,new_obj));
				new_obj = CreatePlayerSpecialObject(playerid,food_PizzaMenu[GetPVarInt(playerid,"menue")][mpoid],376.08938599,-113.16246796,1001.55664062,331.55670166,29.90423584,75.31896973);
				SetPVarInt(playerid,"pizza_menu_oid",new_obj);
				UpdatePlayerShopScreen(playerid,SHOPSCREEN_PIZZA);
				return 1;
			}
			if(GetPVarInt(playerid,"waffenladen") == 1)
			{
			    HideInfoMessage(playerid);
				fixed_TextDrawHideForPlayer(playerid,PBarRAussen[0]);
				fixed_TextDrawHideForPlayer(playerid,PBarRAussen[2]);
				fixed_TextDrawHideForPlayer(playerid,PBarRInnen[0]);
				fixed_TextDrawHideForPlayer(playerid,PBarRInnen[2]);
				fixed_PlayerTextDrawHide(playerid,PBarStatus[playerid][0]);
				fixed_PlayerTextDrawHide(playerid,PBarStatus[playerid][2]);
				fixed_PlayerTextDrawHide(playerid,PBarText[playerid][0]);
				fixed_PlayerTextDrawHide(playerid,PBarText[playerid][1]);
				fixed_PlayerTextDrawHide(playerid,PBarText[playerid][2]);
			    new selected_weapon[2],bool:changed=false;
			    selected_weapon[0] = GetPVarInt(playerid,"waffe");
				if(lr > 0)
				{
					if(GetPVarInt(playerid,"waffe") == 7) SetPVarInt(playerid,"waffe",0);
					else SetPVarInt(playerid,"waffe",GetPVarInt(playerid,"waffe")+1);
				}
				if(lr < 0)
				{
					if(GetPVarInt(playerid,"waffe") == 0) SetPVarInt(playerid,"waffe",7);
					else SetPVarInt(playerid,"waffe",GetPVarInt(playerid,"waffe")-1);
				}
				selected_weapon[1] = GetPVarInt(playerid,"waffe");
				if(selected_weapon[0] == 0 && selected_weapon[1] == 7) changed = true;
				if(selected_weapon[0] == 1 && selected_weapon[1] == 2) changed = true;
				if(selected_weapon[0] == 2 && selected_weapon[1] == 1) changed = true;
				if(selected_weapon[0] == 3 && selected_weapon[1] == 4) changed = true;
				if(selected_weapon[0] == 4 && selected_weapon[1] == 3) changed = true;
				if(selected_weapon[0] == 5 && selected_weapon[1] == 6) changed = true;
				if(selected_weapon[0] == 6 && selected_weapon[1] == 5) changed = true;
				if(selected_weapon[0] == 7 && selected_weapon[1] == 0) changed = true;
				switch(GetPVarInt(playerid,"waffe"))
				{
				    case 0: MovePlayerCamera(playerid,Float:{-170.95971679688,1166.4010009766,88.382316589355},Float:{-171.05940246582,1171.5595703125,89.082313537598},changed?(SLOW/2):(SLOW/14));//Rifle
				    case 1: MovePlayerCamera(playerid,Float:{-170.93255615234,1166.2838134766,87.807281494141},Float:{-171.08158874512,1168.9095458984,87.982292175293},changed?(SLOW/3):(SLOW/6));//Sniper
				    case 2: MovePlayerCamera(playerid,Float:{-168.82713317871,1165.9116210938,88.432319641113},Float:{-168.91876220703,1170.2889404297,88.257308959961},changed?(SLOW/3):(SLOW/6));//AK47
				    case 3: MovePlayerCamera(playerid,Float:{-168.77124023438,1166.0306396484,88.052146911621},Float:{-168.88681030273,1168.4066162109,88.052146911621},changed?(SLOW/3):(SLOW/6));//M4
					case 4: MovePlayerCamera(playerid,Float:{-166.83256530762,1166.2414550781,88.527130126953},Float:{-166.70664978027,1168.7186279297,88.527130126953},changed?(SLOW/3):(SLOW/6));//Shotgun
					case 5: MovePlayerCamera(playerid,Float:{-166.80215454102,1166.4235839844,87.927093505859},Float:{-166.69657897949,1168.4664306641,88.002098083496},changed?(SLOW/4):(SLOW/6),changed?1:0);//Sawnoff
					case 6: MovePlayerCamera(playerid,Float:{-166.25897216797,1166.6573486328,88.37712097168},Float:{-164.80892944336,1166.6680908203,88.477127075195},changed?(SLOW/8):(SLOW/20),changed?1:0);//9mm
					case 7: MovePlayerCamera(playerid,Float:{-166.35874938965,1166.6614990234,87.952095031738},Float:{-164.18392944336,1166.6171875,88.002098083496},changed?(SLOW/2):(SLOW/6));//Deagle
				}
				return 1;
			}
			if(GetPVarInt(playerid,"liq_store") == 1)
			{
			    HideInfoMessage(playerid);
				fixed_TextDrawHideForPlayer(playerid,PBarRAussen[0]);
				fixed_TextDrawHideForPlayer(playerid,PBarRAussen[2]);
				fixed_TextDrawHideForPlayer(playerid,PBarRInnen[0]);
				fixed_TextDrawHideForPlayer(playerid,PBarRInnen[2]);
				fixed_PlayerTextDrawHide(playerid,PBarStatus[playerid][0]);
				fixed_PlayerTextDrawHide(playerid,PBarStatus[playerid][2]);
				fixed_PlayerTextDrawHide(playerid,PBarText[playerid][0]);
				fixed_PlayerTextDrawHide(playerid,PBarText[playerid][1]);
				fixed_PlayerTextDrawHide(playerid,PBarText[playerid][2]);
				new lpos = GetPVarInt(playerid,"liq_pos");
				if(lr > 0)	lpos++;
				if(lr < 0)	lpos--;
				if(lpos < 0)lpos = 5;
				if(lpos > 5)lpos = 0;
				SetPVarInt(playerid,"liq_pos",lpos);
				switch(lpos)
				{
					case 0: MovePlayerCamera(playerid,Float:{-234.3000031,2620.8999023,64.0999985},Float:{-234.1999969,2622.6999512,63.5000000},(SLOW/3),1);//Whiskey
					case 1: MovePlayerCamera(playerid,Float:{-232.3000031,2619.8000488,63.5999985},Float:{-230.5000000,2619.8999023,63.2000008},(SLOW/3),1);//Grün
					case 2: MovePlayerCamera(playerid,Float:{-232.1000061,2617.8999023,63.5999985},Float:{-230.5000000,2617.6999512,62.7000008},(SLOW/3),1);//Pisswasser
					case 3: MovePlayerCamera(playerid,Float:{-234.5000000,2617.3999023,63.2000008},Float:{-234.6000061,2616.6000977,62.7999992},(SLOW/3),1);//Schwarzbier
					case 4: MovePlayerCamera(playerid,Float:{-236.3000031,2617.6000977,63.0000000},Float:{-236.6000061,2616.6000977,62.7000008},(SLOW/3),1);//Zitronensaft
					case 5: MovePlayerCamera(playerid,Float:{-235.1999969,2619.6000977,63.5000000},Float:{-236.3000031,2620.0000000,63.0999985},(SLOW/3),1);//Wein
				}
			}
		}
	}
	return 1;
}

public OnPlayerStreamIn(playerid, forplayerid)
{
	if(IsPlayerNPC(playerid)) return 1;
	return 1;
}

public OnPlayerStreamOut(playerid, forplayerid)
{
	if(IsPlayerNPC(playerid)) return 1;
	return 1;
}

public OnVehicleStreamIn(vehicleid, forplayerid)
{
    car::OnVehicleStreamIn(vehicleid, forplayerid);
	return 1;
}

public OnVehicleStreamOut(vehicleid, forplayerid)
{
	return 1;
}

public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
	if(IsPlayerNPC(playerid)) return 1;
	return 1;
}

stock GenerateSkinList(playerid,list[],current_choice=0,s=sizeof(list))
{
	#pragma unused playerid
	for(new i; i<s; i++) list[i] = 0;
	new tmp = 0;
	for(new i; i<sizeof(__SKINLIST); i++)
	{
		list[tmp++] = __SKINLIST[i];
		printf("skin %d",__SKINLIST[i]);
	}
	if(0 <= current_choice <= strlen(list)) return list[current_choice];
	else return DEFAULT_SKIN;
}

stock CellPhoneFinishCall(playerid)
{
	switch(GetPVarInt(playerid,"pev_anrufen"))
	{
		case -1:
		{
			if(GetPVarInt(playerid,"pev_anrufen") != -1) return SendClientMessage(playerid,ROT,"ERROR: Du wirst nicht angerufen");
			new pid = GetPVarInt(playerid,"pev_anrufen_id");
			if(IsPlayerConnected(pid) && !IsPlayerNPC(pid) && GetPVarInt(pid,"pev_anrufen_id") == playerid)
			{
				SendPlayerMe(playerid," steckt das Handy wieder ein.");
				SendClientMessage(pid,ROT,"Hinweis: Dein Gesprächspartner hat den Anruf nicht angenommen");
				SetPlayerSpecialAction(pid,SPECIAL_ACTION_STOPUSECELLPHONE);
				DeletePVar(pid,"pev_anrufen");
				DeletePVar(pid,"pev_anrufen_id");
			}
			SendPlayerMe(playerid," drückt den Anruf weg.");
			SendClientMessage(playerid,ROT,"Hinweis: Du hast aufgelegt");
			DeletePVar(playerid,"pev_anrufen");
			DeletePVar(playerid,"pev_anrufen_id");
		}
		case 0: return 0;
		case 1: return 0;
		case 2:
		{//Wartet auf abnahme
			new pid = GetPVarInt(playerid,"pev_anrufen_id");
			if(IsPlayerConnected(pid) && GetPVarInt(pid,"pev_anrufen_id") == playerid)
			{
				SendPlayerMe(pid,"'s Handy hört auf zu klingeln");
				SendClientMessage(pid,GRUEN,"INFO: Dein Handy klingelt nicht mehr");
				DeletePVar(pid,"pev_anrufen");
				DeletePVar(pid,"pev_anrufen_id");
			}
			SendPlayerMe(playerid," steckt sein Handy wieder ein.");
			SendClientMessage(playerid,GRUEN,"INFO: Du hast aufgelegt");
			SetPlayerSpecialAction(playerid,SPECIAL_ACTION_STOPUSECELLPHONE);
			DeletePVar(playerid,"pev_anrufen");
			DeletePVar(playerid,"pev_anrufen_id");
		}
		case 3:
		{//Im anruf
			new pid = GetPVarInt(playerid,"pev_anrufen_id");
			if(IsPlayerConnected(pid) && GetPVarInt(pid,"pev_anrufen_id") == playerid)
			{
				SendPlayerMe(playerid," steckt sein Handy wieder ein.");
				SendClientMessage(pid,GRUEN,"INFO: Dein Gesprächspartner hat aufgelegt");
				SetPlayerSpecialAction(playerid,SPECIAL_ACTION_STOPUSECELLPHONE);
				DeletePVar(pid,"pev_anrufen");
				DeletePVar(pid,"pev_anrufen_id");
			}
			SendPlayerMe(playerid," steckt sein Handy wieder ein.");
			SendClientMessage(pid,GRUEN,"INFO: Du hast aufegelegt");
			SetPlayerSpecialAction(playerid,SPECIAL_ACTION_STOPUSECELLPHONE);
			DeletePVar(playerid,"pev_anrufen");
			DeletePVar(playerid,"pev_anrufen_id");
		}
	}
	return 1;
}

stock SendPlayerMe(playerid,msg[])
{
	new count,Float:p[3];
	GetPlayerPos(playerid,p[0],p[1],p[2]);
	format(query,sizeof(query),"* %s%s",GetName(playerid),msg);
	for(new i; i<=__SERVER[HIGHEST_PLAYER_ID]; i++)
	{
	    if(!IsPlayerConnected(i) || IsPlayerNPC(i)) continue;
	    SendClientMessage(i,0x800080FF,query);
	    count++;
	}
	return count;
}

stock SetPlayerMissionCP(playerid,Float:x,Float:y,Float:z,Float:mis_radius=1.5)
{
	if(!IsPlayerConnected(playerid)) return 0;
	if(PlayerInfo[playerid][pOnMission])
	{
	    DestroyPlayerObject(playerid,PlayerInfo[playerid][pMissionFlare]);
	    DisablePlayerCheckpoint(playerid);
	}
	PlayerInfo[playerid][pOnMission] = true;
	PlayerInfo[playerid][pMissionCP][0] = x;
	PlayerInfo[playerid][pMissionCP][1] = y;
	PlayerInfo[playerid][pMissionCP][2] = z;
	PlayerInfo[playerid][pMissionCP][3] = mis_radius;
	PlayerInfo[playerid][pMissionFlare] = CreatePlayerSpecialObject(playerid,18728,x,y,z-2.0,0.0,0.0,0.0,100.0);
	SetPlayerCheckpoint(playerid,x,y,z,mis_radius);
	return 1;
}

stock DisablePlayerMissionCP(playerid)
{
	if(!IsPlayerConnected(playerid)) 		return 0;
	if(!PlayerInfo[playerid][pOnMission]) 	return 0;
    DestroyPlayerObject(playerid,PlayerInfo[playerid][pMissionFlare]);
    DisablePlayerCheckpoint(playerid);
	PlayerInfo[playerid][pOnMission] 	= false;
	PlayerInfo[playerid][pMissionCP][0] = 0.0;
	PlayerInfo[playerid][pMissionCP][1] = 0.0;
	PlayerInfo[playerid][pMissionCP][2] = 0.0;
	PlayerInfo[playerid][pMissionCP][3] = 0.0;
	return 1;
}

stock HideInfobox(playerid)
{
    if(GetPVarInt(playerid,"infobox_display") == 0) return 0;
	fixed_TextDrawHideForPlayer(playerid,Infobox_0);
	fixed_TextDrawHideForPlayer(playerid,Infobox_1);
	fixed_PlayerTextDrawHide(playerid,Infobox_Header[playerid]);
	fixed_PlayerTextDrawHide(playerid,Infobox_Body[playerid]);
	fixed_PlayerTextDrawDestroy(playerid,Infobox_Header[playerid]);
	fixed_PlayerTextDrawDestroy(playerid,Infobox_Body[playerid]);
    SetPVarInt(playerid,"infobox_time",0);
    SetPVarInt(playerid,"infobox_display",0);
    return 1;
}

stock DisplayInfobox(playerid,header[]="",body[]="",displaytime=-1,bool:overwrite=true)
{
	if(GetPVarInt(playerid,"infobox_display") != 0)
	{
	    if(!overwrite) return 0;
	    SetPVarInt(playerid,"infobox_display",1);
	    SetPVarInt(playerid,"infobox_time",displaytime);
	    PlayerTextDrawSetString(playerid,Infobox_Header[playerid],header[0]?header:(" "));
	    PlayerTextDrawSetString(playerid,Infobox_Body[playerid],body[0]?body:(" "));
	    return 1;
	}
	Infobox_Header[playerid] = CreatePlayerTextDraw(playerid,349.000000, 370.000000,header[0]?header:(""));
	PlayerTextDrawAlignment(playerid,Infobox_Header[playerid], 2);
	PlayerTextDrawBackgroundColor(playerid,Infobox_Header[playerid], 255);
	PlayerTextDrawFont(playerid,Infobox_Header[playerid], 2);
	PlayerTextDrawLetterSize(playerid,Infobox_Header[playerid], 0.390000, 1.000000);
	PlayerTextDrawColor(playerid,Infobox_Header[playerid], -1);
	PlayerTextDrawSetOutline(playerid,Infobox_Header[playerid], 0);
	PlayerTextDrawSetProportional(playerid,Infobox_Header[playerid], 1);
	PlayerTextDrawSetShadow(playerid,Infobox_Header[playerid], 1);
	PlayerTextDrawUseBox(playerid,Infobox_Header[playerid], 1);
	PlayerTextDrawBoxColor(playerid,Infobox_Header[playerid], 255);
	PlayerTextDrawTextSize(playerid,Infobox_Header[playerid], 50.000000, 267.000000);

	Infobox_Body[playerid] = CreatePlayerTextDraw(playerid,215.000000, 380.000000,body[0]?body:(" "));
	PlayerTextDrawBackgroundColor(playerid,Infobox_Body[playerid], 255);
	PlayerTextDrawFont(playerid,Infobox_Body[playerid], 1);
	PlayerTextDrawLetterSize(playerid,Infobox_Body[playerid], 0.320000, 1.400000);
	PlayerTextDrawColor(playerid,Infobox_Body[playerid], -1);
	PlayerTextDrawSetOutline(playerid,Infobox_Body[playerid], 0);
	PlayerTextDrawSetProportional(playerid,Infobox_Body[playerid], 1);
	PlayerTextDrawSetShadow(playerid,Infobox_Body[playerid], 1);

	fixed_TextDrawHideForPlayer(playerid,Infobox_0);
	fixed_TextDrawHideForPlayer(playerid,Infobox_1);
	fixed_TextDrawShowForPlayer(playerid,Infobox_0);
	fixed_TextDrawShowForPlayer(playerid,Infobox_1);
	fixed_PlayerTextDrawShow(playerid,Infobox_Header[playerid]);
	fixed_PlayerTextDrawShow(playerid,Infobox_Body[playerid]);
	SetPVarInt(playerid,"infobox_display",1);
	SetPVarInt(playerid,"infobox_time",displaytime);
	return 1;
}

stock CountAttachedObjects(playerid)
{
    new count;
    for(new i=0; i<MAX_PLAYER_ATTACHED_OBJECTS; i++) if(IsPlayerAttachedObjectSlotUsed(playerid, i)) count++;
    return count;
}

stock GetFreeAttachedSlots(playerid) return (MAX_PLAYER_ATTACHED_OBJECTS-CountAttachedObjects(playerid));

forward timer_1000();
public timer_1000()
{
	new Float:__x,Float:__y,Float:__z,
		timestamp = gettime(_,_,_);
	for(new playerid; playerid<=__SERVER[HIGHEST_PLAYER_ID]; playerid++)
	{
	    if(!IsPlayerConnected(playerid) || IsPlayerNPC(playerid)) continue;
	    if(GetPVarInt(playerid,"attacked_time") > 0) SetPVarInt(playerid,"attacked_time",GetPVarInt(playerid,"attacked_time")-1);

		if(GetPVarInt(playerid,"am_showinfodraw") >= 1)
		{//Achievement textdraw info entfernen
		    SetPVarInt(playerid,"am_showinfodraw",GetPVarInt(playerid,"am_showinfodraw")-1);
		    if(GetPVarInt(playerid,"am_showinfodraw") == 0)
			{
			    SetPVarInt(playerid,"am_showinfodraw",1);
				achievement::HideInfoDraw(playerid);
			}
		}

		if(PlayerInfo[playerid][pScreenHide] >= 1)
	    {
	        if(PlayerEvent[playerid][LOGGED_IN])
	        {
		        if(--PlayerInfo[playerid][pScreenHide] == 0)
				{
				    //TUTORIAL
				    if(PlayerEvent[playerid][TutorialStep][0] == 2)
				    {//tutorial start, landung
			            w_SetPlayerPos(playerid,-810.4742,2431.3218,156.9691);
			            SetPlayerMissionCP(playerid,-774.2107,2419.3347,157.0974);
				        ShowPlayerDialog(playerid,dialog_NULL,DIALOG_STYLE_MSGBOX,"Ein seltsames Rauschen ertoent...","{C87E35}Unbekannte Quelle:\n{F1F7DC}\"Ha..o... ..h ...auch hi..e!! B...e hil.. m.. ....\n\n\nHinweis: Du solltest die Ursache ausfindig machen\"","Ok","");
				    }
				    if(PlayerEvent[playerid][TutorialStep][1] == 9)
				    {//Betreten des hauses
				        PlayerEvent[playerid][TutorialStep][0] = 4;
				        PlayerEvent[playerid][TutorialStep][1] = 0;
					    SetPlayerInterior(playerid,2);
					    SetPlayerVirtualWorld(playerid,(playerid+2000));
					    w_SetPlayerPos(playerid,660.9033,-2359.6565,15.6357);
					    SetPlayerFacingAngle(playerid,351.0);
					    DeletePlayerSpecialObject(playerid,OBJECT_TYPE_ALL);
					    SetPlayerMissionCP(playerid,660.72961425781,-2341.8791503906,15.224309921265);
						SetPVarInt(playerid,"tutorial_gate_oid",CreatePlayerSpecialObject(playerid,5422,583.58001709,-2429.06860352,11.83831120,0.00000000,0.00000000,167.48107910,50.0));///Geschlossenes Tor!!!!11elf
						ShowPlayerDialog(playerid,dialog_NULL,DIALOG_STYLE_MSGBOX,"Du hast das Haus betreten...","{878375}Du nimmst einen widerlichen Gestank wahr...\nSuche nach der Ursache","Ok","");
						quest::OnQuestUpdate(playerid,0,9);
					}
				    /*if(PlayerEvent[playerid][TutorialStep][0] == 5)
				    {//Tut quasi zuende, Spawn im Ort
				        SetPlayerMissionCP(playerid,-227.41728210449,2710.6909179688,62.9765625);
				    }*/
				    if(PlayerEvent[playerid][TutorialStep][0] == 1 && PlayerEvent[playerid][TutorialStep][1] == 1)
				    {
				        ShowPlayerDialog(playerid,dialog_NULL,DIALOG_STYLE_MSGBOX,"Während des Fluges...","{C87E35}Pilot (Lautsprecher):\n{F1F7DC}\"Wir sind ueber dem Zielort, jedoch gibt es ein Problem! Wir\nmuessen zurueck um eines der Teams im Kampf zu unterstuetzen,\nfuer eine Landung bleibt keine Zeit, sie muessen aus dem Flugzeug\nspringen. Aber keine Sorgen ziehen sie die Leine wenn Sie\nden Boden sehen. Viel Glueck!\"\n\n\n{878375}Hinweis:\n- Springe aus dem Flugzeug","Ok","");
				        SetPlayerFacingAngle(playerid,100.0);
					}
					TogglePlayerControllable(playerid,true);
				    fixed_TextDrawHideForPlayer(playerid,ScreenHide);
				    fixed_TextDrawHideForPlayer(playerid,LoadDraw);
				}
			}
	    }// ende screenhide
	    if(GetPVarInt(playerid,"infobox_time") >= 1)
	    {
	        SetPVarInt(playerid,"infobox_time",GetPVarInt(playerid,"infobox_time")-1);
	        if(GetPVarInt(playerid,"infobox_time") == 0) HideInfobox(playerid);
	    }
	    
	    if(PlayerInfo[playerid][Connection] >= 1)
	    {//Während des Logins
	        if(--PlayerInfo[playerid][Connection] == 0) ShowPlayerLoginScreen(playerid);
	        else
	        {
				SetPlayerPos(playerid,-2171.9487,973.8623,-4.0091);
				SetPlayerFacingAngle(playerid,30.0);
				SetPlayerInterior(playerid,0);
				SetPlayerVirtualWorld(playerid,(playerid+2000));
			    TogglePlayerControllable(playerid,false);
	        }
	        continue;
	    }
	    
		GetPlayerPos(playerid,__x,__y,__z);
		if(PlayerEvent[playerid][LOGGED_IN])
		{
		    UpdatePlayerNametag(playerid);
		    if(GetPVarInt(playerid,"car_keystate_fix") == 1) SetPVarInt(playerid,"car_keystate_fix",0);
	        if(GetPVarInt(playerid,"onplayercmd_muted") >= 1)
			{
				SetPVarInt(playerid,"onplayercmd_muted",GetPVarInt(playerid,"onplayercmd_muted")-1);
				if(GetPVarInt(playerid,"onplayercmd_muted") == 0) SendClientMessage(playerid,-1,#FORMAT_CHAT_INFO"Du kannst nun wieder Commands benutzen.");
			}
	        if(GetPVarInt(playerid,"onplayertext_muted") >= 1)
			{
				SetPVarInt(playerid,"onplayertext_muted",GetPVarInt(playerid,"onplayertext_muted")-1);
				if(GetPVarInt(playerid,"onplayertext_muted") == 0) SendClientMessage(playerid,-1,#FORMAT_CHAT_INFO"Du kannst nun wieder normal sprechen.");
			}
			if(GetPVarInt(playerid,"badword_mute") >= 1)
			{
			    SetPVarInt(playerid,"badword_mute",GetPVarInt(playerid,"badword_mute")-1);
			    if(GetPVarInt(playerid,"badword_mute") == 0) SendClientMessage(playerid,-1,#FORMAT_CHAT_INFO"Du kannst nun wieder normal sprechen.");
			}

		
		    if(PlayerEvent[playerid][TutorialStep][0] == 1 && PlayerEvent[playerid][TutorialStep][1] >= 1)
		    {//Im flugzeug
		        if(__z < 7000.0)
		        {
		            SetPVarInt(playerid,"flystep",GetPVarInt(playerid,"flystep")+1);
		            if(GetPVarInt(playerid,"flystep") == 9)
		            {
		                SetPVarInt(playerid,"flystep",0);
						switch(++PlayerEvent[playerid][TutorialStep][1])
						{
							case 2: GameTextForPlayer(playerid,"Willkommen auf Postnuke Wasteland!",7000,3);
							case 3: GameTextForPlayer(playerid,"Dem wohl besten Endzeit-Roleplay-Server aller Zeiten!",7000,3);
							case 4: GameTextForPlayer(playerid,"Die Welt liegt in Truemmern, ueberall lauert der Tod!",7000,3);
							case 5: GameTextForPlayer(playerid,"Du benoetigst Staerke, Intelligenz und/oder Sympathie um zu ueberleben.",7000,3);
							case 6: GameTextForPlayer(playerid,"Oder - ganz klassisch - Viele Waffen und SEHR viel Munition.",7000,3);
							case 7: GameTextForPlayer(playerid,"Auf welcher Seite stehst du? Gang oder Staat? Oder etwas ganz Anderes?",7000,3);
							case 8: GameTextForPlayer(playerid,"Entscheide DU und beherrsche vielleicht irgendwann ganz San Andreas!",7000,3);
							case 9:
							{
								PlayerEvent[playerid][TutorialStep][0] = 2;
								PlayerEvent[playerid][TutorialStep][1] = 0;
					            w_SetPlayerPos(playerid,-810.4742,2431.3218,156.9691,_,2);
					            SetPlayerFacingAngle(playerid,210.0);
					            SetPlayerInterior(playerid,0);
					            SetPlayerMissionCP(playerid,-774.2107,2419.3347,157.0974);
				                DeletePlayerSpecialObject(playerid,OBJECT_TYPE_ALL);
								format(query,sizeof(query),"UPDATE pnwl_user_event SET tutorial='2' WHERE userid='%d'",PlayerInfo[playerid][PLAYER_ID]);
								mysql_query_once(query);
							}
						}
		            }
		        }
		    }
		    
		    //Weaponstats
		    if(GetPlayerWeapon(playerid) != 0)
		    {
		        new wstring[15];
				format(wstring,sizeof(wstring),"w_%d_TIME",GetPlayerWeapon(playerid));
				SetPVarInt(playerid,wstring,GetPVarInt(playerid,wstring)+1);
		    }
		    
			if(PlayerStatus[playerid][KoTime] >= 1)
			{
			    if(PlayerStatus[playerid][KoTime] > MAX_KO_TIME) PlayerStatus[playerid][KoTime] = MAX_KO_TIME;
			    if(--PlayerStatus[playerid][KoTime] == 0)
			    {
			        ClearAnimations(playerid);
			        UpdateStatusProgressBar(playerid);//Hide
			    }
			    else
			    {
				    if(IsPlayerInAnyVehicle(playerid))
					{
						if(car::IsBike(GetPlayerVehicleID(playerid)))
						{
						    new Float:p[3];
						    GetPlayerPos(playerid,p[0],p[1],p[2]);
							RemovePlayerFromVehicle(playerid);
							SetPlayerPos(playerid,p[0],p[1],p[2]);
						    ApplyAnimation(playerid,"PED","BIKE_fall_off",4.0,0,1,1,0,0,1);
						}
					}
					UpdateStatusProgressBar(playerid,(float(PlayerStatus[playerid][KoTime])/float(MAX_KO_TIME))*100.0);
			    }
		    }
		    
		    if(IsPlayerAttachedObjectSlotUsed(playerid,BLEEDING_SLOT)) RemovePlayerAttachedObject(playerid,BLEEDING_SLOT);
			if(PlayerStatus[playerid][BleedingLevel] > 0.0)
			{
			    new Float:hp;
			    GetPlayerHealth(playerid,hp);
			    SetPlayerHealth(playerid,hp-PlayerStatus[playerid][BleedingLevel]);
				SetPlayerAttachedObject(playerid,BLEEDING_SLOT,18706,Spine,0.088999,0.020000,0.044999,0.088999,0.020000,0.044999,1.179000,1.510999,0.005000,0xFFFF0000,0xFFFF0000);
		    }
		    
		    if(GetPVarInt(playerid,"motor_an") >= 1)
		    {
		        if(!IsPlayerInAnyVehicle(playerid))
				{
					HideInfobox(playerid);
                    DeletePVar(playerid,"motor_an");
                    DeletePVar(playerid,"motor_type");
                }
                else
                {
					SetPVarInt(playerid,"motor_an",GetPVarInt(playerid,"motor_an")-1);
			        if(GetPVarInt(playerid,"motor_an") == 0)
			        {
			            HideInfobox(playerid);
						if(GetPVarInt(playerid,"motor_type") == 0)
						{//Starten
			            	HidePlayerDialog(playerid);
							if(car::StartEngine(GetPlayerVehicleID(playerid)))
							{
							    DisplayInfobox(playerid,"~w~Motor ~g~gestartet","~w~Du hast den Motor ~g~gestartet~w~.",3,false);
		    	        		SendClientMessage(playerid,-1,#FORMAT_CHAT_INFO"Du hast den Motor erfolgreich gestartet.");
		    	        	}
		    	        	else DisplayInfobox(playerid,"~w~Motor ~r~nicht ~w~gestartet","~w~Das Fahrzeug hat zu ~r~wenig ~w~Benzin zu starten.",3,false);
		    	        	return 1;
						}
						else//Kurzschließen
						{
						    new veh = GetPlayerVehicleID(playerid);
							new next_pick = floatround(floatrandom(200.0-PlayerSkill[playerid][SkillGlueck]*2)+400.0);
							if(floatrandom((PlayerSkill[playerid][SkillGlueck]+PlayerSkill[playerid][SkillGeschick])/200.0) >= 1.0)
						     {//Erfolg
								car::StartEngine(GetPlayerVehicleID(playerid));//Motor stARTEN
								format(string,sizeof(string),"{C85135}Du hast den Motor des Fahrzeuges erfolgreich kurzgeschlossen. Du kannst\nin %d Sekunden das nächste Schloss knacken/Fahrzeug kurzschließen",next_pick);
								car::ShowPlayerDialog(playerid,dialog_CAR_IN_MAINRE,DIALOG_STYLE_MSGBOX,"{F1F7DC}Auto",string,"","");
							}
							else
							{//Kein Erfolg
								if(VehicleInfo[veh][cAlarm][1] != 0 && VehicleInfo[veh][cAlarm][1] >= 1)
								{
									car::ActivateVehicleAlarm(veh,floatround(float(5)*float(VehicleInfo[veh][cAlarm][1])),true);
									format(string,sizeof(string),"{C85135}ACHTUNG: Du konntest das Fahrzeug nicht kurzschließen, der Alarm wurde ausgelöst.\nDu kannst das nächste Schloss/Fahrzeug in %d Sekunden knacken/kurzschließen",next_pick);
									ShowPlayerDialog(playerid,dialog_NULL,DIALOG_STYLE_MSGBOX,"{F1F7DC}Auto",string,"","");
								}
								else
								{
									format(string,sizeof(string),"{C85135}ACHTUNG: Du konntest den Motor nicht kurzschließen. Du kannst das\nnächste Schloss/Fahrzeug in %d Sekunden knacken/kurzschließen",next_pick);
									car::ShowPlayerDialog(playerid,dialog_CAR_IN_MAINRE,DIALOG_STYLE_MSGBOX,"{F1F7DC}Auto",string,"","");
								}
							}
							SetPVarInt(playerid,"next_lockpick",next_pick);
						}
					}
					else
					{
					    if(GetPVarInt(playerid,"motor_type") == 0)
					    {
					        format(string,sizeof(string),"Du versuchst den Motor ~g~anzuschalten~w~.~n~.....%d",GetPVarInt(playerid,"motor_an"));
					        DisplayInfobox(playerid,"Motor ~g~anschalten",string);
					    }
						else
						{
					        format(string,sizeof(string),"Du versuchst den Motor ~r~kurzzuschliessen~w~.~n~.....%d",GetPVarInt(playerid,"motor_an"));
					        DisplayInfobox(playerid,"Motor ~g~kurzschliessen",string);
						}
					}
				}
		    }
		    if(GetPVarInt(playerid,"pev_train") != 0)
		    {
		        switch(GetPVarInt(playerid,"pev_train"))
		        {
		            case 1:
		            {//Fahrrad
		                new ticks = GetPVarInt(playerid,"pev_train_ticks");
		                if(ticks == 0) SetPVarInt(playerid,"pev_train_stage",0);
	                    if(ticks <= 2) SetPVarInt(playerid,"pev_train_stage",GetPVarInt(playerid,"pev_train_stage")-1);
						else if(ticks >= 4) SetPVarInt(playerid,"pev_train_stage",GetPVarInt(playerid,"pev_train_stage")+1);
		                if(GetPVarInt(playerid,"pev_train_stage") < 0) SetPVarInt(playerid,"pev_train_stage",0);
		                if(GetPVarInt(playerid,"pev_train_stage") > 4) SetPVarInt(playerid,"pev_train_stage",4);
		                switch(GetPVarInt(playerid,"pev_train_stage"))
		                {
		                    case 0: ApplyAnimation(playerid,"GYMNASIUM","gym_bike_still",4.0,1,1,1,1,0,1);
							case 1: ApplyAnimation(playerid,"GYMNASIUM","gym_bike_slow",4.0,1,1,1,1,0,1);
							case 2: ApplyAnimation(playerid,"GYMNASIUM","gym_bike_pedal",4.0,1,1,1,1,0,1);
							case 3: ApplyAnimation(playerid,"GYMNASIUM","gym_bike_fast",4.0,1,1,1,1,0,1);
							case 4: ApplyAnimation(playerid,"GYMNASIUM","gym_bike_faster",4.0,1,1,1,1,0,1);
		                }
		                SetPVarInt(playerid,"pev_train_ticks",0);
		            }
		            case 2:
		            {//Laufband
		                new ticks = GetPVarInt(playerid,"pev_train_ticks");
		                if(ticks == 0) SetPVarInt(playerid,"pev_train_stage",0);
	                    if(ticks <= 2) SetPVarInt(playerid,"pev_train_stage",GetPVarInt(playerid,"pev_train_stage")-1);
						else if(ticks >= 4) SetPVarInt(playerid,"pev_train_stage",GetPVarInt(playerid,"pev_train_stage")+1);
		                if(GetPVarInt(playerid,"pev_train_stage") < 0) SetPVarInt(playerid,"pev_train_stage",0);
		                if(GetPVarInt(playerid,"pev_train_stage") > 3) SetPVarInt(playerid,"pev_train_stage",3);
		                switch(GetPVarInt(playerid,"pev_train_stage"))
		                {
		                    case 0: ApplyAnimation(playerid,"GYMNASIUM","gym_tread_tired",4.0,1,1,1,1,0,1);
							case 1: ApplyAnimation(playerid,"GYMNASIUM","gym_tread_walk",4.0,1,1,1,1,0,1);
							case 2: ApplyAnimation(playerid,"GYMNASIUM","gym_tread_jog",4.0,1,1,1,1,0,1);
							case 3: ApplyAnimation(playerid,"GYMNASIUM","gym_tread_sprint",4.0,1,1,1,1,0,1);
		                }
		                SetPVarInt(playerid,"pev_train_ticks",0);
		            }
		            case 3:
		            {//Hanteln
		                new ticks = GetPVarInt(playerid,"pev_train_ticks");
	                    if(ticks >= 5)	ApplyAnimation(playerid,"Freeweights","gym_free_up_smooth",4.0,1,1,1,1,0,1);
	                    else            ApplyAnimation(playerid,"Freeweights","gym_free_loop",4.0,1,1,1,1,0,1);
		                SetPVarInt(playerid,"pev_train_ticks",0);
		            }
			 	}
		    }
		    if(GetPVarInt(playerid,"pev_training_fightstyle_step") >= 1)
			{
				SetPVarInt(playerid,"pev_train_abkling",0);
				if(GetPVarInt(playerid,"pev_training_fightstyle_step") == 1)
				{
				    new keys,ud,lr;
				    GetPlayerKeys(playerid,keys,ud,lr);
   	    	        if(keys == (KEY_AIM | KEY_JUMP))
					{
					    SetPVarInt(playerid,"pev_training_fightstyle_value",GetPVarInt(playerid,"pev_training_fightstyle_value")-1);
					    if(GetPVarInt(playerid,"pev_training_fightstyle_value") == 0)
					    {
					        SetPVarInt(playerid,"pev_training_fightstyle_step",2);
							SetPlayerPos(playerid,-1471.5801,2614.0835,41.5738);
							SetPlayerFacingAngle(playerid,272.6473);
							SetCameraBehindPlayer(playerid);
						    format(string,sizeof(string),"{C87E35}Chuck (Kampfsportler):\n\"{F1F7DC}\
						    Also gut, pass auf! Du siehst den Boxsack vor dir? Jetzt wirst du an\n\
						    ihm einige spezielle Kampftechniken ausprobieren. Stell dich vor ihn\n\
						    und verprügle ihn mit der linken Maustaste!{C87E35}\"");
						    ShowPlayerDialog(playerid,dialog_NULL,DIALOG_STYLE_MSGBOX,"{C87E35}Gespräch mit Chuck",string,"Weiter","");
		    	            DisplayInfobox(playerid,"Training: ~r~Angriff 1","~w~Schlage den Boxsack ~r~10~w~ mal im Stand~n~=> Tastenkombo: ~g~LMB");
					    }
					    else
					    {
					    	format(string,sizeof(string),"~w~Gehe ~r~%d~w~ Sekunden lang mit in die Abwehrposition~n~=> Tastenkombo: ~g~RMB~w~+~g~SHIFT",GetPVarInt(playerid,"pev_training_fightstyle_value"));
					    	DisplayInfobox(playerid,"Training: ~r~Abwehr",string);
					    }
					}
			    }
			}
			if(PlayerInfo[playerid][IsInCRoom] == 0)
			{
				if(GetPVarInt(playerid,"running") == 1 && !IsPlayerInAnyVehicle(playerid))
				{//Rennt -> Ausdauer verbrauchen
				    SetPVarInt(playerid,"running",0);
				    PlayerEvent[playerid][Ausdauer] -= 7.0;
				}
				else
				{//Rennt nicht -> Ausdauerregeneration
				    SetPVarInt(playerid,"running",0);
				    PlayerEvent[playerid][Ausdauer] += 4.0;
				    if(PlayerEvent[playerid][Ausdauer] > 100.0) PlayerEvent[playerid][Ausdauer] = 100.0;
				    if(!PlayerEvent[playerid][CanRun])
				    {
				    	if(PlayerEvent[playerid][Ausdauer] > 20.0)
				    	{
				    		PlayerEvent[playerid][CanRun] = true;
				    		ClearAnimations(playerid);
				    	}
				    }
				}
				ManageAusdauerDraw(playerid,(PlayerEvent[playerid][Ausdauer] == 100.0)?(false):(true));
				
				if(PlayerEvent[playerid][IstTot] == 0)
				{
					if(GetPVarInt(playerid,"am_bullseye") > 0)
					{
					    new am_id = __amCache[amBullseye];
					    if(am_id != -1)
					    {
					        achievement::SetPlayerAchievementData(playerid,am_id,GetPVarInt(playerid,"Bullseye"));
					        SetPVarInt(playerid,"Bullseye",0);
					    }
					}
					
					new Float:hp;
					GetPlayerHealth(playerid,hp);
					
					if(hp < 25.0)	status::ToggleBloodscreen(playerid,true);
					else            status::ToggleBloodscreen(playerid,false);
			        if(GetPVarInt(playerid,"holding_f_iFAct") >= 1)
			        {
			            new keys,ud,lr;
			            GetPlayerKeys(playerid,keys,ud,lr);
			            if(keys != KEY_SECONDARY_ATTACK) item::StopPlayerInteract(playerid);
			            else
			            {
						    new itemid = (PlayerCache[playerid][holding_item] >= 1 && PlayerCurrentWeaponSlot[playerid] == 0)?PlayerCache[playerid][holding_item]:PlayerCache[playerid][equip_fist_item];
							if(item_ItemInfo[itemid][iAction] & canUse || item_ItemInfo[itemid][iAction] & canInteract)
							{
							    format(string,sizeof(string),"item_Interact_%s",item::ConvertNameToFunc(itemid),string);
							    CallRemoteFunction(string,"d",playerid);
							}
							else item::StopPlayerInteract(playerid);
			            }
			        }
				}
			}

			if(GetPVarInt(playerid,"can_mine") > 0) SetPVarInt(playerid,"can_mine",GetPVarInt(playerid,"can_mine")-1);
			if((timestamp-GetPVarInt(playerid,"fixed_scm_last")) >= CHAT_REMOVE_LINE)
			{
				SetPVarInt(playerid,"fixed_scm_last",timestamp);
				SendClientMessage(playerid,-1," ");
			}
		}//end logged in
		if(PlayerEvent[playerid][FrozenTime]) PlayerEvent[playerid][FrozenTime]--;
	    SetPlayerTime(playerid,__SERVER[GLOBAL_TIME][0],__SERVER[GLOBAL_TIME][1]);
	}
	
	if(GlobalVote[voteID])
	{
		GlobalVote[voteTimeLeft] -= 1;
		if(GlobalVote[voteTimeLeft] <= 0)
		{
			CORE::OnVoteEnd();
		}
	}

	if(BoxTime >= 1)
	{//Boxkampf
	    if(--BoxTime == 0) OnEndBoxfight();//Zeit ist um
	    else
	    {
	        new winner = GetPVarFloat(BoxerID[0],"box_hp")>GetPVarFloat(BoxerID[1],"box_hp")?BoxerID[0]:-1;
	        if(winner == -1) winner = GetPVarFloat(BoxerID[1],"box_hp")>GetPVarFloat(BoxerID[0],"box_hp")?BoxerID[1]:-1;
	        format(string,sizeof(string),"~w~%s %s%d~n~~w~%s %s%d",\
		        GetName(BoxerID[0]),(winner==-1||winner==BoxerID[0])?("~g~"):("~r~"),\
		        GetName(BoxerID[1]),(winner==-1||winner==BoxerID[1])?("~g~"):("~r~"));
		    format(query,sizeof(query),"~w~Boxkampf, ~r~%d~w~sek",BoxTime);
			for(new i; i<__SERVER[HIGHEST_PLAYER_ID]; i++)
			{
			    if(IsPlayerNPC(i) || !IsPlayerConnected(i))							continue;
			    if(!IsPlayerInRangeOfPoint(i,15.0,-2118.6000,1721.9000,21.2000))	continue;
				DisplayInfobox(i,query,string,2);
			}
	    }
	}
	
	if(++__SERVER[TIMER][0] >= 5)  	timer_5000();//    5 Sekunden
	if(++__SERVER[TIMER][1] >= 10) 	timer_10000();//  10 Sekunden

	if(++__SERVER[CURRENT_HOSTNAME] >= sizeof(Hostnames)) __SERVER[CURRENT_HOSTNAME] = 0;
   	format(string,sizeof(string),"hostname %s",Hostnames[__SERVER[CURRENT_HOSTNAME]]);
    SendRconCommand(string);
	return 1;
}

timer_300000()
{//5 Minuten
    //print("timer_300000");
	__SERVER[TIMER][2] = 0;
	new am_id = -1;
	for(new playerid; playerid<__SERVER[HIGHEST_PLAYER_ID]; playerid++)
	{
	    if(!IsPlayerConnected(playerid) || IsPlayerNPC(playerid) || PlayerEvent[playerid][LOGGED_IN] != true || PlayerInfo[playerid][IsInCRoom] != 0) continue;
	    
	 	if(GetPVarFloat(playerid,"am_offensive") >= 5.0)
		{
			am_id = __amCache[amOffensive];
			if(am_id != -1) achievement::SetPlayerAchievementData(playerid,am_id,floatround(GetPVarFloat(playerid,"am_offensive")),true);
		}
		
		if(GetPVarFloat(playerid,"am_defensive") >= 5.0)
		{
			am_id = __amCache[amDefensive];
			if(am_id != -1) achievement::SetPlayerAchievementData(playerid,am_id,floatround(GetPVarFloat(playerid,"am_defensive")),true);
		}
	    
	    if(PlayerEvent[playerid][distGefahren] >= 100.0)
	    {
			am_id = __amCache[amFernfahrer];
			if(am_id != -1 && am_PlayerInfo[playerid][am_id][am] == 0) achievement::SetPlayerAchievementData(playerid,am_id,floatround(PlayerEvent[playerid][distGefahren]),true);
		}

		if(PlayerEvent[playerid][distGelaufen] >= 50.0)
		{
			am_id = __amCache[amAthlet];
			if(am_id != -1 && am_PlayerInfo[playerid][am_id][am] == 0) achievement::SetPlayerAchievementData(playerid,am_id,floatround(PlayerEvent[playerid][distGelaufen]),true);
		}

        if(PlayerEvent[playerid][distGefahren] >= 100.0 || PlayerEvent[playerid][distGelaufen] >= 50.0)
        {
			format(query,sizeof(query),"UPDATE pnwl_user_event SET distgefahren='%0.2f',distgelaufen='%0.2f' WHERE userid='%d'",PlayerEvent[playerid][distGefahren],PlayerEvent[playerid][distGelaufen],PlayerInfo[playerid][PLAYER_ID]);
			mysql_query_once(query);
		}
	}
	job_Cronjob();
	//print("timer_300000 ENDE");
	return 1;
}

timer_600000()
{//10 Minuten
    //print("timer_600000");
	__SERVER[TIMER][3] = 0;
	veg::DB_OnVegetationSync();
	npc::SaveSync();
	miners_Create(20.0);
	jaegers_Create(20.0);
	for(new veh; veh<MAX_VEHICLES; veh++) car::OnCarUpdate(veh,false);
	//print("timer_600000 ENDE");
	return 1;
}

timer_10000()
{//10 Sekunden
    //print("timer_1000");
    __SERVER[TIMER][1] = 0;
    for(new playerid; playerid<=__SERVER[HIGHEST_PLAYER_ID]; playerid++)
    {
        if(!IsPlayerConnected(playerid) || IsPlayerNPC(playerid)) continue;
		SetPVarInt(playerid,"onplayercmd_ms",0);
        SetPVarInt(playerid,"onplayertext_ms",0);
	    new action_time = GetPVarInt(playerid,"next_lockpick");
	    if(action_time >= 1) SetPVarInt(playerid,"next_lockpick",action_time-10);
	    action_time = GetPVarInt(playerid,"next_medical_tr");
	    if(action_time >= 1) SetPVarInt(playerid,"next_medical_tr",action_time-10);
	    
	    if(PlayerEvent[playerid][LOGGED_IN] && PlayerInfo[playerid][IsInCRoom] == 0)
	    {
		    new Float:pos[3];
		    GetPlayerPos(playerid,pos[0],pos[1],pos[2]);
		    if(pos[0] != PlayerEvent[playerid][tmpPos][0])
		    {
		        new Float:dist = floatsqroot(
					floatpower(PlayerEvent[playerid][tmpPos][0]-pos[0],2)+
					floatpower(PlayerEvent[playerid][tmpPos][1]-pos[1],2)+
					floatpower(PlayerEvent[playerid][tmpPos][2]-pos[2],2)
				);
				if(IsPlayerInAnyVehicle(playerid)) PlayerEvent[playerid][distGefahren] += dist;
				else PlayerEvent[playerid][distGelaufen] += dist;
		    }
		    GetPlayerPos(playerid,PlayerEvent[playerid][tmpPos][0],PlayerEvent[playerid][tmpPos][1],PlayerEvent[playerid][tmpPos][2]);
		    status::UpdateDraws(playerid);
		}
	}
	for(new i; i<MAX_MUELLTONNEN; i++)
	{
	    if(Muelltonne[i][mActive] && Muelltonne[i][mReload][0] >= 1 && !Muelltonne[i][mPickup])
	    {
	        if((Muelltonne[i][mReload][0]-=10) <= 0)
			{
			    Muelltonne[i][mReload][0]	= 0;
			    Muelltonne[i][mPickup] 		= CreatePickup(19132,1,Muelltonne[i][mPos][0],Muelltonne[i][mPos][1],Muelltonne[i][mPos][2],0);
			}
		}
	}
	car::VehicleCronjob();
	//print("timer_10000 ENDE");
	return 1;
}

timer_5000()
{//5 Sekunden
    //print("timer_5000");
    __SERVER[TIMER][0] = 0;
    for(new playerid; playerid<=__SERVER[HIGHEST_PLAYER_ID]+1; playerid++)
    {
        if(IsPlayerNPC(playerid) || !IsPlayerConnected(playerid) || !PlayerEvent[playerid][LOGGED_IN]) continue;

        if(GetPVarInt(playerid,"onplayertext_muted") == 0) SetPVarInt(playerid,"onplayertext_ms",0);
        if(GetPVarInt(playerid,"onplayercmd_muted") == 0)  SetPVarInt(playerid,"onplayercmd_ms",0);

	    if(PlayerEvent[playerid][IstTot] >= 1)
	    {
	        SetPlayerHealth(playerid,500.0);
			SetPlayerWeather(playerid,113);
			PlayerEvent[playerid][IstTot] -= 5;
	        if(PlayerEvent[playerid][IstTot] == 0)
	        {//Lebt wieder
	            PlayerEvent[playerid][IstTot] = 0;
	            status::ShowDraws(playerid);
	            SetPlayerHealth(playerid,100.0);
				if(PlayerEvent[playerid][InteractHouse] == -1)
				{
					switch(GetPlayerVirtualWorld(playerid))
					{
						case 1000: SetPlayerVirtualWorld(playerid,0);
						case 1235: SetPlayerVirtualWorld(playerid,1234);
						default: SetPlayerVirtualWorld(playerid,0);
					}
				}
				else
				{
				    SetPlayerVirtualWorld(playerid,((PlayerEvent[playerid][InteractHouse]<<3)+1));
				}
			    SetPlayerWeather(playerid,__SERVER[GLOBAL_WEATHER]);
			    fixed_TextDrawShowForPlayer(playerid,RealClock);
			    
			    PlayerEvent[playerid][IstTot] = 0;
			    mysql_SetIntByInt("pnwl_user_event","isttot",0,"userid",PlayerInfo[playerid][PLAYER_ID]);
				if(GetPVarInt(playerid,"revivable") == 1)
				{
	                DestroyPickup(PlayerInfo[playerid][pTotPickup]);
	                Delete3DTextLabel(PlayerInfo[playerid][TotTag]);
	                SetPVarInt(playerid,"revivable",0);
				}
				new questid 	= PlayerQuestCache[playerid][qID],
					questslot	= quest::PlayerQuestSlotByQuestID(playerid,questid);
				if(questid >= 0) quest::OnQuestUpdate(playerid,questid,PlayerQuest[playerid][questslot][qStep],true);
				PLAYER::LoadPlayerWeapons(playerid);
	        }
	    }
	    else
	    {
	        SetPlayerWeather(playerid,__SERVER[GLOBAL_WEATHER]);
	        CheckPlayerNoDM(playerid);
	    }
	    car::UpdatePlayerTextdraws(playerid);
    }
    //print("timer_5000 ENDE");
	return 1;
}

forward timer_60000();
public timer_60000()
{//1 Minute
    //print("timer_60000");
    gettime(__SERVER[GLOBAL_TIME][0],__SERVER[GLOBAL_TIME][1]);
    new wt_s[15],mon_s[15],stu_s[15],jahr,monat,tag,stunde,minute,sekunde;
    getdate(jahr,monat,tag);
    gettime(stunde,minute,sekunde);
    format(string,sizeof(string),"%02d:%02d",stunde,minute);
    TextDrawSetString(RealClock,string);
    format(wt_s,sizeof(wt_s),"wochentag_%d",__SERVER[WOCHENTAG]);
    format(mon_s,sizeof(mon_s),"monat_%d",monat);
    format(stu_s,sizeof(stu_s),"zeit_%d",stunde);
	for(new playerid; playerid<=__SERVER[HIGHEST_PLAYER_ID]+1; playerid++)
	{
	    if(!IsPlayerConnected(playerid) || IsPlayerNPC(playerid)) continue;
	    if(PlayerEvent[playerid][LOGGED_IN])
	    {
	        continue;
	    }
	    PlayerInfo[playerid][Spielzeit]++;
	    if(PlayerEvent[playerid][IstTot] >= 1)
	    {
		    SetPlayerWeather(playerid,113);
		    SetPlayerTime(playerid,6,0);
	    }
	    else
	    {
			SetPlayerWeather(playerid,__SERVER[GLOBAL_WEATHER]);
			SetPlayerTime(playerid,__SERVER[GLOBAL_TIME][0],__SERVER[GLOBAL_TIME][1]);
			if(PlayerInfo[playerid][IsInCRoom] == 0)
			{
				new Float:hp_tmp;
		        GetPlayerHealth(playerid,hp_tmp);
		        if(hp_tmp >= 5.0) status::HealBerechnung(playerid);
		        GetPlayerHealth(playerid,hp_tmp);
		        if(hp_tmp >= 110.0) SetPlayerHealth(playerid,110.0);
		        if(hp_tmp <= 10.0)
		        {
		            SetPVarInt(playerid,"am_ueberlebenskuenstler",GetPVarInt(playerid,"am_ueberlebenskuenstler")+1);
		            if(GetPVarInt(playerid,"am_ueberlebenskuenstler") == 5)
		            {
		            	new am_id = __amCache[amUeberlebenskuenstler];
		            	if(am_id != -1) achievement::AddPlayerAchievement(playerid,am_id);
					}
		        }
		        else SetPVarInt(playerid,"am_ueberlebenskuenstler",0);
	        }
		}
		if((++PlayerEvent[playerid][PayDayTime])%PAYDAY_TIME == 0)
		{
		    format(string,sizeof(string),"PAYDAY: Du hast eine Essensmarke erhalten. Du hast nun %d Marken.",(PlayerEvent[playerid][PayDayTime]/PAYDAY_TIME));
		    SendClientMessage(playerid,GRUEN,string);
		    GameTextForPlayer(playerid,"~g~PayDay!",2000,1);
		}
		SetPVarInt(playerid,wt_s,GetPVarInt(playerid,wt_s)+1);
		SetPVarInt(playerid,mon_s,GetPVarInt(playerid,mon_s)+1);
		SetPVarInt(playerid,stu_s,GetPVarInt(playerid,stu_s)+1);
        if(GetPVarInt(playerid,"badword_mute") == 0) SetPVarInt(playerid,"used_badwords",0);
 	}
 	veg::PlantSync();
	iman::Cronjob(60);
    turf::Cronjob(60);
    gang::Cronjob(60);
	for(new i; i<MAX_JAEGER_POS; i++) if(random(3) == 0) jaegers_MoveTarget(i,50.0);
	
	new time[3],timestamp;
	timestamp = gettime(time[0],time[1],time[2]);
	if(time[0] == 23 && time[1] == 59 || time[0] == 0 && time[1] == 0)
	{//Cronjob um 0:00 Uhr
	    if((timestamp - __SERVER[CJ_LAST][0]) >= 180)//3 Minuten
	    {
	    	for(new i; i<=__SERVER[HIGHEST_PLAYER_ID]; i++)
	    	{
	    	    if(!IsPlayerConnected(i) || IsPlayerNPC(i)) continue;
				new am_id = __amCache[amNachtaktiv];
				if(am_id != -1) achievement::AddPlayerAchievement(i,am_id);
	    	}
	    	for(new gid; gid<MAX_GANGS; gid++)
	    	{
	    	    if(!GangInfo[gid][gCreated]) continue;
	    	    if((timestamp-GangInfo[gid][gLastReady]) > MAX_NON_READY_TIME)
	    	    {
	    	        if(GangInfo[gid][gTurfs] >= 1)
	    	        {
	    	            for(new tid; tid<MAX_TURFS; tid++)
	    	            {
	    	                if(!TurfInfo[tid][tCreated]) continue;
	    	                if(TurfInfo[tid][tOwner] == gid) turf::NeutralizeTurf(tid);
	    	            }
	    	        }
	    	    }
	    	    if((timestamp-GangInfo[gid][gLastOnline]) > MAX_NON_ONLINE_TIME)
	    	    {
	    	        gang::DeleteGang(gid);
	    	    }
	    	}
	    	
	        CORE::SyncStats();
	    	CORE::RepairDatabase();
	    	
	    	__SERVER[CJ_LAST][0]	= timestamp;
	    	__SERVER[WOCHENTAG] 	= Wochentag();
	    	//PayDay
			__SERVER[PAYDAY_ESSEN]  = random(sizeof(EssensmarkeGerichte));
			INI::SetInt(#CACHE_PATH"/payday.ini","essen",__SERVER[PAYDAY_ESSEN]);
			INI::SetInt(#CACHE_PATH"/payday.ini","updated",gettime(_,_,_));
		}
	}
	if(++__SERVER[TIMER][2] >= 5) timer_300000();// 5 Minuten
	if(++__SERVER[TIMER][3] >= 10) timer_600000();//10 Minuten
	//print("timer_60000 ENDE");
	return 1;
}

public OnPlayerFinishCameraMovement(playerid)
{
	for(new i; i<3; i++)
	{
		PlayerCamera[playerid][camPOSfrom][i] 	= PlayerCamera[playerid][camPOSto][i];
		PlayerCamera[playerid][camLOOKfrom][i] 	= PlayerCamera[playerid][camLOOKto][i];
	}
	PlayerCamera[playerid][camMoving] = false;
	if(GetPVarInt(playerid,"waffenladen") == 1) return UpdatePlayerShopScreen(playerid,SHOPSCREEN_WAFFEN);
	if(GetPVarInt(playerid,"liq_store") == 1)	return UpdatePlayerShopScreen(playerid,SHOPSCREEN_LIQUOR);
	if(GetPVarInt(playerid,"tut_finish") == 1)
	{
	    SetPVarInt(playerid,"tut_finish_step",GetPVarInt(playerid,"tut_finish_step")+1);
	    format(string,sizeof(string),"STEP %d",GetPVarInt(playerid,"tut_finish_step"));
	    SendClientMessage(playerid,GRUEN,string);
	    switch(GetPVarInt(playerid,"tut_finish_step"))
	    {
	        case 1:
	        {//Fort Carson
	            PlayAudioStreamForPlayer(playerid,#SOUND_PATH"/misc/tut_ende.mp3");
 				fixed_TextDrawShowForPlayer(playerid,Filmstreifen[0]);
				fixed_TextDrawShowForPlayer(playerid,Filmstreifen[1]);
				TogglePlayerControllable(playerid,false);
	            SetPlayerCameraInfoEx(playerid,Float:{-394.7839,1245.1384,6.6537},Float:{-169.0160,1132.6099,25.2654});
	            MovePlayerCamera(playerid,Float:{-428.7697,1127.5077,40.0572},Float:{-169.0160,1132.6099,25.2654},3.0);
	            w_SetPlayerPos(playerid,-169.0160,1132.6099,15.2654);
	        }
	        case 2:
	        {
	            SetTimerEx("OnPlayerFinishCameraMovement",4000,false,"d",playerid);
	            DisplayInfobox(playerid,"Fort Carson","Die \"Hauptstadt\" der Zivilbevölkerung von Terra Robada.~n~Hier findest du alles, was du für den Anfang benoetigt, einschliesslich~n~Quests, Essen, Handelspartner, ein Hotel und weitere Dinge...");
	        }
	        case 3:
	        {//Stadt
	            HideInfobox(playerid);
	            MovePlayerCamera(playerid,Float:{-807.7175,1350.6295,43.2632},Float:{-792.2716,1534.3967,27.2322},8.0);
	            w_SetPlayerPos(playerid,-792.2716,1534.3967,15.2322);
	        }
	        case 4:
	        {
	            SetTimerEx("OnPlayerFinishCameraMovement",4000,false,"d",playerid);
	            DisplayInfobox(playerid,"stadt","unbekannte stadt");
	        }
	        case 5:
	        {
	            HideInfobox(playerid);
	            MovePlayerCamera(playerid,Float:{-1390.8204,2080.4314,114.6547},Float:{-1492.7424,2600.2732,55.8479},10.0);
	            w_SetPlayerPos(playerid,-1492.7424,2600.2732,40.8479);
	        }
	        case 6:
	        {//Stadt EL Quebadros
	            MovePlayerCamera(playerid,Float:{-1380.2380,2455.1997,155.8862},Float:{-1492.7424,2600.2732,55.8479},10.0);
	            w_SetPlayerPos(playerid,-1492.7424,2600.2732,40.8479);
	        }
	        case 7:
	        {
	            SetTimerEx("OnPlayerFinishCameraMovement",4000,false,"d",playerid);
	            DisplayInfobox(playerid,"El Quebadros","Hier ist ehh nix");
	        }
	        case 8:
	        {
	            HideInfobox(playerid);
	            MovePlayerCamera(playerid,Float:{-475.4593,2455.7190,188.7459},Float:{-489.2405,2258.6201,75.71071},10.0);
	            w_SetPlayerPos(playerid,-387.7785,2238.0559,30.3010);
	        }
	        case 9:
	        {//Las Peyadas
	            MovePlayerCamera(playerid,Float:{-489.2405,2258.6201,75.7107},Float:{-387.7785,2238.0559,42.3010},10.0);
	            w_SetPlayerPos(playerid,-387.7785,2238.0559,30.3010);
	        }
	        case 10:
	        {
	            SetTimerEx("OnPlayerFinishCameraMovement",4000,false,"d",playerid);
	            DisplayInfobox(playerid,"Stadt","...und hier auch nicht");
	        }
	        case 11:
	        {//Kirche
	            HideInfobox(playerid);
	            MovePlayerCamera(playerid,Float:{-466.1551,1909.8204,85.1696},Float:{-526.5660,1897.0168,114.4588},10.0);
	            w_SetPlayerPos(playerid,-526.5660,1897.0168,100.4588);
	        }
	        case 12:
	        {
	            SetTimerEx("OnPlayerFinishCameraMovement",4000,false,"d",playerid);
				DisplayInfobox(playerid,"Kirhce","hier kannste deine alte heiraten");
	        }
	        case 13:
	        {//Area 51
	            HideInfobox(playerid);
	            MovePlayerCamera(playerid,Float:{234.1929,1789.9232,70.7287},Float:{200.9923,1880.1470,17.8324},10.0);
	            w_SetPlayerPos(playerid,200.9923,1880.1470,0.0);
	        }
	        case 14:
	        {
	            SetTimerEx("OnPlayerFinishCameraMovement",4000,false,"d",playerid);
	            DisplayInfobox(playerid,"Stadt","top secret, kann aber mitm heißluftballoon angeflogen werden^^");
	        }
	        case 15:
	        {//Öl
	            HideInfobox(playerid);
	            MovePlayerCamera(playerid,Float:{318.1595,1409.3214,50.8839},Float:{248.7303,1407.6403,53.2171},10.0);
	            w_SetPlayerPos(playerid,248.7303,1407.6403,-10.0);
	        }
	        case 16:
	        {
	            SetTimerEx("OnPlayerFinishCameraMovement",4000,false,"d",playerid);
	            DisplayInfobox(playerid,"Stadt","oeldepot");
	        }
	        case 17:
	        {//Ende
	            CORE::AddPlayerCredits(PlayerInfo[playerid][PLAYER_ID],10);
	            HideInfobox(playerid);
				DeletePVar(playerid,"tut_finish");
				DeletePVar(playerid,"tut_finish_step");
	            SetCameraBehindPlayer(playerid);
 				fixed_TextDrawHideForPlayer(playerid,Filmstreifen[0]);
				fixed_TextDrawHideForPlayer(playerid,Filmstreifen[1]);
				SetPlayerInterior(playerid,0);
				SetPlayerVirtualWorld(playerid,0);
				SetPlayerHealth(playerid,100.0);
				w_SetPlayerPos(playerid,-395.48565673828,1251.7880859375,6.8383088111877,_,2);
	        }
			/*(-394.7839,1245.1384,6.6537); // 1--pos from
			(-428.7697,1127.5077,40.0572); // 1--pos to
			(-169.0160,1132.6099,25.2654); // 1--look
			(-807.7175,1350.6295,43.2632); // 2--pos to
			(-792.2716,1534.3967,27.2322); // 2--look to
			(-1390.8204,2080.4314,114.6547); // 3--pos to
			(-1380.2380,2455.1997,155.8862); // 4--pos to
			(-1492.7424,2600.2732,55.8479); // 3 und 4 -- look to
			(-475.4593,2455.7190,188.7459); // 5--pos to
			(-489.2405,2258.6201,75.71071); // 6--pos to
			(-387.7785,2238.0559,42.3010); // 6--look to
			(-466.1551,1909.8204,85.1696); // 7--pos to
			(-526.5660,1897.0168,114.4588); // 7--look to
			(234.1929,1789.9232,70.7287); // 8--pos to
			(200.9923,1880.1470,17.8324); // 8--look to
			(318.1595,1409.3214,50.8839); // 9-pos to
			(248.7303,1407.6403,53.2171); // 9--look to*/
	    }
	    return 1;
	}
	if(GetPVarInt(playerid,"hosp_cam") == 1)
	{
		new Float:positions[][3] = {
			{0.0,0.0,0.0},//0
			{2856.1533,-255.07737,53.21081},//1
			{2858.9143,-259.2548,53.5481},//2
			{2859.9514,-258.0542,52.7608},//3
			{2863.5618,-261.1241,52.7608},//4
			{2866.7443,-256.2666,55.15898},//5
			{2860.6628,-253.5068,52.8516},//6
			{2860.7993,-257.1369,52.4805},//7
			{2864.3375,-257.9034,52.8658}//8
		};
		if(cam_Ziel[playerid] == cam_Ort[playerid])
		{//Ziel erreicht
		    switch(cam_Ziel[playerid])
		    {
		        case 1: ShowInfoMessage(playerid,"Operation ~<~ Wiederbelebung ~>~ Medizin~n~ENTER = Bestaetigen~n~LEER = Zurueck");
		        case 3: ShowInfoMessage(playerid,"Wiederbelebung ~<~ Medizin ~>~ Operation~n~ENTER = Bestaetigen~n~LEER = Zurueck");
		        case 5: ShowInfoMessage(playerid,"Medizin ~<~ Operation ~>~ Wiederbelebung~n~ENTER = Bestaetigen~n~LEER = Zurueck");
			}
			return 1;
		}

		new move_coords[2] = {-1,-1};
		switch(cam_Ziel[playerid])
		{
			case 1:
			{//Sarg
				switch(cam_Ort[playerid])
				{
					case 2: move_coords = {1,6};
					case 3: move_coords = {2,6};
					case 4: move_coords = {2,6};
					case 5: move_coords = {4,6};
				}
			}
			case 3:
			{//Drug
				switch(cam_Ort[playerid])
				{
					case 1: move_coords = {2,7};
					case 2: move_coords = {3,7};
					case 4: move_coords = {2,7};
					case 5: move_coords = {4,7};
				}
			}
			case 5:
			{//OP
				switch(cam_Ort[playerid])
				{
					case 1: move_coords = {2,8};
					case 2: move_coords = {4,6};
					case 3: move_coords = {2,8};
					case 4: move_coords = {5,8};
				}
			}
			default:
			{//Error
				SendClientMessage(playerid,ROT,"ERROR 1");
			}
		}

		if(move_coords[0] < 0 || move_coords[0] > 8 || move_coords[1] < 0 || move_coords[1] > 8)
		{//Error
			format(string,sizeof(string),"ERROR %d/%d",cam_Ziel[playerid],cam_Ort[playerid]);
			SendClientMessage(playerid,ROT,string);
			return 1;
		}

		SetPVarInt(playerid,"hosp_cam",1);
		format(string,sizeof(string),"Moving to %d/%d",move_coords[0],move_coords[1]);
		SendClientMessage(playerid,ROT,string);
		cam_Ort[playerid] = move_coords[0];
		MovePlayerCamera(playerid,positions[move_coords[0]],positions[move_coords[1]],0.1);
		return 1;
	}
	if(PlayerEvent[playerid][TutorialStep][0] >= 1)
	{
	    /*<marker id="Johnwakehouse checkpoint" "37.924995422363,-2109.9604492188,22.963747024536
	    <marker id="Johnwake botpos north" "45.685585021973,-2119.5842285156,22.966136932373
	    <marker id="Johnwake campos2" "46.282917022705,-2109.5588378906,23.940660476685
	    <marker id="Johnwake campos3" 45.717098236084,-2116.42578125,22.966068267822*/
    	if(PlayerEvent[playerid][TutorialStep][0] == 3)
	    {
	       	if(PlayerEvent[playerid][TutorialStep][1] == 4 || PlayerEvent[playerid][TutorialStep][1] == 6)
			{
				SetCameraBehindPlayer(playerid);
				TogglePlayerControllable(playerid,true);
				return 1;
			}
			else if(PlayerEvent[playerid][TutorialStep][1] == 7)
			{
			    PlayerEvent[playerid][TutorialStep][1] = 8;
			    MovePlayerCamera(playerid,Float:{45.717098236084,-2116.42578125,22.966068267822},Float:{45.685585021973,-2119.5842285156,22.966136932373},(SLOW/3));
			    return 1;
			}
			else if(PlayerEvent[playerid][TutorialStep][1] == 8)
			{
			    format(string,sizeof(string),"{C87E35}John Wake:\n{F1F7DC}\"Moin moin, vielen Dank, dass du gekommen bist. Ah wie unhoeflich von mir,\n ich habe mich noch garnicht vorgestellt: Mein Name ist John Wake. Vor kurzer Zeit bin ich\nhier nach 'Las Brujas' gezogen um eine richtig gute Story fuer mein neues Buch zu bekommen.");
				strcat(string,"\nNaja, da lungern ueberall so komische Kreaturen draußen rum und der Lieferant,\nder mir meine Medizin bringen sollte taucht nicht auf. Er wohnt im alten Haus nicht weit von\nhier. Bitte hole mir die Medizin...");
			    ShowPlayerDialog(playerid,dialog_TUTORIAL_WAKE_FIRST,DIALOG_STYLE_MSGBOX,"Gespräch mit John Wake",string,"Erzähl mehr","");
			    return 1;
			}
		}
	}

	if(PlayerInfo[playerid][IsInCRoom])
	{
	    if (cam_Ort[playerid] == 6 && cam_Ziel[playerid] != 6)
	    {
	        MovePlayerCamera(playerid, Float:{-2165.1530761719, 980.11785888672, -3.4176735877991}, Float:{-2162.0607910156, 980.09265136719, -3.4298121929169}, SLOW);   //zur Raummitte
	        cam_Ort[playerid] = 0;
	        return 1;
	    }
	    else if (cam_Ziel[playerid] == 1 && cam_Ort[playerid] != 6 && cam_Ort[playerid] != 1)   // zur Spawnkarte
	    {
	        MovePlayerCamera(playerid, Float:{-2145.2202148438, 979.25573730469, -2.5840692520142}, Float:{-2145.1726074219, 981.02569580078, -3.5328042507172}, SLOW);
	        cam_Ort[playerid] = 1;
	        return 1;
	    }
	    else if (cam_Ziel[playerid] == 2 && cam_Ort[playerid] != 6 && cam_Ort[playerid] != 2)   // zu Pokalen
	    {
	        MovePlayerCamera(playerid, Float:{-2157.2744140625, 978.3359375, -3.8188977241516}, Float:{-2158.48828125, 976.57556152344, -3.3670682907104}, SLOW);
	        cam_Ort[playerid] = 2;
	        return 1;
	    }
	    else if (cam_Ziel[playerid] == 3 && cam_Ort[playerid] != 6 && cam_Ort[playerid] != 3)   // zur Tafel
	    {
	        MovePlayerCamera(playerid, Float:{-2164.302734375, 975.96881103516, -3.1198422908783}, Float:{-2166.0788574219, 975.90759277344, -3.1864035129547}, SLOW/2);
	        cam_Ort[playerid] = 3;
	        return 1;
	    }
	    else if (cam_Ziel[playerid] == 4 && cam_Ort[playerid] != 6 && cam_Ort[playerid] != 4)   // zum Safe
	    {
	        MovePlayerCamera(playerid, Float:{-2165.39453125, 979.47180175781, -3.8170509338379}, Float:{-2166.4799804688, 978.47790527344, -4.6166815757751}, SLOW/2);
	        cam_Ort[playerid] = 4;
	        return 1;
	    }
	    else if (cam_Ziel[playerid] == 5 && cam_Ort[playerid] != 6 && cam_Ort[playerid] != 5)   // zum PC
	    {
	        MovePlayerCamera(playerid, Float:{-2163.5671386719, 983.33874511719, -3.0076780319214}, Float:{-2165.1516113281, 985.06848144531, -3.7542779445648}, SLOW/3);
	        cam_Ort[playerid] = 5;
	        return 1;
	    }
	    else if (cam_Ziel[playerid] == 6 && cam_Ort[playerid] != 6 && cam_Ort[playerid] != 6)   // zur Skinwahl 1
	    {
	        MovePlayerCamera(playerid, Float:{-2170.8876953125, 980.1259765625, -3.5658991336823}, Float:{-2165.8876953125, 980.1259765625, -3.5658991336823}, SLOW/2);
	        cam_Ziel[playerid] = 7;
	        return 1;
	    }
	    else if (cam_Ziel[playerid] == 7)
	    {
	        MovePlayerCamera(playerid, Float:{-2174.2470703125, 977.0400390625, -3.5115416049957}, Float:{-2131.1857910156, 926.45758056641, -11.04154586792}, SLOW/3);
	        cam_Ziel[playerid] = 6;
	        cam_Ort[playerid] = 6;
	        return 1;
	    }
	}
	if(Currentstep[playerid] != 0)
	{
		if(Currentstep[playerid] == 1)
		{
		    SetPlayerSkin(playerid,__SKINLIST[0]);
			MovePlayerCamera(playerid,Float:{-2174.2470703125, 977.0400390625, -3.5115416049957}, Float:{-2131.1857910156, 926.45758056641, -11.04154586792}, 0.1); //c1 zu c2
		}
		if(Currentstep[playerid] == 2)
		{
		    Skinauswahl(playerid);
			//MovePlayerCamera(playerid, -2170.8876953125, 980.1259765625, -3.5658991336823, -2139.318359375, 980.2666015625, -3.6778059005737, 0.1); //c2 zu c3
		}
		if(Currentstep[playerid] == 3)
		{
			MovePlayerCamera(playerid,Float:{-2147.376953125, 980.330078125, -3.551372051239}, Float:{-2139.318359375, 980.2666015625, -3.6778059005737}, SLOW); //c3 zu c4
			GameTextForPlayer(playerid,"~w~Entwickelt von~n~~r~NeoPhoenix~n~~w~und ~r~BuggyB",5000,3);

			new Float:pp[3];
			GetPlayerPos(playerid,pp[0],pp[1],pp[2]);
			w_SetPlayerPos(playerid,pp[0],pp[1],pp[2]+10.0);
			TogglePlayerControllable(playerid,false);
			SetPlayerVirtualWorld(playerid,0);
		}
		if(Currentstep[playerid] == 4)
		{
			MovePlayerCamera(playerid,Float:{-2145.5100097656, 974.35565185547, -3.2728743553162}, Float:{-2145.4899902344, 905.27416992188, 9.8856887817383}, SLOW); //c4 zu c5
		}
		//Tunnel anfang
	    if(Currentstep[playerid] == 5)
		{
		    new day,month,year;
		    getdate(year,month,day);
		    format(string,sizeof(string),"Das heutige Datum ist der %d.%02d.%d",day,month,year+120);
		    GameTextForPlayer(playerid,string,6500,3);
		    SetPVarInt(playerid,"tut_message",1);
            SetTimerEx("tut_message", 7000, false, "i", playerid);
			MovePlayerCamera(playerid,Float:{-2145.4892578125, 906.2734375, 9.5106945037842},Float:{-2149.1218261719, 715.42108154297, 54.894401550293}, SLOW); //c5 zu c6
		}
	    if(Currentstep[playerid] == 6) MovePlayerCamera(playerid, Float:{-2146.12109375, 721.67974853516, 55.394401550293}, Float:{-2152.62109375, 723.455078125, 55.394401550293}, SLOW); //c6 zu c7
	    if(Currentstep[playerid] == 7) MovePlayerCamera(playerid, Float:{-2179.828125, 728.408203125, 55.350761413574}, Float:{-2179.4333496094, 722.65905761719, 55.350761413574}, SLOW-0.1); //c7 zu c8
		//Tunnelende
	    if(Currentstep[playerid] == 8) MovePlayerCamera(playerid, Float:{-2178.58203125, 709.9990234375, 55.350761413574}, Float:{-2168.9379882813, 623.76733398438, 55.350761413574}, SLOW); //c8 zu c9
	    if(Currentstep[playerid] == 9)
		{
			MovePlayerCamera(playerid, Float:{-2178.5568847656, 646.18591308594, 51.403697967529}, Float:{-2183.7998046875, 645.13525390625, 51.078708648682}, SLOW); //c9 zu c10
            GameTextForPlayer(playerid,"...welche nach ueber 100 Jahren wieder die Sonne sieht.",8000,3);
		}
		if(Currentstep[playerid] == 10)MovePlayerCamera(playerid, Float:{-2205.6381835938, 634.34967041016, 51.078708648682},Float:{ -2206.5375976563, 631.55029296875, 51.978687286377}, SLOW); //c10 zu c11
		//Stadtausblick, Rauch
	    if(Currentstep[playerid] == 11)
		{
			GameTextForPlayer(playerid,"~n~~n~~n~~n~Geschuetzt in den Bunkern wurde versucht...",3500,3);
			
			SetPlayerPos(playerid,-2186.5549,605.17846,80.1640);
			SetPlayerVirtualWorld(playerid,0);
			new matthew = npc::IdByName("Matthew");
			if(matthew != -1) SetPlayerVirtualWorld(playerid,NPCData[npc_list:matthew][npc_vw]);
			
			SetPVarInt(playerid,"tut_message",10);
		    PlayerCamera[playerid][camMoving] = false;
	        SetTimerEx("tut_message", 3500, false, "i", playerid);
		}
		if(Currentstep[playerid] == 12) MovePlayerCamera(playerid, Float:{-2209.0869140625, 606.12957763672, 36.58988571167}, Float:{-2204.8369140625, 606.70275878906, 37.414936065674}, SLOW); //c12 zu c13
	    if(Currentstep[playerid] == 13) MovePlayerCamera(playerid, Float:{-2190.1376953125, 607.75402832031, 35.539867401123}, Float:{-2188.689453125, 606.92883300781, 35.539867401123}, SLOW); //c13 zu c14
	    if(Currentstep[playerid] == 14)
	    {
			format(query,sizeof(query),"UPDATE pnwl_user_event SET tutorial='1' WHERE userid='%d'",PlayerInfo[playerid][PLAYER_ID]);
			mysql_query_once(query);
	        format(string,sizeof(string),"%s %s",PlayerInfo[playerid][Vorname],PlayerInfo[playerid][Nachname]);
	        mysql_SetStringByInt("wcf0_user_option_value","userOption79",string,"userid",PlayerInfo[playerid][PLAYER_ID]);
	        mysql_SetIntByInt("wcf0_user_option_value","userOption80",PlayerInfo[playerid][Spielzeit],"userid",PlayerInfo[playerid][PLAYER_ID]);//Spielzeit
            mysql_SetIntByInt("wcf0_user_option_value","userOption81",0,"userid",PlayerInfo[playerid][PLAYER_ID]);//Fraktion
		    mysql_SetIntByInt("wcf0_user_option_value","userOption82",PlayerInfo[playerid][Geschlecht]==1?2:1,"userid",PlayerInfo[playerid][PLAYER_ID]);//Geschlecht			
			Currentstep[playerid] = 0;
	        ShowPlayerDialog(playerid,dialog_TUTORIAL_BEVOR_PLANE,DIALOG_STYLE_MSGBOX,"Gespräch mit Sergeant Matthew Anderson...","{C87E35}Sergeant Matthew Anderson:\n{F1F7DC}\"Willkommen an der frischen Luft. Herrlich oder?\nWenn du weiter raus willst, muss ich dich allerdings aufhalten.\nEs ist wohl noch zu gefährlich dort.\n\nDie nagelneue Andromeda XE-10 wird bald abheben, wenn du mit\nrein willst beweg deinen Arsch!\""/*\n\n\n{878375}Hinweis:\n- Blabla*/,"Einsteigen","");
	    }
		if(Currentstep[playerid] != 0) Currentstep[playerid]++;
	}
	return 1;
}

forward tut_message(playerid);
public tut_message(playerid)
{
	switch(GetPVarInt(playerid,"tut_message"))
	{
	    case 1:
	    {
	        SetPVarInt(playerid,"tut_message",2);
	        GameTextForPlayer(playerid,"Aufgrund dem Ausbruch eines Mutationsvirus...",11000,3);
	        SetTimerEx("tut_message", 11500, false, "i", playerid);
		}
		case 2:
		{
		    SetPVarInt(playerid,"tut_message",3);
		    GameTextForPlayer(playerid,"... musste die Erdoberflaeche evakuiert werden.",11000,3);
		    SetTimerEx("tut_message", 11500, false, "i", playerid);
		}
		case 3:
		{
		    SetPVarInt(playerid,"tut_message",4);
			GameTextForPlayer(playerid,"Du gehoerst zu der Generation der Menschheit...",11000,3);
			SetTimerEx("tut_message", 11500, false, "i", playerid);
		}
		case 10:
		{
		    SetPVarInt(playerid,"tut_message",0);
		    GameTextForPlayer(playerid,"~n~~n~~n~~n~... den Virus mit Atomschlaegen zu besiegen.",3500,3);
		    SetTimerEx("CameraMove_Stadtausblick", 3500, false, "i", playerid);
		}
	}
	return 1;
}

forward CameraMove_Stadtausblick(playerid);
public CameraMove_Stadtausblick(playerid)
{
	Currentstep[playerid] = 12;
	MovePlayerCamera(playerid, Float:{-2207.8876953125, 625.349609375, 51.078708648682}, Float:{-2209.3876953125, 611.099609375, 43.828708648682}, SLOW); //c11 zu c12
	return 1;
}

stock Skinauswahl(playerid)
{
	SetPVarInt(playerid,"skinauswahl",1);
	new skin = GetPlayerSkin(playerid),
		list[MAX_GENERATED_SKINS],
		listoffset=0;
	GenerateSkinList(playerid,list);
    for(new i=0; i<strlen(list); i++)
    {
		if(skin == list[i])
		{
		    listoffset = i;
		    break;
		}
	}
	SetPVarInt(playerid,"skinauswahl_selected_offset",listoffset);
	SetPlayerSkin(playerid,list[listoffset]);
	ShowInfoMessage(playerid,"~<~Skin wechseln~>~~n~ENTER = Bestaetigen");
	return 1;
}

stock skin_Prevskin(playerid)
{
	new skin = DEFAULT_SKIN,
		list[MAX_GENERATED_SKINS];
	GenerateSkinList(playerid,list);
	SetPVarInt(playerid,"skinauswahl_selected_offset",GetPVarInt(playerid,"skinauswahl_selected_offset")-1);
	if(GetPVarInt(playerid,"skinauswahl_selected_offset") < 0) SetPVarInt(playerid,"skinauswahl_selected_offset",strlen(list)-1);
	skin = list[GetPVarInt(playerid,"skinauswahl_selected_offset")];
	PlayerOption[playerid][Skin] = skin;
	SetPlayerSkin(playerid,skin);
	return 1;
}

stock skin_Nextskin(playerid)
{
	new skin = DEFAULT_SKIN,
		list[MAX_GENERATED_SKINS];
    GenerateSkinList(playerid,list);
	SetPVarInt(playerid,"skinauswahl_selected_offset",GetPVarInt(playerid,"skinauswahl_selected_offset")+1);
	if(GetPVarInt(playerid,"skinauswahl_selected_offset") >= strlen(list)) SetPVarInt(playerid,"skinauswahl_selected_offset",0);
	skin = list[GetPVarInt(playerid,"skinauswahl_selected_offset")];
    PlayerOption[playerid][Skin] = skin;
	SetPlayerSkin(playerid,skin);
	return 1;
}

forward start_tutorial(playerid);
public start_tutorial(playerid)
{
	if(IsPlayerNPC(playerid)) return 1;
	Currentstep[playerid] = 2;
	//SetPlayerCameraInfoEx(playerid, -2174.5470703125, 975.0400390625, -3.5115416049957, -2168.2316894531, 968.06512451172, 61.956909179688); //c1
	TogglePlayerControllable(playerid,false);
    MovePlayerCamera(playerid, Float:{-2174.2470703125, 977.0400390625, -3.5115416049957},Float:{ -2131.1857910156, 926.45758056641, -11.04154586792}, 0.1); //c1 zu c2
	return 1;
}

SetPlayerSpawn(playerid,spawntype=0)
{
	//CRaum zuruecksetzen
	PlayerInfo[playerid][IsInCRoom] 		= 0;
	PlayerInfo[playerid][CRoomAction] 		= 0;
	PlayerInfo[playerid][CRoomSubAction] 	= 0;
	////////////////////
	Currentstep[playerid] = 0;
	SetCameraBehindPlayer(playerid);
	switch(spawntype)
	{
	    case 0: return 1;//Alter Spawn
	    case 1: return 1;//Normaler Spawn
	    case 2: return 1;//Crash Spawn
	    case 3: return 1;//Haus Spawn
	    case 4: return 1;//Fraktionsspawn
		default: return SetPlayerSpawn(playerid,1);
	}
	return 1;
}

stock OnEndBoxfight(winner=-1)
{
	new winnerid 	= winner!=-1?winner:(GetPVarFloat(BoxerID[0],"box_hp")==GetPVarFloat(BoxerID[1],"box_hp")?-1:(GetPVarFloat(BoxerID[0],"box_hp")>GetPVarFloat(BoxerID[1],"box_hp")?BoxerID[0]:BoxerID[1])),
		loserid		= winnerid==-1?-1:(winnerid==BoxerID[0]?BoxerID[1]:BoxerID[0]);
	if(winnerid == -1)	format(string,sizeof(string),#FORMAT_CHAT_INFO"Der Boxkampf endet mit %d:%d unentschieden!",floatround(GetPVarFloat(winnerid,"box_hp")),floatround(GetPVarFloat(loserid,"box_hp")));
	else				format(string,sizeof(string),#FORMAT_CHAT_INFO"%s hat den Boxkampf gegen %s mit %d:%d gewonnen!",GetName(winnerid),GetName(loserid),floatround(GetPVarFloat(winnerid,"box_hp")),floatround(GetPVarFloat(loserid,"box_hp")));
	for(new i; i<__SERVER[HIGHEST_PLAYER_ID]; i++)
	{
	    if(IsPlayerNPC(i) || !IsPlayerConnected(i))							continue;
	    if(!IsPlayerInRangeOfPoint(i,15.0,-2118.6000,1721.9000,21.2000))	continue;
	    HideInfobox(i);
	    SendClientMessage(i,ORANGE,string);
	}
	if(IsPlayerConnected(winnerid))
	{
		DeletePVar(winnerid,"box_hp");
		PLAYER::LoadPlayerWeapons(winnerid);
		SetPlayerPos(winnerid,-2118.6000,1721.9000,21.2000);
		SetCameraBehindPlayer(winnerid);
	}
	if(IsPlayerConnected(loserid))
	{
		DeletePVar(loserid,"box_hp");
		PLAYER::LoadPlayerWeapons(loserid);
		SetPlayerPos(loserid,-2118.6000,1721.9000,21.2000);
		SetCameraBehindPlayer(loserid);
	}
	BoxTime		=  0;
	BoxerID[0]	= -1;
	BoxerID[1]	= -1;
	return 1;
}

UpdatePlayerShopScreen(playerid,shop_id=0,bool:enter=true)
{
	SetPVarInt(playerid,"cam_move_block",1);
	switch(shop_id)
	{
	    case SHOPSCREEN_WAFFEN:
	    {
			if(enter == true)
			{
			    HideInfoMessage(playerid);
				for(new i; i<3; i++)
				{
	                if(PBarStatus[playerid][i] != PlayerText:INVALID_TEXT_DRAW)
	                {
						PlayerTextDrawHide(playerid,PBarStatus[playerid][i]);
						PlayerTextDrawDestroy(playerid,PBarStatus[playerid][i]);
						PBarStatus[playerid][i] = PlayerText:INVALID_TEXT_DRAW;
	                }
					if(PBarText[playerid][i] != PlayerText:INVALID_TEXT_DRAW)
					{
						PlayerTextDrawHide(playerid,PBarText[playerid][i]);
						PlayerTextDrawDestroy(playerid,PBarText[playerid][i]);
						PBarText[playerid][i] = PlayerText:INVALID_TEXT_DRAW;
					}
	            }
				fixed_TextDrawHideForPlayer(playerid,PBarRAussen[0]);
				fixed_TextDrawHideForPlayer(playerid,PBarRAussen[2]);
				fixed_TextDrawHideForPlayer(playerid,PBarRInnen[0]);
				fixed_TextDrawHideForPlayer(playerid,PBarRInnen[2]);

				new Float:w_schaden;
			    switch(GetPVarInt(playerid,"waffe"))
			    {
					case 0: { format(string,sizeof(string),"Gewehr"); 		w_schaden = WeaponInfo[33][wModDamage]; }
					case 1: { format(string,sizeof(string),"Sniper"); 		w_schaden = WeaponInfo[34][wModDamage]; }
					case 2: { format(string,sizeof(string),"AK-47"); 		w_schaden = WeaponInfo[30][wModDamage]; }
					case 3: { format(string,sizeof(string),"M4"); 			w_schaden = WeaponInfo[31][wModDamage]; }
					case 4: { format(string,sizeof(string),"Schrotgewehr"); w_schaden = WeaponInfo[25][wModDamage]; }
					case 5: { format(string,sizeof(string),"SawnOff"); 		w_schaden = WeaponInfo[26][wModDamage]; }
					case 6: { format(string,sizeof(string),"9mm Pistole");  w_schaden = WeaponInfo[22][wModDamage]; }
					case 7: { format(string,sizeof(string),"Desert Eagle"); w_schaden = WeaponInfo[24][wModDamage]; }
					default: { format(string,sizeof(string),"Unknown"); 	w_schaden = WeaponInfo[0][wModDamage]; }
			    }
			    new Float:kauf_fortschritt = ((float(PlayerNPC[playerid][NPC_DIMITRY][cash])/float(waffenpreis[GetPVarInt(playerid,"waffe")]))*100.0);
				if(kauf_fortschritt < 0.0)		kauf_fortschritt	= 0.0;
				if(kauf_fortschritt > 100.0)	kauf_fortschritt	= 100.0;
				if(w_schaden < 0.0)             w_schaden           = 0.0;
				if(w_schaden > 100.0)           w_schaden           = 100.0;
			    new wSstring[100];
			    format(wSstring,100,"~<~Waffe: %s~>~",string);
			    format(string,sizeof(string),"~<~ - %s - ~>~~n~ENTER = Kaufen~n~LEER = Verlassen",string);
			   	ShowInfoMessage(playerid,string);
                
			    PBarStatus[playerid][2] = CreatePlayerTextDraw(playerid,/*178 = 0%, 470 = 100%*/(178.0+(w_schaden*2.92)), 285.000000, "_");
				PlayerTextDrawBackgroundColor(playerid,PBarStatus[playerid][2], 0xFF100CFF);
				PlayerTextDrawFont(playerid,PBarStatus[playerid][2], 1);
				PlayerTextDrawLetterSize(playerid,PBarStatus[playerid][2], 0.500000, 1.299999);
				PlayerTextDrawColor(playerid,PBarStatus[playerid][2], -1);
				PlayerTextDrawSetOutline(playerid,PBarStatus[playerid][2], 0);
				PlayerTextDrawSetProportional(playerid,PBarStatus[playerid][2], 1);
				PlayerTextDrawSetShadow(playerid,PBarStatus[playerid][2], 1);
				PlayerTextDrawUseBox(playerid,PBarStatus[playerid][2], 1);
				PlayerTextDrawBoxColor(playerid,PBarStatus[playerid][2], 0xFF100CFF);
				PlayerTextDrawTextSize(playerid,PBarStatus[playerid][2], 174.000000, 255.000000);

			    PBarStatus[playerid][0] = CreatePlayerTextDraw(playerid,/*178 = 0%, 470 = 100%*/(178.0+(kauf_fortschritt*2.92)), 305.000000, "_");
				PlayerTextDrawBackgroundColor(playerid,PBarStatus[playerid][0], 0xFF100CFF);
				PlayerTextDrawFont(playerid,PBarStatus[playerid][0], 1);
				PlayerTextDrawLetterSize(playerid,PBarStatus[playerid][0], 0.500000, 1.299999);
				PlayerTextDrawColor(playerid,PBarStatus[playerid][0], -1);
				PlayerTextDrawSetOutline(playerid,PBarStatus[playerid][0], 0);
				PlayerTextDrawSetProportional(playerid,PBarStatus[playerid][0], 1);
				PlayerTextDrawSetShadow(playerid,PBarStatus[playerid][0], 1);
				PlayerTextDrawUseBox(playerid,PBarStatus[playerid][0], 1);
				PlayerTextDrawBoxColor(playerid,PBarStatus[playerid][0], 0xFF100CFF);
				PlayerTextDrawTextSize(playerid,PBarStatus[playerid][0], 174.000000, 255.000000);
				
				PBarTextReload(playerid);
			    PlayerTextDrawSetString(playerid,PBarText[playerid][1],wSstring);//Waffe
			    format(wSstring,100,"Schaden: %.01f",w_schaden);
			    PlayerTextDrawSetString(playerid,PBarText[playerid][0],wSstring);//Schaden
				format(string,sizeof(string),"Kauffortschritt: %.01f%%",kauf_fortschritt);
				PlayerTextDrawSetString(playerid,PBarText[playerid][2],string);

				fixed_TextDrawShowForPlayer(playerid,PBarRAussen[0]);
				fixed_TextDrawShowForPlayer(playerid,PBarRAussen[2]);
				fixed_TextDrawShowForPlayer(playerid,PBarRInnen[0]);
				fixed_TextDrawShowForPlayer(playerid,PBarRInnen[2]);
				fixed_PlayerTextDrawShow(playerid,PBarStatus[playerid][2]);
				fixed_PlayerTextDrawShow(playerid,PBarStatus[playerid][0]);
				fixed_PlayerTextDrawShow(playerid,PBarText[playerid][0]);
				fixed_PlayerTextDrawShow(playerid,PBarText[playerid][1]);
				fixed_PlayerTextDrawShow(playerid,PBarText[playerid][2]);
			}
			else
			{
			    HideInfoMessage(playerid);
				PlayerShopDrawExit(playerid);
			}
		}
		case SHOPSCREEN_LIQUOR:
		{
		    if(enter == true)
		    {
			    HideInfoMessage(playerid);
				for(new i; i<3; i++)
				{
	                if(PBarStatus[playerid][i] != PlayerText:INVALID_TEXT_DRAW)
	                {
						PlayerTextDrawHide(playerid,PBarStatus[playerid][i]);
						PlayerTextDrawDestroy(playerid,PBarStatus[playerid][i]);
						PBarStatus[playerid][i] = PlayerText:INVALID_TEXT_DRAW;
	                }
					if(PBarText[playerid][i] != PlayerText:INVALID_TEXT_DRAW)
					{
						PlayerTextDrawHide(playerid,PBarText[playerid][i]);
						PlayerTextDrawDestroy(playerid,PBarText[playerid][i]);
						PBarText[playerid][i] = PlayerText:INVALID_TEXT_DRAW;
					}
	            }
				fixed_TextDrawHideForPlayer(playerid,PBarRAussen[0]);
				fixed_TextDrawHideForPlayer(playerid,PBarRAussen[2]);
				fixed_TextDrawHideForPlayer(playerid,PBarRInnen[0]);
				fixed_TextDrawHideForPlayer(playerid,PBarRInnen[2]);
				
				if(GetPVarInt(playerid,"liq_pos") < 0) SetPVarInt(playerid,"liq_pos",5);
				if(GetPVarInt(playerid,"liq_pos") > 5) SetPVarInt(playerid,"liq_pos",0);
				new Float:w_durst = liq_durst[GetPVarInt(playerid,"liq_pos")];
			    switch(GetPVarInt(playerid,"liq_pos"))
			    {
					case 0:	format(string,sizeof(string),"Whiskey");
					case 1: format(string,sizeof(string),"asdf");
					case 2: format(string,sizeof(string),"Pisswasser");
					case 3: format(string,sizeof(string),"Schwarzbier");
					case 4: format(string,sizeof(string),"Zitronenschnaps");
					case 5:	format(string,sizeof(string),"Rotwein");
					default:format(string,sizeof(string),"Unknown");
			    }
			    new Float:kauf_fortschritt = ((float(PlayerNPC[playerid][NPC_MATHEO][cash])/float(liq_preis[GetPVarInt(playerid,"liq_pos")]))*100.0);
			    if(liq_preis[GetPVarInt(playerid,"liq_pos")] == 0) kauf_fortschritt = 100.0;
				if(kauf_fortschritt < 0.0)	kauf_fortschritt = 0.0;
				if(kauf_fortschritt > 100.0)kauf_fortschritt = 100.0;
			    new wSstring[100];
			    format(wSstring,100,"~<~Getraenk: %s~>~",string);
			    format(string,sizeof(string),"~<~ - %s - ~>~~n~ENTER = Kaufen~n~LEER = Verlassen",string);
			   	ShowInfoMessage(playerid,string);

			    PBarStatus[playerid][2] = CreatePlayerTextDraw(playerid,/*178 = 0%, 470 = 100%*/(178.0+(w_durst*2.92)), 285.000000, "_");
				PlayerTextDrawBackgroundColor(playerid,PBarStatus[playerid][2], 0xFF100CFF);
				PlayerTextDrawFont(playerid,PBarStatus[playerid][2], 1);
				PlayerTextDrawLetterSize(playerid,PBarStatus[playerid][2], 0.500000, 1.299999);
				PlayerTextDrawColor(playerid,PBarStatus[playerid][2], -1);
				PlayerTextDrawSetOutline(playerid,PBarStatus[playerid][2], 0);
				PlayerTextDrawSetProportional(playerid,PBarStatus[playerid][2], 1);
				PlayerTextDrawSetShadow(playerid,PBarStatus[playerid][2], 1);
				PlayerTextDrawUseBox(playerid,PBarStatus[playerid][2], 1);
				PlayerTextDrawBoxColor(playerid,PBarStatus[playerid][2], 0xFF100CFF);
				PlayerTextDrawTextSize(playerid,PBarStatus[playerid][2], 174.000000, 255.000000);

			    PBarStatus[playerid][0] = CreatePlayerTextDraw(playerid,/*178 = 0%, 470 = 100%*/(178.0+(kauf_fortschritt*2.92)), 305.000000, "_");
				PlayerTextDrawBackgroundColor(playerid,PBarStatus[playerid][0], 0xFF100CFF);
				PlayerTextDrawFont(playerid,PBarStatus[playerid][0], 1);
				PlayerTextDrawLetterSize(playerid,PBarStatus[playerid][0], 0.500000, 1.299999);
				PlayerTextDrawColor(playerid,PBarStatus[playerid][0], -1);
				PlayerTextDrawSetOutline(playerid,PBarStatus[playerid][0], 0);
				PlayerTextDrawSetProportional(playerid,PBarStatus[playerid][0], 1);
				PlayerTextDrawSetShadow(playerid,PBarStatus[playerid][0], 1);
				PlayerTextDrawUseBox(playerid,PBarStatus[playerid][0], 1);
				PlayerTextDrawBoxColor(playerid,PBarStatus[playerid][0], 0xFF100CFF);
				PlayerTextDrawTextSize(playerid,PBarStatus[playerid][0], 174.000000, 255.000000);

				fixed_PlayerTextDrawShow(playerid,PBarStatus[playerid][2]);
				fixed_PlayerTextDrawShow(playerid,PBarStatus[playerid][0]);

				PBarTextReload(playerid);
			    PlayerTextDrawSetString(playerid,PBarText[playerid][1],wSstring);//Waffe
			    format(wSstring,100,"Durst: -%.01f",w_durst);
			    PlayerTextDrawSetString(playerid,PBarText[playerid][0],wSstring);//Schaden
				format(string,sizeof(string),"Kauffortschritt: %.01f%%",kauf_fortschritt);
				PlayerTextDrawSetString(playerid,PBarText[playerid][2],string);

				fixed_TextDrawShowForPlayer(playerid,PBarRAussen[0]);
				fixed_TextDrawShowForPlayer(playerid,PBarRAussen[2]);
				fixed_TextDrawShowForPlayer(playerid,PBarRInnen[0]);
				fixed_TextDrawShowForPlayer(playerid,PBarRInnen[2]);
				fixed_PlayerTextDrawShow(playerid,PBarStatus[playerid][2]);
				fixed_PlayerTextDrawShow(playerid,PBarStatus[playerid][0]);
				fixed_PlayerTextDrawShow(playerid,PBarText[playerid][0]);
				fixed_PlayerTextDrawShow(playerid,PBarText[playerid][1]);
				fixed_PlayerTextDrawShow(playerid,PBarText[playerid][2]);
		    }
			else
			{
			    HideInfoMessage(playerid);
				PlayerShopDrawExit(playerid);
			}
		}
		case SHOPSCREEN_PIZZA:
		{//Pizzaladen
			if(enter == true)
			{
			    HideInfoMessage(playerid);
				for(new i; i<3; i++)
				{
	                if(PBarStatus[playerid][i] != PlayerText:INVALID_TEXT_DRAW)
	                {
						PlayerTextDrawHide(playerid,PBarStatus[playerid][i]);
						PlayerTextDrawDestroy(playerid,PBarStatus[playerid][i]);
						PBarStatus[playerid][i] = PlayerText:INVALID_TEXT_DRAW;
	                }
					if(PBarText[playerid][i] != PlayerText:INVALID_TEXT_DRAW)
					{
						PlayerTextDrawHide(playerid,PBarText[playerid][i]);
						PlayerTextDrawDestroy(playerid,PBarText[playerid][i]);
						PBarText[playerid][i] = PlayerText:INVALID_TEXT_DRAW;
					}
	            }
				fixed_TextDrawHideForPlayer(playerid,PBarRAussen[0]);
				fixed_TextDrawHideForPlayer(playerid,PBarRAussen[2]);
				fixed_TextDrawHideForPlayer(playerid,PBarRInnen[0]);
				fixed_TextDrawHideForPlayer(playerid,PBarRInnen[2]);
				
				new menue = GetPVarInt(playerid,"menue"),
				    mpreiss			= food_PizzaMenu[menue][mpreis],
					Float:hu_reg	= food_PizzaMenu[menue][mhunger];
					//Float:he_reg	= food_PizzaMenu[menue][mheal];

			    new Mstring[100];
			    new Float:kauf_fortschritt = ((float(PlayerNPC[playerid][NPC_JOE][cash])/float(mpreiss))*100.0);
			    if(kauf_fortschritt < 0.0)  kauf_fortschritt	= 0.0;
			    if(kauf_fortschritt > 100.0)kauf_fortschritt	= 100.0;
			    if(hu_reg < 0.0)            hu_reg              = 0.0;
			    if(hu_reg > 100.0)          hu_reg              = 100.0;

			    format(Mstring,100,"~<~ %s ~>~",food_PizzaMenu[menue][mname]);
			    format(string,sizeof(string),"~<~ - %s - ~>~~n~ENTER = Kaufen~n~LEER = Abbrechen",Mstring);
			   	ShowInfoMessage(playerid,string);

			    PBarStatus[playerid][0] = CreatePlayerTextDraw(playerid,/*178 = 0%, 470 = 100%*/(178.0+(kauf_fortschritt*2.92)), 305.000000, "_");
				PlayerTextDrawBackgroundColor(playerid,PBarStatus[playerid][0], 0xFF100CFF);
				PlayerTextDrawFont(playerid,PBarStatus[playerid][0], 1);
				PlayerTextDrawLetterSize(playerid,PBarStatus[playerid][0], 0.500000, 1.299999);
				PlayerTextDrawColor(playerid,PBarStatus[playerid][0], -1);
				PlayerTextDrawSetOutline(playerid,PBarStatus[playerid][0], 0);
				PlayerTextDrawSetProportional(playerid,PBarStatus[playerid][0], 1);
				PlayerTextDrawSetShadow(playerid,PBarStatus[playerid][0], 1);
				PlayerTextDrawUseBox(playerid,PBarStatus[playerid][0], 1);
				PlayerTextDrawBoxColor(playerid,PBarStatus[playerid][0], 0xFF100CFF);
				PlayerTextDrawTextSize(playerid,PBarStatus[playerid][0], 174.000000, 255.000000);

			    PBarStatus[playerid][2] = CreatePlayerTextDraw(playerid,/*178 = 0%, 470 = 100%*/(178.0+(hu_reg*2.92)), 285.000000, "_");
				PlayerTextDrawBackgroundColor(playerid,PBarStatus[playerid][2], 0xFF100CFF);
				PlayerTextDrawFont(playerid,PBarStatus[playerid][2], 1);
				PlayerTextDrawLetterSize(playerid,PBarStatus[playerid][2], 0.500000, 1.299999);
				PlayerTextDrawColor(playerid,PBarStatus[playerid][2], -1);
				PlayerTextDrawSetOutline(playerid,PBarStatus[playerid][2], 0);
				PlayerTextDrawSetProportional(playerid,PBarStatus[playerid][2], 1);
				PlayerTextDrawSetShadow(playerid,PBarStatus[playerid][2], 1);
				PlayerTextDrawUseBox(playerid,PBarStatus[playerid][2], 1);
				PlayerTextDrawBoxColor(playerid,PBarStatus[playerid][2], 0xFF100CFF);
				PlayerTextDrawTextSize(playerid,PBarStatus[playerid][2], 174.000000, 255.000000);

				PBarTextReload(playerid);
			    PlayerTextDrawSetString(playerid,PBarText[playerid][1],Mstring);//menüname
			    format(Mstring,100,"Hunger: -%.01f",hu_reg);
			    PlayerTextDrawSetString(playerid,PBarText[playerid][0],Mstring);//hunger
				format(string,sizeof(string),"Kauffortschritt: %.01f%%",kauf_fortschritt);
				PlayerTextDrawSetString(playerid,PBarText[playerid][2],string);

				fixed_TextDrawShowForPlayer(playerid,PBarRAussen[0]);
				fixed_TextDrawShowForPlayer(playerid,PBarRAussen[2]);
				fixed_TextDrawShowForPlayer(playerid,PBarRInnen[0]);
				fixed_TextDrawShowForPlayer(playerid,PBarRInnen[2]);
				fixed_PlayerTextDrawShow(playerid,PBarStatus[playerid][2]);
				fixed_PlayerTextDrawShow(playerid,PBarStatus[playerid][0]);
				fixed_PlayerTextDrawShow(playerid,PBarText[playerid][0]);
				fixed_PlayerTextDrawShow(playerid,PBarText[playerid][1]);
				fixed_PlayerTextDrawShow(playerid,PBarText[playerid][2]);
			}
			else
			{
			    HideInfoMessage(playerid);
				PlayerShopDrawExit(playerid);
				DeletePlayerSpecialObject(playerid,GetPlayerSlotBySpecialObject(playerid,GetPVarInt(playerid,"pizza_menu_oid")));
			}
		}
	}
	SetPVarInt(playerid,"cam_move_block",0);
	return 1;
}

ShowPlayerLoginScreen(playerid)
{
	format(query,sizeof(query),"SELECT * FROM pnwl_user WHERE username='%s'",GetName(playerid));
	mysql_query(query);
	mysql_store_result();
	if(mysql_num_rows() > 0)//Ist ig registriert
	{
	    mysql_free_result();
		format(query,sizeof(query),"SELECT * FROM wcf0_user_to_groups WHERE userID='%d' && groupID='%d'",PlayerInfo[playerid][PLAYER_ID],WBB_FULLMEMBER_GROUP_ID);
		mysql_query(query);
		mysql_store_result();
		if(mysql_num_rows() == 0)//ist kein fullmember
		{
		    ShowPlayerDialog(playerid,dialog_NULL,DIALOG_STYLE_MSGBOX,"Du bist kein Fullmember","Guten Tag\n\nwie es scheint wurde dein Fullmemberstatus entfernt. Bitte wende\ndich an einen Administrator oder den Support.\n\nMit freundlichen Grüßen\nDas Postnuke Wasteland Team","Ok","");
		    Kick(playerid);
		    mysql_free_result();
		    return 1;
		}
		mysql_free_result();
		
		PlayerOption[playerid][OptionC] = mysql_GetIntByInt("pnwl_user_option","optionc","userid",PlayerInfo[playerid][PLAYER_ID]);
		if(!(PlayerOption[playerid][OptionC]&optCAlogin))
		{
			format(query, sizeof(query), "SELECT COUNT(*) FROM pnwl_user_logins WHERE userid='%d' AND alogin='1' AND success='1' AND gpci='%s' AND ip LIKE '%s.%%' AND timestamp>%d",PlayerInfo[playerid][PLAYER_ID],GetGPCI(playerid),CORE::GetIpBlock(GetIP(playerid),3),gettime(_,_,_)-(CACHED_LOGIN_VALIDATION*60));
			new auth_rows = mysql_GetResultAsInt(query);
			if(auth_rows >= 1) return OnPlayerLogin(playerid,_,1);
		}
		
	    format(string,sizeof(string),"{C87E35}Willkommen zurueck, %s.\n{F1F7DC}Bitte gebe dein Passwort ein:\n\n\n{878375}Hinweis: Verwende das selbe Passwort wie im Forum",GetName(playerid));
		ShowPlayerDialog(playerid,dialog_MAIN_LOGIN,DIALOG_STYLE_PASSWORD,"Login",string,"Login","Verlassen");
		mysql_free_result();
		return 1;
	}
	else
	{
	    mysql_free_result();
		format(query,sizeof(query),"SELECT * FROM wcf0_user WHERE username='%s'",GetName(playerid));
		mysql_query(query);
		mysql_store_result();
		if(mysql_num_rows() > 0)
		{
		    mysql_free_result();
		    
			new bool:has_account = false;
			PlayerInfo[playerid][PLAYER_ID] = mysql_GetIntByString("wcf0_user","userID","username",GetName(playerid));

			format(query,sizeof(query),"SELECT * FROM pnwl_user WHERE userid='%d'",PlayerInfo[playerid][PLAYER_ID]);
			mysql_query(query);
			mysql_store_result();
			if(mysql_num_rows() > 0)//hat einen ingame account unter einem anderen namen
			{
			    mysql_free_result();
			    new cor_name[50],in_use=-1;
			    format(cor_name,sizeof(cor_name),"%s",mysql_GetStringByInt("pnwl_user","username","userid",PlayerInfo[playerid][PLAYER_ID]));
				if(!IsValidName(cor_name))
				{
				    format(string,sizeof(string),"{C87E35}Guten Tag, %s\n\nwie es scheint hast du schon einen InGame Account {878375}(Name: %s){C87E35}. Bitte komme\nmit diesem Namen wieder.\n\nMit freundlichen Grüßen\nDas Postnuke Wasteland Team",PlayerInfo[playerid][pName],strlen(cor_name)>3?cor_name:("Fehlerhaft"));
				    ShowPlayerDialog(playerid,dialog_NULL,DIALOG_STYLE_MSGBOX,"{C87E35}Anderer Account bereits vorhanden",string,"Ok","");
				    Kick(playerid);
				    return 1;
				}

			    for(new is; is<=__SERVER[HIGHEST_PLAYER_ID]; is++)
			    {
			        if(IsPlayerConnected(is))
			        {
				        if(!strcmp(PlayerInfo[is][pName],cor_name))
				        {
				            in_use = is;
				            break;
				        }
					}
			    }
			    if(in_use != -1)
			    {
				    format(string,sizeof(string),"{C87E35}Guten Tag, %s\n\nwie es scheint hast du schon einen InGame Account {878375}(Name: %s){C87E35}. Dieser wird jedoch\nbereits verwendet. Bitte versuche es später mit dem neuen Forennamen erneut.\n\nMit freundlichen Grüßen\nDas Postnuke Wasteland Team",PlayerInfo[playerid][pName],cor_name);
				    ShowPlayerDialog(playerid,dialog_NULL,DIALOG_STYLE_MSGBOX,"{C87E35}Anderer Account bereits vorhanden",string,"Ok","");
				    Kick(playerid);
				    return 1;
				}
				else
				{
				    SetPlayerName(playerid,cor_name);
				    format(PlayerInfo[playerid][pName],MAX_PLAYER_NAME,"%s",cor_name);
				    format(string,sizeof(string),#FORMAT_CHAT_INFO"Es gab Komplikationen mit dem Namen \"%s\", du wurdest zu \"%s\" umbenannt.",PlayerInfo[playerid][pName],cor_name);
				    SendClientMessage(playerid,GRUEN,string);
				    has_account = true;
				}
			}
			mysql_free_result();

			format(query,sizeof(query),"SELECT COUNT(*) FROM wcf0_user_to_groups WHERE userID='%d' && groupID='%d'",PlayerInfo[playerid][PLAYER_ID],WBB_FULLMEMBER_GROUP_ID);
			if(mysql_GetResultAsInt(query) != 1)//ist kein fullmember
			{
			    format(string,sizeof(string),"{C87E35}Guten Tag, %s\n\nwie es scheint bist du noch kein Fullmember. Bitte wende\nbeantrage im Forum eine kostenlose Fullmembermitgliedschaft.\n\nMit freundlichen Grüßen\nDas Postnuke Wasteland Team",PlayerInfo[playerid][pName]);
			    ShowPlayerDialog(playerid,dialog_NULL,DIALOG_STYLE_MSGBOX,"{C87E35}Du bist kein Fullmember",string,"Ok","");
			    Kick(playerid);
			    mysql_free_result();
			    return 1;
			}
			mysql_free_result();
			if(has_account != true) OnPlayerRegister(playerid);
            PlayerOption[playerid][OptionC] = mysql_GetIntByInt("pnwl_user_option","optionc","userid",PlayerInfo[playerid][PLAYER_ID]);
            if(!(PlayerOption[playerid][OptionC]&optCAlogin) && !strcmp(GetIP(playerid),mysql_GetStringByInt("pnwl_user","ip","userid",PlayerInfo[playerid][PLAYER_ID])) && !strcmp(GetGPCI(playerid),mysql_GetStringByInt("pnwl_user","gpci","userid",PlayerInfo[playerid][PLAYER_ID]))) return OnPlayerLogin(playerid,_,1);
		    else
			{
			    format(string,sizeof(string),"{C87E35}Willkommen, %s.\n{F1F7DC}Bitte gebe dein Passwort ein:\n\n\n{878375}Hinweis: Verwende das selbe Passwort wie im Forum",GetName(playerid));
				ShowPlayerDialog(playerid,dialog_MAIN_LOGIN,DIALOG_STYLE_PASSWORD,"{C87E35}Login",string,"Login","Verlassen");
			}
		}
		else
		{
		    mysql_free_result();
			ShowPlayerDialog(playerid,dialog_NULL,DIALOG_STYLE_MSGBOX,"Account nicht registriert","Guten Tag. Du scheinst noch keinen Gameaccount zu besitzen. Bitte lege\neinen Forenaccount an um automatisch einen Gameaccount zu erstellen. Der InGameName ist\nder selbe wie im Forum.\n\nDein PostNuke Team","Weiter","");
			Kick(playerid);
		}
	}
	return 1;
}

ShowPlayerDevComment(playerid,comment_id)
{
	if(comment_id < 0 || comment_id >= (MAX_DEVELOPER_PICKUPS+1)) return 0;
	format(query,sizeof(query),"{5C61A1}Entwicklerkommentar %d: \"%s\"",comment_id,DevComTitle[comment_id][comhead]);
	switch(comment_id)
	{//0 existiert nicht
		case 0: format(string,sizeof(string),"{5C61A1}Autor: {F1F7DC}-			\n{5C61A1}Datum: {F1F7DC}-			\n\n{5C61A1}Nachricht:\n{F1F7DC}-");
		case 1: format(string,sizeof(string),"{5C61A1}Autor: {F1F7DC}NeoPhoenix	\n{5C61A1}Datum: {F1F7DC}13.10.2011	\n\n{5C61A1}Nachricht:\n{F1F7DC}Kurz und knapp mal Fort Carson in Zahlen (Version Alpha 0.1a):\n300 Objekte\n18 Pickups\n5 NPCs\n6 Interiors");
		case 2: format(string,sizeof(string),"{5C61A1}Autor: {F1F7DC}NeoPhoenix	\n{5C61A1}Datum: {F1F7DC}14.12.2011	\n\n{5C61A1}Nachricht:\n{F1F7DC}Herzlichen Glückwunsch, du hast den geheimen Entwicklerkommentar\nim \"Dungeon 1\" entdeckt. Ich musste diese Mine alleine mappen,\nda BuggyB zur Zeit PC\nProbleme hat. Ich hoffe sie gefällt euch ;)");
		case 3: format(string,sizeof(string),"{5C61A1}Autor: {F1F7DC}NeoPhoenix	\n{5C61A1}Datum: {F1F7DC}12.07.2012	\n\n{5C61A1}Nachricht:\n{F1F7DC}Du hast diesen Kommentar gefunden, weil in dir ein\nkleiner Barney schlummert. Who is your daddy?");
		case 4: format(string,sizeof(string),"{5C61A1}Autor: {F1F7DC}NeoPhoenix	\n{5C61A1}Datum: {F1F7DC}04.01.2013	\n\n{5C61A1}Nachricht:\n{F1F7DC}Veltins? Krombacher? Herforder? Nein! Das mit Abstand\nbeste Bier ist defintiv Oettinger. Es überzeug mit einem absolut\ngünstigen Preis und spart dennoch nicht am Geschmack.");
	}
	ShowPlayerDialog(playerid,dialog_CROOM_SI_DEVCOM,DIALOG_STYLE_MSGBOX,query,string,"Zurück","");
	return 1;
}

language_menu(playerid)
{
	/*new langss[MAX_LANGUAGES][5],count_lang=0,filepath[MAX_PATH_LEN];
	nfile::GetArray("languages",langss,LANG_STARTUP);
	for(new l; l<MAX_LANGUAGES; l++)
	{
		if(!langss[l][0]) continue;
		format(filepath,MAX_PATH_LEN,"%s/%s/%s_info.ini",LANG_PATH,langss[l],langss[l]);
		if(count_lang == 0) format(string,sizeof(string),"%s",nfile::GetValue("lang",filepath));
		else format(string,sizeof(string),"%s\n%s",string,nfile::GetValue("lang",filepath));
		count_lang++;
	}*/
	ShowPlayerDialog(playerid,dialog_MAIN_SELECT_LANG,DIALOG_STYLE_LIST,"Sprachauswahl","Deutsch","Weiter","");
	return 1;
}

gun_UpdateAmmoDisplay(playerid,ammo)
{
	PlayerTextDrawHide(playerid,WeaponAmmo[playerid]);
	format(query,sizeof(query),"%d",ammo);
	PlayerTextDrawSetString(playerid,WeaponAmmo[playerid],query);
	PlayerTextDrawShow(playerid,WeaponAmmo[playerid]);
	return 1;
}

gun_SlotByID(weaponid)
{
	switch(weaponid)
	{
		//Gewehre
		case 25,27,30,31,33,34,35,37,39: return 3;
		//Pistolen
		case 22,23,24,26,28,29,32: return 2;
		default: return 0;//Schlagwaffen
	}
	return 0;//Undefined
}

gun_GetAmmoStorage(playerid,weaponid)
{
	new type = WeaponInfo[weaponid][wUsedAmmo],
	    strx[24];
	if(type == 0) format(strx,sizeof(strx),"9mm Munition");
	else if(type == 1) format(strx,sizeof(strx),"5.56 Munition");
	else if(type == 2) format(strx,sizeof(strx),".308 Munition");
	else if(type == 3) format(strx,sizeof(strx),"Schrotpatrone");
	else if(type == 4) format(strx,sizeof(strx),"Rakete");
	else format(strx,sizeof(strx),".");
	return item::CountPlayerItems(playerid,item::GetItemByName(strx));
}

gun_GivePlayerAmmo(playerid,weaponid,ammo)
{
	printf("give ammo %d %d",weaponid,ammo);
	new type = WeaponInfo[weaponid][wUsedAmmo],
	    strx[24];
	if(type == 0) format(strx,sizeof(strx),"9mm Munition");
	else if(type == 1) format(strx,sizeof(strx),"5.56 Munition");
	else if(type == 2) format(strx,sizeof(strx),".308 Munition");
	else if(type == 3) format(strx,sizeof(strx),"Schrotpatrone");
	else if(type == 4) format(strx,sizeof(strx),"Rakete");
	else format(strx,sizeof(strx),".");
	new item = item::GetItemByName(strx);
	if(item >= 1)
	{
	    printf("itemid %d",item);
		if(ammo >= 1) return item::GivePlayerItem(playerid,item,ammo,._display=false);
		if(ammo <  0) return item::RemovePlayerItems(playerid,item,-ammo);
	}
	return 0;
}

stock PLAYER::SavePlayerWeapons(playerid)
{
	format(string,sizeof(string),"UPDATE pnwl_user_weapons SET weapon_0='%d',weapon_1='%d' WHERE userid='%d'",PlayerWeapon[playerid][2][wWeaponID],PlayerWeapon[playerid][3][wWeaponID],PlayerInfo[playerid][PLAYER_ID]);
	if(PlayerWeapon[playerid][2][wWeaponID] >= 1 || PlayerWeapon[playerid][3][wWeaponID] >= 1) mysql_query_once(string);
	return 1;
}

stock PLAYER::ResetPlayerWeapons(playerid,bool:_save=true)
{
    ResetPlayerWeapons(playerid);
	if(_save)
	{
		format(string,sizeof(string),"UPDATE pnwl_user_weapons SET weapon_0='0',weapon_1='0' WHERE userid='%d'",string,PlayerInfo[playerid][PLAYER_ID]);
		mysql_query_once(string);
	}
	for(new i; i<MAX_PLAYER_WEAPONS; i++)
	{
	    PlayerWeapon[playerid][i][wWeaponID]	= 0;
	    PlayerWeapon[playerid][i][wMagAmmo]		= 0;
	}
	return 1;
}

stock PLAYER::LoadPlayerWeapons(playerid,bool:reset_old=true)
{
	if(!IsPlayerConnected(playerid) || IsPlayerNPC(playerid)) return 1;
    if(reset_old) PLAYER::ResetPlayerWeapons(playerid,false);

	format(string,sizeof(string),"SELECT * FROM pnwl_user_weapons WHERE userid=%d",PlayerInfo[playerid][PLAYER_ID]);
	mysql_query(string);
	mysql_store_result();
	mysql_retrieve_row();
	mysql_fetch_field_row(string,"weapon_0");
	PlayerWeapon[playerid][2][wWeaponID] = strval(string);
	if(strval(string)) format(query,sizeof(query),FORMAT_CHAT_INFO"Du hast die Waffe \"%s\" erhalten.",WeaponInfo[strval(string)][wName]);
	SendClientMessage(playerid,GRUEN,query);
	mysql_fetch_field_row(string,"weapon_1");
	PlayerWeapon[playerid][3][wWeaponID] = strval(string);
	if(strval(string)) format(query,sizeof(query),FORMAT_CHAT_INFO"Du hast die Waffe \"%s\" erhalten.",WeaponInfo[strval(string)][wName]);
	SendClientMessage(playerid,GRUEN,query);
	mysql_free_result();
	
	SetPlayerArmedWeapon(playerid,0);
	PlayerCache[playerid][current_weapon_id] = 0;
	equip::UpdateWeapons(playerid);
	return 1;
}

OnPlayerWeaponChange(playerid,oldweapon,newweapon)
{
    if(GetPVarInt(playerid,"_guns_event") == 1)		return;
    if(GetPVarInt(playerid,"_guns_remove") == 1)	return;
    printf("oldweapon %s newweapon %s",WeaponInfo[oldweapon][wName],WeaponInfo[newweapon][wName]);
    
    if(GetPVarInt(playerid,"in_no_dm_zone") == 1)
	{
	    if(PlayerCurrentWeaponSlot[playerid] == 2 || PlayerCurrentWeaponSlot[playerid] == 3) equip::RemoveSlot(playerid,ITEM_ACTION_SLOT);
	    new data[2],
			slot = GetWeaponSlot(oldweapon);
	    GetPlayerWeaponData(playerid,slot,data[0],data[1]);
	    slot = gun_SlotByID(oldweapon);
	    PlayerWeapon[playerid][slot][wMagAmmo] = data[1];
	    ResetPlayerWeapons(playerid);
		SetPlayerArmedWeapon(playerid,0);
		PlayerCache[playerid][current_weapon_id] = 0;
		PlayerCurrentWeaponSlot[playerid] = 0;
		PlayerTextDrawHide(playerid,WeaponAmmo[playerid]);
		return;
    }

	if(GetPVarInt(playerid,"_reloading") == 1)
	{
		SetPlayerArmedWeapon(playerid,GetPVarInt(playerid,"_reloading_w"));
		return;
	}
	else
	{
	    new data[2],
			slot		= GetWeaponSlot(oldweapon),
			clipsize	= GetWeaponClipsize(playerid,oldweapon);
	    GetPlayerWeaponData(playerid,slot,data[0],data[1]);
	    slot = gun_SlotByID(oldweapon);
	    PlayerWeapon[playerid][slot][wMagAmmo] = data[1];
        if(clipsize == 0 || data[1] >= 1)
        {//Normaler Wechsel
            SetPlayerArmedWeapon(playerid,oldweapon);
            return;
            //Waffe zurücksetzen
        }
        else if(data[1] == 0)
        {//Magazin leer geschossen
            if(clipsize >= 1)
            {
	            //Leer, Waffe entfernen - manuell nachladen!
	            gun_UpdateAmmoDisplay(playerid,gun_GetAmmoStorage(playerid,oldweapon));
                PlayerWeapon[playerid][PlayerCurrentWeaponSlot[playerid]][wMagAmmo] = 0;
                PlayerCache[playerid][current_weapon_id] = 0;
                ResetPlayerWeapons(playerid);
                SetPlayerArmedWeapon(playerid,0);
                equip::RemoveSlot(playerid,ITEM_ACTION_SLOT);
                equip::UseEquipment(playerid,WeaponInfo[oldweapon][wObjectID],RightHand,.oslot=ITEM_ACTION_SLOT);
                return;
			}
			else
			{
			    print("SCHWERWIEGENDER FEHLER!");
			    PlayerTextDrawHide(playerid,WeaponAmmo[playerid]);
                PlayerWeapon[playerid][PlayerCurrentWeaponSlot[playerid]][wMagAmmo] = 0;
                PlayerCache[playerid][current_weapon_id] = 0;
                ResetPlayerWeapons(playerid);
                SetPlayerArmedWeapon(playerid,0);
                PlayerCurrentWeaponSlot[playerid] = 0;
                return;
			}
        }
        else
        {
            SetPlayerArmedWeapon(playerid,oldweapon);
            return;
        }
	}
	//return 1;
}

forward jaegers_OnFinishMovement(objectid,dparam);
public jaegers_OnFinishMovement(objectid,dparam)
{
	new targetid = -1;
	for(new i; i<MAX_JAEGER_POS; i++) if(objectid == JaegersObject[i]) targetid = i;
	if(targetid >= 0)
	{
	    if(dparam >= 3 || random(5) <= 3) return 1;
    	new Float:veclen = (50.0/float(dparam+1));
    	jaegers_MoveTarget(targetid,veclen,dparam);
	}
	return 1;
}

//Callbacks
public OnPlayerTakeDamage(playerid,issuerid,Float:amount,weaponid)
{
	if(IsPlayerFCNPC(playerid)) return 1;
    if(IsPlayerNPC(playerid)) return 0;
    if(PlayerEvent[playerid][TutorialStep][0] != -1 || PlayerEvent[playerid][IstTot] >= 1)
    {
		SetPlayerHealth(playerid,500.0);
        return 1;
    }

	if(PlayerEvent[playerid][LOGGED_IN])
	{
		if(issuerid != INVALID_PLAYER_ID && IsPlayerConnected(issuerid) && PlayerEvent[playerid][LOGGED_IN])
		{
		    if(PlayerInfo[playerid][pGang] == PlayerInfo[issuerid][pGang]) return 0;
		    if(GetPVarInt(playerid,"in_no_dm_zone") == 1 || GetPVarInt(issuerid,"in_no_dm_zone") == 1)
		    {
		  	    new Float:nhp;
		        GetPlayerHealth(playerid,nhp);
		        SetPlayerHealth(playerid,nhp);
		        
		        GameTextForPlayer(issuerid,"~r~NO DM ZONE",4000,5);
		        SetPlayerArmedWeapon(issuerid,0);
		        SetPVarInt(issuerid,"no_dm_warnings",GetPVarInt(issuerid,"no_dm_warnings")+1);
		        if(GetPVarInt(issuerid,"no_dm_warnings") >= MAX_NO_DM_WARNINGS)
		        {
		            SendClientMessage(issuerid,ROT,"======================================================");
		            SendClientMessage(issuerid,ROT,"=== Du wurdest wegen DM in einer NoDM Zone gekickt ===");
		            SendClientMessage(issuerid,ROT,"======================================================");
		            CORE::BanEvent(PlayerInfo[issuerid][PLAYER_ID],NO_DM_BANTIME,USER_BAN_SYSTEM,"DM in NoDM Zone",false);
		            Kick(issuerid);
		        }
		    }
		    else
		    {
		        new bool:in_boxfight = false;
		        if(BoxTime >= 1 && (BoxerID[0] == playerid || BoxerID[1] == playerid)) in_boxfight = true;
		        
				SetPVarInt(playerid,"attacked_by",issuerid);
				SetPVarInt(playerid,"attacked_time",5);
				
				if(weaponid >= 0 && weaponid <= 42)
				{
				    new Float:p1[3],
				        Float:p2[3],
						Float:dist,
						Float:nhp,
						Float:damage;
			        GetPlayerHealth(playerid,nhp);
					GetPlayerPos(playerid,p1[0],p1[1],p1[2]);
					GetPlayerPos(issuerid,p2[0],p2[1],p2[2]);
					dist = floatsqroot(
					        floatpower(p2[0]-p1[0],2)+
					        floatpower(p2[1]-p1[1],2)+
					        floatpower(p2[2]-p1[2],2)
					    );

					if(weaponid <= 1)
					{//Faust oder Equipment
					    print("fause");
						if(PlayerCache[issuerid][equip_fist_item] >= 1 && PlayerCurrentWeaponSlot[issuerid] == 1)
						{//Equipment
						    print("equipment");
						    switch(item_ItemInfo[PlayerCache[issuerid][equip_fist_item]][iObjectID])
						    {
						        case 18634: weaponid = 43;//Brechstange
						        case 337: 	weaponid = 44;//Schaufel
						        case 18635: weaponid = 45;//Hammer
						        case 18633: weaponid = 46;//Schraubenschlüssel
						        case 335: 	weaponid = 47;//Messer
						        case 18642: weaponid = 48;//Tazer
						    }
						}
					}
					printf("weaponid = %d",weaponid);
			        //printf("\nPlayerid %d, Issuerid %d\nWeaponID %d BasicDamage %0.2f\nPlayers health %0.2f",playerid,issuerid,weaponid,amount,nhp);
				    damage = WeaponInfo[weaponid][wModDamage];
				    //printf("Modified damage %0.2f",damage);
				    if(WeaponInfo[weaponid][wType] & wSpecial)
				    {
				        print("special");
						switch(weaponid)
						{
						    case 48:
						    {//Tazer
						        print("tazer");
						        if(!in_boxfight)
						        {//Tazern
						            print("boxfight");
						            if(PlayerResource[issuerid][Batterien] >= 1.0)
						            {
						                print("TAZER!!!!");
						                if(PlayerStatus[playerid][KoTime] < KO_TIME_TAZER) status::SetPlayerKnockoutTime(playerid,KO_TIME_TAZER);
										CreateTimedObject(18724,p1[0],p1[1],p1[2]-1.0,.time=1000);//Tazing object
						            	PlayerResource[issuerid][Batterien] -= 1.0;
						            }
						        }
						    }
						}
				    }
				    
					if(WeaponInfo[weaponid][wAttribute] & wThrowBack)
					{
						if(dist < THROW_BACK_MAX_DIST)
						{
							if(dist < 1.0) dist = 1.0;
							new Float:vec[3],vec_offset;
							vec[0] = (p2[0]-p1[0]);
							vec[1] = (p2[1]-p1[1]);
							vec[2] = (p2[2]-p1[2]);
							if(vec[0] > vec[1]) 			vec_offset = 0;
							else                			vec_offset = 1;
							if(vec[2] > vec[vec_offset])    vec_offset = 2;
							vec[0] = (((vec[0]/vec[vec_offset])*(1.0/dist))*THROW_BACK_MULTI);
							vec[1] = (((vec[1]/vec[vec_offset])*(1.0/dist))*THROW_BACK_MULTI);
							vec[2] = (((vec[2]/vec[vec_offset])*(1.0/dist))*THROW_BACK_MULTI);
							SetPlayerVelocity(playerid,vec[0],vec[1],vec[2]+0.1);
						}
					}
					if(WeaponInfo[weaponid][wAttribute] & wKnockout)
					{
					    if(random(100) < 10)
					    {//10%
					        #define KO_TIME_BLUNT (10)
					        status::SetPlayerKnockoutTime(playerid,KO_TIME_BLUNT);
					    }
					}
					if(WeaponInfo[weaponid][wAttribute] & wSpread)
					{
					    if(dist < MAX_SPREAD_DIST) damage = damage*((MAX_SPREAD_DAMAGE-((MAX_SPREAD_DAMAGE-MIN_SPREAD_DAMAGE)/MAX_SPREAD_DIST))*dist);
					    else damage = 0.0;
					}
					if(WeaponInfo[weaponid][wAttribute] & wTaunt)
					{
					}
					if(WeaponInfo[weaponid][wAttribute] & wBleed)
					{
						if(PlayerStatus[playerid][BleedingLevel] < WEAPON_BLEEDING_LEVEL) PlayerStatus[playerid][BleedingLevel] = WEAPON_BLEEDING_LEVEL;
					}
					if(WeaponInfo[weaponid][wAttribute] & wBurn)
					{
					}
					if(WeaponInfo[weaponid][wAttribute] & wExplode)
					{
					}
				    
					if(damage > 0.0 && WeaponInfo[weaponid][wType] & wSchuss)
					{
						new bool:_headshot=false;
					    if(WeaponInfo[weaponid][wAttribute] & wHeadshot)
					    {
						    new Float:pos[3];
						    GetPlayerPos(playerid,pos[0],pos[1],pos[2]);
							if(IsPlayerAimingAt(issuerid,pos[0],pos[1],pos[2]+0.8,0.2))
							{//Headshot
		                    	if(!PlayerPremium[playerid][HelmetTime] && equip::HasInUse(playerid,19141,Head))
								{
									damage *= HEADSHOT_DAMAGE_MODIFIER;//50% Headshotbonus
									//printf("Headshot modifier *%0.2f = %0.2f",HEADSHOT_DAMAGE_MODIFIER,damage);
									GameTextForPlayer(issuerid,"~r~Headshot!",500,4);
									SetPVarInt(issuerid,"am_bullseye",GetPVarInt(issuerid,"am_bullseye")+1);
									_headshot = true;
								}
							}
	                    }
	                    if(!_headshot)
	                    {
					    	if(PlayerPremium[playerid][ArmourTime] && equip::HasInUse(playerid,19142,Spine))
							{
								damage *= ARMOUR_DAMAGE_MODIFIER;//40% weniger Schaden
								//printf("Armour modifier *%0.2f = %0.2f",ARMOUR_DAMAGE_MODIFIER,damage);
							}
					    }
					    
						//Weaponstats
						new wstring[15];
						format(wstring,sizeof(wstring),"w_%d_HIT",weaponid);
						SetPVarInt(issuerid,wstring,GetPVarInt(issuerid,wstring)+1);
						format(wstring,sizeof(wstring),"w_%d_DAM",weaponid);
						SetPVarFloat(issuerid,wstring,GetPVarFloat(issuerid,wstring)+amount);
		                SetPVarFloat(issuerid,"am_offensive",GetPVarFloat(issuerid,"am_offensive")+amount);
		                
						if(PlayerStatus[playerid][BleedingLevel] < WEAPON_BLEEDING_LEVEL) PlayerStatus[playerid][BleedingLevel] = WEAPON_BLEEDING_LEVEL;
		            }
					//printf("Health-Amount-Damage = %0.2f+%0.2f-%0.2f = %0.2f\n",nhp,amount,damage,(nhp+amount-damage));
					if(!in_boxfight) SetPlayerHealth(playerid,(nhp-damage));
					else
					{
						SetPVarFloat(playerid,"box_hp",GetPVarFloat(playerid,"box_hp")+damage);
						SetPlayerHealth(playerid,100.0);
					}
					SetPVarFloat(playerid,"am_defensive",GetPVarFloat(playerid,"am_defensive")+amount);
					return 0;
				}
				SetPVarFloat(playerid,"am_defensive",GetPVarFloat(playerid,"am_defensive")+amount);
			}
		}
	}
	return 1;
}

public OnPlayerEnterCheckpoint(playerid)
{
	if(IsPlayerNPC(playerid)) return 1;
	if(PlayerInfo[playerid][pOnMission] && IsPlayerInRangeOfPoint(playerid,PlayerInfo[playerid][pMissionCP][3],PlayerInfo[playerid][pMissionCP][0],PlayerInfo[playerid][pMissionCP][1],PlayerInfo[playerid][pMissionCP][2]))
	{
	    if(OnPlayerMissionCP(playerid))
	    {
		    PlayerInfo[playerid][pOnMission] = false;
		    DestroyPlayerObject(playerid,PlayerInfo[playerid][pMissionFlare]);
		    DisablePlayerCheckpoint(playerid);
	    }
	    return 1;
	}
	return 1;
}

item::OnPlayerItemUse(playerid,item,bool:_remove_item=true)
{
	if(IsPlayerNPC(playerid)) return 1;
	if(item < 0 || item >= MAX_ITEMS || PlayerEvent[playerid][IstTot] >= 1) return 0;//Fehler
	new itemid = item_PlayerItem[playerid][item][iID];
	if(PlayerEvent[playerid][TutorialStep][0] == 4 && PlayerEvent[playerid][TutorialStep][1] == 1)
	{
		if(IsPlayerInRangeOfPoint(playerid,3.0,671.8541,-2356.3027,15.8544) && !strcmp(item_ItemInfo[itemid][iName],"[Q] Kellerschluessel"))
		{
		    if(GetPVarInt(playerid,"tut_funk_used") != 1) return 1;
		    DeletePVar(playerid,"tut_funk_used");
		    HideInfobox(playerid);
		    DisablePlayerMissionCP(playerid);
		    PlayerEvent[playerid][TutorialStep][1] = 2;
		    w_SetPlayerPos(playerid,661.38488769531,-2369.0268554688,16.892295837402,_,4);
		    SetPlayerMissionCP(playerid,584.41088867188,-2430.8786621094,10.902749061584);
		    SetPVarInt(playerid,"tut_intera_pick",CreatePickup(1318,1,-173.6472,1160.8484,87.5898,GetPlayerVirtualWorld(playerid)));//Interaktionssymbol am Tor
		    SetPVarInt(playerid,"tut_intera_set",1);
		    quest::OnQuestUpdate(playerid,0,2);
		    PlayerStatus[playerid][Radioaktiv] = 1000.0;
		    status::UpdateDraws(playerid);
		    format(string,sizeof(string),"{F1F7DC}Falls du in radioaktiv versuchte Zonen gelangst erscheint\nunten rechts ein Geigerzähler, der dir anzeigt, wie viel\nRadioaktivität du pro Sekunde aufnimmst.");
		    strcat(string,"Oben rechts zeigen\ndir mehrere Balken an, wie stark du bereits verstrahlt bist.\nBehandelst du die Strahlung nicht früh genug wirst du Schaden\nerleiden und eventuell sterben.\nDie Balken oben rechts bedeuten:\nGewicht\nHunger\nDurst\nMüdigkeit\nGesundheit\nVerstrahlung");
		    ShowPlayerDialog(playerid,dialog_NULL,DIALOG_STYLE_MSGBOX,"{F1F7DC}Keller betreten",string,"Ok","");
		    item::RemovePlayerItems(playerid,itemid,1,item);
		    return 1;
		}
		return 1;
	}
    if(PlayerEvent[playerid][TutorialStep][0] == 4 && PlayerEvent[playerid][TutorialStep][1] == 5)
	{
	    ShowPlayerDialog(playerid,dialog_NULL,DIALOG_STYLE_MSGBOX,"{F1F7DC}Milit. Medizin konsumiert...","{F1F7DC}Du hast die Milit. Medizin konsumiert, die Radioaktivität sollte geheilt sein.\nVerschwinde aus dem Bunker!","Ok","");
		PlayerEvent[playerid][TutorialStep][1] = 6;
		HideInfobox(playerid);
	    SetPlayerMissionCP(playerid,563.08074951172,-2456.591796875,15.820274353027);
     	item::ResetPlayerItems(playerid,true);
     	quest::OnQuestUpdate(playerid,0,6);

     	SetPlayerHealth(playerid,200.0);
	    PlayerStatus[playerid][Radioaktiv] 	= 0.0;
	    PlayerStatus[playerid][Muedigkeit] 	= 0.0;
	    PlayerStatus[playerid][Hunger]      = 0.0;
	    PlayerStatus[playerid][Durst]       = 0.0;
	    status::UpdateDraws(playerid);
		return 1;
	}
	if(item_ItemInfo[itemid][iAction] & canUse)
	{//Kann benutzt werden
		new result = 1;
	    format(string,sizeof(string),"item_Use_%s",item::ConvertNameToFunc(itemid),string);
	    result = CallRemoteFunction(string,"d",playerid);
	    if(result != 1) return SendClientMessage(playerid,-1,#FORMAT_CHAT_ERROR"Du kannst dieses Item momentan nicht verwenden"),1;
		format(string,sizeof(string),#FORMAT_CHAT_INFO"Du hast das Item \"%s\" verwendet{878375}",item_ItemInfo[itemid][iName]);
		if(item_ItemInfo[itemid][iEffekt][0] != 0.0)
		{//Health
			new Float:hp;
			GetPlayerHealth(playerid,hp);
			hp += item_ItemInfo[itemid][iEffekt][0];
			SetPlayerHealth(playerid,hp);
			format(string,sizeof(string),"%s, %c%dhp",string,item_ItemInfo[itemid][iEffekt][0]?'+':'-',floatround(abs(item_ItemInfo[itemid][iEffekt][0])));
		}
		if(item_ItemInfo[itemid][iEffekt][1] != 0.0)
		{//Radioaktivität
		    PlayerStatus[playerid][Radioaktiv] 				+= item_ItemInfo[itemid][iEffekt][1];
		    if(PlayerStatus[playerid][Radioaktiv] > 100.0) 	PlayerStatus[playerid][Radioaktiv] 		= 100.0;
		    if(PlayerStatus[playerid][Radioaktiv] < 0.0)   	PlayerStatus[playerid][Radioaktiv] 		= 0.0;
		    format(string,sizeof(string),"%s, %c%drad",string,item_ItemInfo[itemid][iEffekt][1]?'+':'-',floatround(abs(item_ItemInfo[itemid][iEffekt][1])));
		}
		if(item_ItemInfo[itemid][iEffekt][2] != 0.0)
		{//Hunger
		    PlayerStatus[playerid][Hunger] 					+= item_ItemInfo[itemid][iEffekt][2];
		    if(PlayerStatus[playerid][Hunger] > 100.0) 		PlayerStatus[playerid][Hunger] 			= 100.0;
		    if(PlayerStatus[playerid][Hunger] <   0.0) 		PlayerStatus[playerid][Hunger] 			= 0.0;
		    format(string,sizeof(string),"%s, %c%d Hunger",string,item_ItemInfo[itemid][iEffekt][2]?'+':'-',floatround(abs(item_ItemInfo[itemid][iEffekt][2])));
		}
		if(item_ItemInfo[itemid][iEffekt][3] != 0.0)
		{//Durst
		    PlayerStatus[playerid][Durst] 					+= item_ItemInfo[itemid][iEffekt][3];
		    if(PlayerStatus[playerid][Durst] > 100.0) 		PlayerStatus[playerid][Durst] 			= 100.0;
		    if(PlayerStatus[playerid][Durst] <   0.0) 		PlayerStatus[playerid][Durst] 			= 0.0;
		    format(string,sizeof(string),"%s, %c%d Durst",string,item_ItemInfo[itemid][iEffekt][3]?'+':'-',floatround(abs(item_ItemInfo[itemid][iEffekt][3])));
		}
		if(item_ItemInfo[itemid][iEffekt][4] != 0.0)
		{//Müdigkeit
		    PlayerStatus[playerid][Muedigkeit] 				+= item_ItemInfo[itemid][iEffekt][4];
		    if(PlayerStatus[playerid][Muedigkeit] > 100.0) 	PlayerStatus[playerid][Muedigkeit] 		= 100.0;
		    if(PlayerStatus[playerid][Muedigkeit] <   0.0) 	PlayerStatus[playerid][Muedigkeit] 		= 0.0;
		    format(string,sizeof(string),"%s, %c%d Müdigkeit",string,item_ItemInfo[itemid][iEffekt][4]?'+':'-',floatround(abs(item_ItemInfo[itemid][iEffekt][4])));
		}
		SendClientMessage(playerid,GRUEN,string);
	    if(_remove_item) item::RemovePlayerItems(playerid,itemid,1,item);
	    status::UpdateDraws(playerid);
	    return 1;
	}
	else return 0;//Item kann nicht konsumiert werden
}

item::OnPlayerItemToHand(playerid,item)
{//Aktion, benutzung eines items
	new itemid = item_PlayerItem[playerid][item][iID];
	if(itemid <= 0 || itemid >= MAX_ITEMS) return 0;
	if(PlayerCurrentWeaponSlot[playerid] == 0)
	{
	    if(PlayerCache[playerid][holding_item] >= 1) return DisplayInfobox(playerid,"Keine Hand frei","~r~Du musst das Item erst wegstecken, bevor~n~du das neue Item halten kannst.",2),0;
		//Hält das Item jetzt
		if(item::RemovePlayerItems(playerid,itemid,1) == 1) item::SetPlayerHoldingItem(playerid,itemid);
		return 1;
	}
	else DisplayInfobox(playerid,"Keine Hand frei","~r~Du musst die Waffe erst wegstecken, bevor~n~du das Item halten kannst.",2);
	return 0;
}

item::OnPlayerWearItem(playerid,item)
{
	new itemid = item_PlayerItem[playerid][item][iID];
	if(itemid <= 0 || itemid >= MAX_ITEMS)			return 0;
    if(!(item_ItemInfo[itemid][iAction] & canWear))	return 0;
    new wearSlot	= item_ItemInfo[itemid][iWearInfo][1],
        boneID  	= item_ItemInfo[itemid][iWearInfo][0],
        modelID     = item_ItemInfo[itemid][iObjectID];
	if(PlayerEquip[playerid][wearSlot][eItemID] == itemid)
	{
	    equip::RemoveSlot(playerid,wearSlot);
	    format(string,sizeof(string),#FORMAT_CHAT_INFO"Du hast das Kleidungsstück \"%s\" ausgezogen.",item_ItemInfo[itemid][iName]);
	}
	else
	{
	    equip::RemoveSlot(playerid,wearSlot);
		equip::UseEquipment(playerid,modelID,boneID,item_ItemInfo[itemid][iWearAttachInfo][0],item_ItemInfo[itemid][iWearAttachInfo][1],item_ItemInfo[itemid][iWearAttachInfo][2],item_ItemInfo[itemid][iWearAttachInfo][3],item_ItemInfo[itemid][iWearAttachInfo][4],item_ItemInfo[itemid][iWearAttachInfo][5],item_ItemInfo[itemid][iWearAttachInfo][6],item_ItemInfo[itemid][iWearAttachInfo][7],item_ItemInfo[itemid][iWearAttachInfo][8],.oslot=wearSlot,.itemID=itemid);
		switch(wearSlot)
		{
		    case COSMETIC_HAT:      ApplyAnimation(playerid,"CLOTHES","CLO_Pose_Hat",4.0,0,0,0,0,0,0);
			case COSMETIC_MASK:     ApplyAnimation(playerid,"CLOTHES","CLO_Pose_Hat",4.0,0,0,0,0,0,0);
			case COSMETIC_GLASSES:  ApplyAnimation(playerid,"CLOTHES","CLO_Pose_Hat",4.0,0,0,0,0,0,0);
			case COSMETIC_BODY:     ApplyAnimation(playerid,"CLOTHES","CLO_Pose_Torso",4.0,0,0,0,0,0,0);
		}
	}
	SendClientMessage(playerid,-1,string);
	return 1;
}

item::OnPlayerEquipItem(playerid,item)
{
	new itemid = item_PlayerItem[playerid][item][iID];
	if(itemid <= 0 || itemid >= MAX_ITEMS)				return 0;
    if(!(item_ItemInfo[itemid][iProperties] & iEquip))	return 0;
    if(PlayerCache[playerid][equip_fist_item] != 0) PlayerCache[playerid][equip_fist_item] = 0;
    PlayerCache[playerid][equip_fist_item] = itemid;
    equip::RemoveSlot(playerid,EQUIPMENT_SLOT);
    if(PlayerCurrentWeaponSlot[playerid] == 1 || (PlayerCurrentWeaponSlot[playerid] == 0 && PlayerCache[playerid][holding_item] <= 0))
	{//Hat Equipment/Faust angelegt
	    PlayerCurrentWeaponSlot[playerid] = 1;
	    equip::UseEquipment(playerid,item_ItemInfo[itemid][iObjectID],item_ItemInfo[itemid][iHoldBoneID],item_ItemInfo[itemid][iHoldAttachInfo][0],item_ItemInfo[itemid][iHoldAttachInfo][1],item_ItemInfo[itemid][iHoldAttachInfo][2],item_ItemInfo[itemid][iHoldAttachInfo][3],item_ItemInfo[itemid][iHoldAttachInfo][4],item_ItemInfo[itemid][iHoldAttachInfo][5],item_ItemInfo[itemid][iHoldAttachInfo][6],item_ItemInfo[itemid][iHoldAttachInfo][7],item_ItemInfo[itemid][iHoldAttachInfo][8],.oslot=EQUIPMENT_SLOT);
		format(string,sizeof(string),#FORMAT_CHAT_INFO"Du verwendest nun den Ausrüstungsgegenstand \"%s\".",item_ItemInfo[itemid][iName]);
		SendClientMessage(playerid,-1,string);
	    return 1;
	}
	format(string,sizeof(string),#FORMAT_CHAT_INFO"Wechsle mit \"Z\" zum Ausrüstungsgegenstand \"%s\".",item_ItemInfo[itemid][iName]);
	SendClientMessage(playerid,-1,string);
	return 1;
}

OnPlayerMissionCP(playerid)
{
	if(IsPlayerNPC(playerid)) return 1;
	if(PlayerEvent[playerid][TutorialStep][0] != -1)
	{
		switch(PlayerEvent[playerid][TutorialStep][0])
		{
		    case 0:
		    {
		        //Gibt keine Missionsziele
		        return 1;
		    }
		    case 1:
		    {
		        //Gibt keine Missionsziele
		        return 1;
		    }
		    case 2:
		    {
	            //man ist an der funkstation aufm berg angekommen
			    ShowPlayerDialog(playerid,dialog_TUTORIAL_MT_CHOOSE,DIALOG_STYLE_MSGBOX,"Du bist an einer Funkstation...","{C87E35}Unbekannter:\n{F1F7DC}\"HALLO KANN MICH WER HÖREN!? ICH BRAUCHE DRINGEND HILFE! ....\n.... kann mich denn niemand hören? *seuchz*\"","Antworten","");
				return 1;
			}
		    case 3:
		    {
				//Erste Mission, Tutorial ===>> John WAKE TUTORIAL
			    switch(PlayerEvent[playerid][TutorialStep][1])
			    {
			        case 0:
			        {
                        PlayerEvent[playerid][TutorialStep][1] = 2;
						return 1;
			        }
			        case 1:
			        {
                        PlayerEvent[playerid][TutorialStep][1] = 2;
                        return 1;
					}
					case 2:
					{//Man ist beim ersten Checkpoint
					    SetPlayerMissionCP(playerid,-639.2964,2311.1611,133.9540);//Zweiter CP
					    PlayerEvent[playerid][TutorialStep][1] = 3;
					    SetPlayerVirtualWorld(playerid,(2000+playerid));
					    return 0;
					}
					case 3:
					{//Man ist beim zweiten Checkpoint
						PlayerEvent[playerid][TutorialStep][1] = 4;
						SetPlayerMissionCP(playerid,-714.9928,2463.6519,120.7557);//Dritter Checkpoint
						TogglePlayerControllable(playerid,false);
						SetPlayerCameraInfoEx(playerid,Float:{-531.9898,2352.1191,85.5172},Float:{-507.6761,2214.7803,41.4760});//Kamerabewegung
						MovePlayerCamera(playerid,Float:{-588.0537,2205.7617,66.0312},Float:{-507.6761,2214.7803,41.4760},(FAST/3));//Zu John Wakes Haus
						SetPlayerVirtualWorld(playerid,(2000+playerid));
						return 0;
					}
					case 4:
					{//Man ist am dritten Checkpoint
					    SetPlayerMissionCP(playerid,-489.0630,2308.0244,64.2149);//Vierter Checkpoint
					    PlayerEvent[playerid][TutorialStep][1] = 5;
					    SetPlayerVirtualWorld(playerid,(2000+playerid));
					    return 0;
					}
					case 5:
					{//Man ist am vierten Checkpoint
                        PlayerEvent[playerid][TutorialStep][1] = 6;
					    SetPlayerMissionCP(playerid,-512.2507,2220.9221,42.3575);//Vor John Wakes Haus
					    TogglePlayerControllable(playerid,false);
						SetPlayerCameraInfoEx(playerid,Float:{-489.0630,2308.0244,72.2150},Float:{-508.6183,2216.2256,41.5700});
						MovePlayerCamera(playerid,Float:{-500.1764,2246.8037,61.5318},Float:{-508.6183,2216.2256,41.5700},(FAST/3));
						return 0;
					}
					case 6:
					{//Man ist an John Wakes Haus
					    PlayerEvent[playerid][TutorialStep][1] = 7;
					    SetPlayerInterior(playerid,2);
               		    w_SetPlayerPos(playerid,23.275472640991,-2110.0041503906,22.963747024536,268.3835,4);//In John Wakes Haus teleportieren
               		    SetPlayerMissionCP(playerid,37.924995422363,-2109.9604492188,22.963747024536);
               		    return 0;
					}
					case 7:
					{//Geht das erste mal in den Checkpoint, Kamerabewegung zu John Wake
					    new Float:pos[3];
					    GetPlayerPos(playerid,pos[0],pos[1],pos[2]);
					    w_SetPlayerPos(playerid,pos[0],pos[1],pos[2]+10.0);
					    SetPlayerVirtualWorld(playerid,0);
					    SetPlayerInterior(playerid,2);
					    TogglePlayerControllable(playerid,false);
					    SetPlayerCameraInfoEx(playerid,Float:{37.9249,-2109.9604,25.9637},Float:{46.2829,-2109.5588,23.9406});
					    MovePlayerCamera(playerid,Float:{46.2829,-2109.5588,23.9406},Float:{45.6855,-2119.5842,22.9661},(SLOW/3));

					    /*<marker id="Johnwakehouse checkpoint" "37.924995422363,-2109.9604492188,22.963747024536
					    <marker id="Johnwake botpos north" "45.685585021973,-2119.5842285156,22.966136932373
					    <marker id="Johnwake campos2" "46.282917022705,-2109.5588378906,23.940660476685
					    <marker id="Johnwake campos3" 45.717098236084,-2116.42578125,22.966068267822*/
					    return 1;
					}
					case 8:
					{
						PlayerOption[playerid][Skin] = GetPlayerSkin(playerid);
						PlayerEvent[playerid][TutorialStep][0] = 4;
						OnPlayerSpawn(playerid);
						return 0;
					}
			    }
			}
			case 4:
			{
			    switch(PlayerEvent[playerid][TutorialStep][1])
			    {
					case 0:
					{//Man durchsucht den toten einheimischen im questhaus
                        PlayerEvent[playerid][TutorialStep][1] = 10;
                        ApplyAnimation(playerid, "FOOD", "EAT_Vomit_P", 3.0, 0, 0, 0, 0, 0);
                        item::GivePlayerItem(playerid,item::GetItemByName("[Q] Kellerschluessel"),1);
                        ShowPlayerDialog(playerid,dialog_ACTION_VOMIT,DIALOG_STYLE_MSGBOX,"Du durchsuchst die tote Person...","{F1F7DC}Der Lieferant, von dem John Wake gesprochen hat, scheint ermordet worden\nzu sein. Du durchsuchst ihn und findest einen Schluessel...\n\n{878375}Hinweise:\n- Gegenstand erhalten: Kellerschluessel","Ok","");
                        return 1;
					}
					case 1:
					{//Man betritt den Keller des Questhauses
					    DisplayInfobox(playerid,"Item benutzen","Oeffne mit /item den Rucksack und~n~benutze den Schluessel.");
					    return 0;
					}
					case 2:
					{//Man befindet sich an der Tuer
					    PlayerEvent[playerid][TutorialStep][1] = 3;
					    DestroyPickup(GetPVarInt(playerid,"tut_intera_pick"));//Interaktionssymbol am Tor
					    DeletePVar(playerid,"tut_intera_pick");
						DeletePVar(playerid,"tut_intera_set");
					    DisplayInfobox(playerid,"Interaktion mit Objekten","Druecke ENTER oder F um den Schalter zu benutzen");
					    quest::OnQuestUpdate(playerid,0,3);
					    return 0;
					}
					case 6://TUTORIAL ENDE!!!!1!111lef
					{//Man verlaesst den Bunker
					    //mysql_SetIntByInt("pnwl_user_event","tutorial",5,"userid",PlayerInfo[playerid][PLAYER_ID]);
					    mysql_SetIntByInt("pnwl_user_event","tutorial",-1,"userid",PlayerInfo[playerid][PLAYER_ID]);

						SetPlayerInterior(playerid,0);
						SetPlayerVirtualWorld(playerid,0);
						SetPlayerHealth(playerid,100.0);

						PlayerEvent[playerid][TutorialStep][0] = -1;
						PlayerEvent[playerid][TutorialStep][1] = -1;
						w_SetPlayerPos(playerid,-395.48565673828,1251.7880859375,6.8383088111877,_,2);
                        quest::OnQuestFinish(playerid,0);

						new Float:_logpos[3];
					    GetPlayerPos(playerid,_logpos[0],_logpos[1],_logpos[2]);
			            GetPlayerPos(playerid,PlayerInfo[playerid][TotPos][0],PlayerInfo[playerid][TotPos][1],PlayerInfo[playerid][TotPos][2]);

						format(query,sizeof(query),"UPDATE pnwl_user_pos SET totpos1='%f',totpos2='%f',totpos3='%f',totint='%d',totvw='1000' WHERE userid='%d'",PlayerInfo[playerid][TotPos][0],PlayerInfo[playerid][TotPos][1],PlayerInfo[playerid][TotPos][2],GetPlayerInterior(playerid),PlayerInfo[playerid][PLAYER_ID]);
						mysql_query_once(query);
						format(query,sizeof(query),"UPDATE pnwl_user_option SET crashed='0',selectedspawn='0' WHERE userid='%d'",PlayerInfo[playerid][PLAYER_ID]);
						mysql_query_once(query);
						format(query,sizeof(query),"UPDATE pnwl_user_pos SET tot_house='-1',crashedpos1='%f',crashedpos2='%f',crashedpos3='%f',crashint='%d',crashvw='%d',crash_house='-1' WHERE userid='%d'",-1,_logpos[0],_logpos[1],_logpos[2],GetPlayerInterior(playerid),GetPlayerVirtualWorld(playerid),PlayerInfo[playerid][PLAYER_ID]);
						mysql_query_once(query);
						format(query,sizeof(query),"UPDATE pnwl_user_pos SET logpos1='%f',logpos2='%f',logpos3='%f',logint='%d',logvw='%d' WHERE userid='%d'",_logpos[0],_logpos[1],_logpos[2],GetPlayerInterior(playerid),GetPlayerVirtualWorld(playerid),PlayerInfo[playerid][PLAYER_ID]);
						mysql_query_once(query);
					    /*
							userOptionX
							array X
							(
								79 => Spielername 	(text)
								80 => Spielzeit 	(int)
								81 => Fraktion 		(radio)
									0:wcf.pnwl.fractionNone
									1:wcf.pnwl.fractionArmy
									2:wcf.pnwl.fractionZombie
								82 => Geschlecht 	(radio)
									-> 0=undef, 1=male, 2=female
								83 => Gang			(text)
								84 => Premium       (radio)
									0:wcf.pnwl.premiumNone
									1:wcf.pnwl.premiumBronze
									2:wcf.pnwl.premiumSilber
									3:wcf.pnwl.premiumGold
									4:wcf.pnwl.premiumPlatin
							)
					    */
					    new questid = quest::QuestIdByName("Jobsuche");
					    if(questid != -1)
						{
							quest::AddPlayerQuest(playerid,questid);
							PlayerQuestCache[playerid][qAktiv] = questid;
							mysql_SetIntByInt("pnwl_user_event","currentquest",questid,"userid",PlayerInfo[playerid][PLAYER_ID]);
						}
						CORE::AddPlayerCredits(PlayerInfo[playerid][PLAYER_ID],50);
					    
					    item::GivePlayerItem(playerid,item::GetItemByName("[BOX] Starterkit"),1);
					    
						format(string,sizeof(string),"{F1F7DC}\
						Du hast das Tutorial beendet, es befindet sich nun ein Starterkit in\n\
						deinem Inventar. Dies wird dir in deiner Zeit hoffentlich helfen. Um es\n\
						zu öffnen gebe \"/items\" in den Chat ein, wähle \"[BOX] Starterkit\" aus\n");
						strcat(string,"und klicke auf \"Benutzen (Aktion)\". Du solltest außerdem wissen, dass es\n\
						Items mit speziellen Eigenschaften gibt, die du am Präfix erkennen kannst:\n\
						[Q]\t - Questitems\n\
						[BOX]\t - Eine Kiste, die du öffnen kannst");

						ShowPlayerDialog(playerid,dialog_TUT_ENDE_BOX,DIALOG_STYLE_MSGBOX,"{F1F7DC}Tutorial beendet",string,"Weiter","");
					    return 0;
					}
			    }
			}
		}
	}
	
	new questid 	= PlayerQuestCache[playerid][qAktiv],
	    questslot 	= quest::PlayerQuestSlotByQuestID(playerid,questid),
		step        = (questslot==-1)?0:PlayerQuest[playerid][questslot][qStep];
	switch(questid)
	{
	    case 1:
	    {//Jobsuche
	        return 1;
	    }
	    case 2:
	    {//Leichen verbrennen
	        return 1;
	    }
	    case 3:
	    {//Oelproblem
	        switch(step)
	        {
	            case 0..5:
	            {//In der Mitte
	                return 0;
	            }
	            case -1:
				{
				    quest::OnQuestUpdate(playerid,questid,-2);
				    return 1;
				}
	        }
	    }
	    case 4:
	    {//Obdachlos
	        return 1;
	    }
	    case 5:
	    {//Tanklaster
			new veh 			= GetPlayerVehicleID(playerid),
				veh_model       = GetVehicleModel(veh),
			    trailer			= GetVehicleTrailer(veh),
				trailer_model	= GetVehicleModel(trailer);
	    
	        if(step != 0)
	        {
				if(!car::CanPullTrailer(veh_model) || trailer_model != 584)
				{
				    DisplayInfobox(playerid,"~r~Falsches ~w~Fahrzeug","~w~Du musst einen ~g~Tanklaster~w~ fuer diese~n~Quest fahren!",4);
				    return 0;
				}
			}
			
	        switch(step)
	        {
	            case 0:
	            {//An der Truckerbasis
	                quest::OnQuestUpdate(playerid,questid,1);
	                return 0;
	            }
	            case 1:
	            {//Am Öldepot
	                quest::OnQuestUpdate(playerid,questid,random(4)+1);
	                return 0;
	            }
	            case 2..4:
	            {//Abliefern
	                new Float:pos[3];
	                for(new i; i<=__SERVER[HIGHEST_PLAYER_ID]; i++)
	                {
	                    if(!IsPlayerConnected(i) || !IsPlayerInAnyVehicle(i)) continue;
	                    if(GetPlayerVehicleID(i) == veh)
	                    {
			                GetPlayerPos(i,pos[0],pos[1],pos[2]);
			                SetPlayerPos(i,pos[0],pos[1],pos[2]);
	                    }
	                }
	                SetVehicleToRespawn(veh);
	                SetVehicleToRespawn(trailer);
                    quest::OnQuestUpdate(playerid,questid,5);
                    return 1;
	            }
	        }
	    }
	}
	return 0;
}

public cont::OnContainerInit(containerid,contbezeichnung[],sql_id)
{
	format(string,sizeof(string),"%s\n/container",contbezeichnung);
	ContainerInfo[containerid][cont_Label] = Create3DTextLabel(string,GRUEN,ContainerInfo[containerid][cont_pos][0],ContainerInfo[containerid][cont_pos][1],ContainerInfo[containerid][cont_pos][2],15.0,0,0);
	return containerid;
}

public cont::OnContainerExit(containerid,sql_id)
{
	Delete3DTextLabel(ContainerInfo[containerid][cont_Label]);
	return containerid;
}

public veg::OnPlantFarm(playerid,plantid,anzahl)
{
	if(anzahl <= 0) 							return -1;
	if(anzahl > PlantInfo[plantid][pFruits]) 	anzahl = PlantInfo[plantid][pFruits];
	new itemid = item::GetItemByName(GrowInfo[PlantInfo[plantid][pBreed]][ItemName]);
	if(itemid < 0 || itemid >= MAX_ITEMS) 		return -1;
	switch(item::GivePlayerItem(playerid,itemid,anzahl))
	{
	    case 1://erfolg
	    {
	        PlantInfo[plantid][pFruits] -= anzahl;
	        veg::UpdatePlant(plantid);
	        
			format(string,sizeof(string),"{F1F7DC}Du hast die Pflanze \"%s\" geerntet. %d Früchte übrig.",GrowInfo[PlantInfo[plantid][pBreed]][PlantName],PlantInfo[plantid][pFruits]);
			veg::ShowPlayerDialog(playerid,veg_DIALOG_PLANT_MAINRE,DIALOG_STYLE_MSGBOX,"{F1F7DC}Früchte ernten",string,"Zurück","");
	    }
	    case -1://Falsche Itemid
	    {
	        format(string,sizeof(string),"ERROR: veg::OnPlantFarm params[] = {%d,%d,%d}",playerid,plantid,anzahl);
	        SendClientMessage(playerid,ROT,string);
	    }
	    case -2://offline
	    {
	        format(string,sizeof(string),"ERROR: veg::OnPlantFarm params[] = {%d,%d,%d}",playerid,plantid,anzahl);
	        SendClientMessage(playerid,ROT,string);
	    }
	    case -3://zu wenig platz
	    {
	        format(string,sizeof(string),#FORMAT_CHAT_INFO"Du hast zu wenig Platz um %d \"%s\" mitzunehmen.",anzahl,GrowInfo[PlantInfo[plantid][pBreed]][ItemName]);
			veg::ShowPlayerDialog(playerid,veg_DIALOG_PLANT_MAINRE,DIALOG_STYLE_MSGBOX,"Früchte ernten",string,"Zurück","");
	    }
	    case -4://zu wenig items
	    {
	        format(string,sizeof(string),"ERROR: veg::OnPlantFarm params[] = {%d,%d,%d}",playerid,plantid,anzahl);
	        SendClientMessage(playerid,ROT,string);
	    }
	}
	return 1;
}

item::OnPlayerThrowAway(playerid,item,item_anzahl)
{
    if(IsPlayerNPC(playerid)) return 1;
    new itemid = item_PlayerItem[playerid][item][iID];
	if(item_anzahl <= 0 || itemid <= 0 || itemid >= MAX_ITEMS) return 0;
	if(item::RemovePlayerItems(playerid,itemid,item_anzahl) >= 1)
	{
		for(new i=MAX_IMAN_SPAWNS; i<MAX_SPAWNS; i++)
		{
		    if(!iman_Pickup[i][iman_Created]) continue;
		    if(iman_Pickup[i][iman_Item] == itemid)
		    {
		    	if(IsPlayerInRangeOfPoint(playerid,(AVERAGE_TAKE_DEST*2),iman_Pickup[i][iman_Pos][0],iman_Pickup[i][iman_Pos][1],iman_Pickup[i][iman_Pos][2]))
		    	{
		            iman_Pickup[i][iman_Anzahl] += item_anzahl;
		            iman::UpdateSpawn(i,SPAWN_DELETE_TIME);
		            return 1;
		        }
		    }
		}
		new Float:__posX,Float:__posY,Float:__posZ;
		GetPlayerPos(playerid,__posX,__posY,__posZ);
		iman::CreateSpawn(itemid,item_anzahl,SPAWN_TYPE_THROW_AWAY,__posX,__posY,__posZ,SPAWN_DELETE_TIME);
	    return 1;
	}
	return 0;
}

forward BalloonCheckpoint(playerid,checkpoint,from,target);
public BalloonCheckpoint(playerid,checkpoint,from,target)
{
	new fly_time = 1,
		Float:bpos[3];
	GetObjectPos(BalloonInfo[bBalloon],bpos[0],bpos[1],bpos[2]);
	BalloonInfo[bTarget] = target;

	switch(checkpoint)
	{
	    case 0:
	    {//Start
			new Float:fly_height = 1.0;
			if(land_point[target][0][2] > land_point[from][0][2]) fly_height = (land_point[target][0][2]+FLY_Z_OFFSET);
			else fly_height = (land_point[from][0][2]+FLY_Z_OFFSET);
			fly_time = flytime((fly_height-bpos[2]),UP_SPEED);
			if(playerid != -1 && IsPlayerConnected(playerid)) w_SetPlayerPos(playerid,bpos[0],bpos[1],bpos[2]+1.1);
			SetObjectPos(BalloonInfo[bBalloon],bpos[0],bpos[1],bpos[2]-0.3);
			MoveObject(BalloonInfo[bBalloon],bpos[0],bpos[1],fly_height,UP_SPEED);
		}
		case 1:
		{//Flug
		    fly_time = flytime(GetDistanceBetweenPoints(bpos[0],bpos[1],bpos[2],land_point[target][0][0],land_point[target][0][1],bpos[2]),FLY_SPEED);
		    MoveObject(BalloonInfo[bBalloon],land_point[target][0][0],land_point[target][0][1],bpos[2],FLY_SPEED);
		}
		case 2:
		{//Landung
		    fly_time = flytime(GetDistanceBetweenPoints(bpos[0],bpos[1],bpos[2],land_point[target][0][0],land_point[target][0][1],land_point[target][0][2]),DOWN_SPEED);
		    MoveObject(BalloonInfo[bBalloon],land_point[target][0][0],land_point[target][0][1],land_point[target][0][2],DOWN_SPEED);
		}
		case 3:
		{//Reise ende
	        format(string,sizeof(string),#FORMAT_CHAT_INFO"Der Balloon ist in \"%s\" gelandet.",LandingNames[target]);
	        for(new i; i<=__SERVER[HIGHEST_PLAYER_ID]; i++)
			{
				if(GetPVarInt(i,"balloon_ordered") == 1)
				{
					SendClientMessage(i,GRUEN,string);
					SetPVarInt(i,"balloon_ordered",0);
				}
			}
		    BalloonInfo[bMoving] = false;
		    return 1;
		}
	}
	SetTimerEx("BalloonCheckpoint",fly_time,false,"dddd",playerid,checkpoint+1,from,target);
	return 1;
}

forward OnPlayerHealPlayer(playerid,healid,step);
public OnPlayerHealPlayer(playerid,healid,step)
{
	if(PlayerEvent[playerid][MedicalEvent][0] == 1)
	{
	    TextDrawHideForPlayer(playerid,HealingDraw);
	    TextDrawHideForPlayer(playerid,PBarRAussen[2]);
	    TextDrawHideForPlayer(playerid,PBarRInnen[2]);
	    PlayerTextDrawHide(playerid,PBarText[playerid][2]);
		PlayerTextDrawDestroy(playerid,PBarText[playerid][2]);
	    PlayerTextDrawHide(playerid,PBarStatus[playerid][0]);
		PlayerTextDrawDestroy(playerid,PBarStatus[playerid][0]);
	}

	if(PlayerEvent[playerid][IstTot] != 0 || PlayerEvent[playerid][MedicalEvent][0] != 0 || PlayerEvent[playerid][TutorialStep][0] != 0 || !IsPlayerConnected(healid) || IsPlayerNPC(healid) || PlayerEvent[healid][IstTot] != 0 || GetPVarInt(playerid,"in_shop") == 1 || GetPlayerVirtualWorld(playerid) != GetPlayerVirtualWorld(healid)) step = 0;
	else
	{
		new Float:hpos[3];
		GetPlayerPos(healid,hpos[0],hpos[1],hpos[2]);
		if(!IsPlayerInRangeOfPoint(playerid,HEAL_RANGE,hpos[0],hpos[1],hpos[2])) step = 0;
		else
		{
			new Float:healer_health;
			GetPlayerHealth(playerid,healer_health);
			if(healer_health < 60.0)
			{
				SendClientMessage(playerid,ROT,"ERROR: Heilung abgebrochen, du brauchst mehr als 60 HP um andere Spieler zu heilen!");
				step = 0;
			}
		}
	}
	
	if(step == 0)
	{
	    if(PlayerEvent[playerid][MedicalEvent][2] != -1) KillTimer(PlayerEvent[playerid][MedicalEvent][2]);
	    PlayerEvent[playerid][MedicalEvent][0] =  0;
	    PlayerEvent[playerid][MedicalEvent][1] =  0;
	    PlayerEvent[playerid][MedicalEvent][2] = -1;
		return 1;//Close
	}

	fixed_TextDrawShowForPlayer(playerid,PBarRAussen[2]);
	fixed_TextDrawShowForPlayer(playerid,PBarRInnen[2]);
	fixed_TextDrawShowForPlayer(playerid,HealingDraw);

	new Float:health_percentage = 0.0;
	GetPlayerHealth(healid,health_percentage);
	if(health_percentage > 100.0) health_percentage = 100.0;
	else
	{
	    new Float:med_skill = skill::GetPlayerSkill(playerid,SkillMedizin);
	    health_percentage += BASIC_HEAL+(med_skill*0.2);
	    if(health_percentage > 100.0)
		{
			health_percentage = 100.0;
			format(string,sizeof(string),#FORMAT_CHAT_INFO"Du hast %s (ID %d) vollständig geheilt",GetName(healid),healid);
			SendClientMessage(playerid,GRUEN,string);
			format(string,sizeof(string),#FORMAT_CHAT_INFO"Du wurdest von %s (ID %d) vollständig geheilt",GetName(playerid),playerid);
			SendClientMessage(healid,GRUEN,string);
		}
		SetPlayerHealth(healid,health_percentage);
		
		GetPlayerHealth(playerid,health_percentage);
		health_percentage -= ((BASIC_HEAL+(med_skill*0.2))*(2/3));
		SetPlayerHealth(playerid,health_percentage);
	}
	
	if((178.0+(health_percentage*2.92)) < 470.0) PBarStatus[playerid][0] = CreatePlayerTextDraw(playerid,/*178 = 0%, 470 = 100%*/(178.0+(health_percentage*2.92)), 305.000000, "_");
	else PBarStatus[playerid][0] = CreatePlayerTextDraw(playerid,/*178 = 0%, 470 = 100%*/(178.0+(health_percentage*2.92)), 305.000000, "_");
	PlayerTextDrawBackgroundColor(playerid,PBarStatus[playerid][0], 0xFF100CFF);
	PlayerTextDrawFont(playerid,PBarStatus[playerid][0], 1);
	PlayerTextDrawLetterSize(playerid,PBarStatus[playerid][0], 0.500000, 1.299999);
	PlayerTextDrawColor(playerid,PBarStatus[playerid][0], -1);
	PlayerTextDrawSetOutline(playerid,PBarStatus[playerid][0], 0);
	PlayerTextDrawSetProportional(playerid,PBarStatus[playerid][0], 1);
	PlayerTextDrawSetShadow(playerid,PBarStatus[playerid][0], 1);
	PlayerTextDrawUseBox(playerid,PBarStatus[playerid][0], 1);
	PlayerTextDrawBoxColor(playerid,PBarStatus[playerid][0], 0xFF100CFF);
	PlayerTextDrawTextSize(playerid,PBarStatus[playerid][0], 174.000000, 255.000000);
	fixed_PlayerTextDrawShow(playerid,PBarStatus[playerid][0]);

	format(string,sizeof(string),"Du heilst %s... %0.1f%%",GetName(healid),health_percentage);
	PBarText[playerid][2] = CreatePlayerTextDraw(playerid,317.000000, 299.000000, string);
	PlayerTextDrawBackgroundColor(playerid,PBarText[playerid][2], 0x352700FF);
	PlayerTextDrawFont(playerid,PBarText[playerid][2], 2);
	PlayerTextDrawLetterSize(playerid,PBarText[playerid][2], 0.430000, 2.200000);
	PlayerTextDrawColor(playerid,PBarText[playerid][2], 0x352700FF);
	PlayerTextDrawSetOutline(playerid,PBarText[playerid][2], 0);
	PlayerTextDrawSetProportional(playerid,PBarText[playerid][2], 1);
	PlayerTextDrawSetShadow(playerid,PBarText[playerid][2], 1);
	PlayerTextDrawAlignment(playerid,PBarText[playerid][2],2);
	fixed_PlayerTextDrawShow(playerid,PBarText[playerid][2]);

	PlayerEvent[playerid][MedicalEvent][0] = 1;
	PlayerEvent[playerid][MedicalEvent][1] = healid;
	if(health_percentage < 99.0) 	PlayerEvent[playerid][MedicalEvent][2] = SetTimerEx("OnPlayerHealPlayer",1000,false,"ddd",playerid,healid,1);
	else 							PlayerEvent[playerid][MedicalEvent][2] = SetTimerEx("OnPlayerHealPlayer",2000,false,"ddd",playerid,healid,0);
	return 1;
}

forward OnPlayerRevive(tid,playerid);
public OnPlayerRevive(tid,playerid)
{
	if(!IsPlayerConnected(playerid)) return 1;
	if(tid < 0 || tid >= MAX_PLAYERS || !IsPlayerConnected(tid) || IsPlayerNPC(tid)) return 1;
	if(PlayerEvent[tid][IstTot] >= 1)
	{
		if(GetPVarInt(tid,"revivable") == 1 && IsPlayerInRangeOfPoint(playerid,3.0,PlayerInfo[tid][RevivePos][0],PlayerInfo[tid][RevivePos][1],PlayerInfo[tid][RevivePos][2]))
		{
			DestroyPickup(PlayerInfo[tid][pTotPickup]);
			Delete3DTextLabel(PlayerInfo[tid][TotTag]);
			PlayerEvent[tid][IstTot] = 0;
			SetPVarInt(tid,"revivable",0);

			mysql_SetIntByInt("pnwl_user_event","isttot",0,"userid",PlayerInfo[tid][PLAYER_ID]);
			if(PlayerInfo[playerid][ReviveHouse] != -1)
			{
				for(new h_id; h_id<MAX_HOUSES; h_id++)
				{
					if(HouseInfo[h_id][hAktiv] != 1) break;
					if(HouseInfo[h_id][hID] == PlayerInfo[playerid][ReviveHouse])
					{
						PlayerEvent[playerid][InteractHouse] = h_id;
						break;
					}
				}
				OnEnterHouse(playerid,PlayerEvent[playerid][InteractHouse],false);
			}
			else
			{
				w_SetPlayerPos(playerid,PlayerInfo[tid][RevivePos][0],PlayerInfo[tid][RevivePos][1],PlayerInfo[tid][RevivePos][2]);
				SetPlayerVirtualWorld(playerid,PlayerInfo[playerid][ReviveVW]);
				SetPlayerInterior(playerid,PlayerInfo[playerid][ReviveINT]);
			}
			fixed_TextDrawShowForPlayer(playerid,RealClock);
			SetPlayerWeather(tid,__SERVER[GLOBAL_WEATHER]);
			SetPlayerTime(tid,__SERVER[GLOBAL_TIME][0],__SERVER[GLOBAL_TIME][1]);
			status::ShowDraws(tid);

			new am_id = __amCache[amAuferstanden];
			if(am_id != -1) am_SetPlayerAchievementData(tid,am_id,1);

			format(string,sizeof(string),#FORMAT_CHAT_INFO"Du hast %s (ID %d) wiederbelebt.",GetName(tid),tid);
			SendClientMessage(playerid,GRUEN,string);
			format(string,sizeof(string),#FORMAT_CHAT_INFO"Du wurdest von %s (ID %d) wiederbelebt.",GetName(playerid),playerid);
			SendClientMessage(tid,GRUEN,string);
			return 1;
		}
	}
	SendClientMessage(tid,ROT,"ERROR: Aktion konnte nicht durchgeführt werden.");
	SetPVarInt(playerid,"next_medical_tr",0);
	return 1;
}

item::OnPlayerTradeItem(playerid,give_id,item,anzahl)
{//Item wurde schon entfernt
	new itemid = item_PlayerItem[playerid][item][iID];
	new am_id = __amCache[amHaendler];
	
	if(IsPlayerFCNPC(playerid)) return 1;//Fehler!
	
	if(am_id != -1) achievement::SetPlayerAchievementData(playerid,am_id,anzahl,true);
	
	if(IsPlayerNPC(give_id))
	{
		format(string,sizeof(string),#FORMAT_CHAT_INFO"Du hast %s%s (%d) das Item \"%s\" %d mal gegeben",IsPlayerNPC(give_id)?("[NPC]"):(" "),GetName(give_id),item_ItemInfo[item][iName],anzahl);
		SendClientMessage(playerid,GRUEN,string);
		new npc_id = npc_IdByName(GetName(give_id));
		if(GetPVarInt(playerid,"waffenladen") == 1)
		{
		    PlayerNPC[playerid][npc_list:npc_id][cash] += (anzahl*item_ItemInfo[itemid][iWert]);
			UpdatePlayerShopScreen(playerid,SHOPSCREEN_WAFFEN);
			return 1;
		}
		else if(GetPVarInt(playerid,"pizzaladen") == 1)
		{
		    PlayerNPC[playerid][npc_list:npc_id][cash] += (anzahl*item_ItemInfo[itemid][iWert]);
			UpdatePlayerShopScreen(playerid,SHOPSCREEN_PIZZA);
			return 1;
		}
		else if(GetPVarInt(playerid,"EX_autohaus_in") == 1)
		{
		}
		//Questschnittstelle
		anzahl -= quest::OnPlayerTradeItem(playerid,give_id,item,anzahl);
		if(anzahl > 0) PlayerNPC[playerid][npc_list:npc_id][cash] += (anzahl*item_ItemInfo[itemid][iWert]);
	}
	else
	{
		format(string,sizeof(string),#FORMAT_CHAT_INFO"Du hast %s %s (%d) das Item \"%s\" %d mal gegeben",PlayerInfo[give_id][Vorname],PlayerInfo[give_id][Nachname],item_ItemInfo[item][iName],anzahl);
		SendClientMessage(playerid,GRUEN,string);
		format(string,sizeof(string),#FORMAT_CHAT_INFO"%s %s (%d) hat dir das Item \"%s\" %d mal gegeben",PlayerInfo[playerid][Vorname],PlayerInfo[playerid][Nachname],playerid,item_ItemInfo[item][iName],anzahl);
		SendClientMessage(give_id,GRUEN,string);
	}
	return 1;
}

public OnPlayerSelectObject(playerid, type, objectid, modelid, Float:fX, Float:fY, Float:fZ)
{
	return 1;
}

#include "misc/some_functions.inc"
public OnPlayerClickTextDraw(playerid,Text:clickedid)
{
   	if(GetPVarInt(playerid,"tailor_mui_active") == 1)
   	{//Bekleidungsladen
		if(clickedid == Text:INVALID_TEXT_DRAW)
		{//Escape
	        mui_DestroySelectionMenu(playerid);
	        PlayerPlaySound(playerid,1085,0.0,0.0,0.0);
	        return 1;
		}
		new curpage = GetPVarInt(playerid,"tailor_mui_page");
		if(clickedid == mui_NextButtonTextDrawId)
		{//Weiter
		    if(curpage < tailor_GetNumberOfPages())
			{
		        SetPVarInt(playerid,"tailor_mui_page",curpage+1);
		        tailor_ShowPlayerSkinPreviews(playerid);
	         	tailor_UpdatePageTextDraw(playerid);
	         	PlayerPlaySound(playerid,1083,0.0,0.0,0.0);
			}
			else PlayerPlaySound(playerid,1085,0.0,0.0,0.0);
			return 1;
		}
		else if(clickedid == mui_PrevButtonTextDrawId)
		{//Zurück
		    if(curpage > 0)
			{
		    	SetPVarInt(playerid,"tailor_mui_page",curpage-1);
		    	tailor_ShowPlayerSkinPreviews(playerid);
		    	tailor_UpdatePageTextDraw(playerid);
		    	PlayerPlaySound(playerid,1084,0.0,0.0,0.0);
			}
			else PlayerPlaySound(playerid,1085,0.0,0.0,0.0);
			return 1;
		}
	}
	else if(GetPVarInt(playerid,"items_mui_active") == 1)
	{
		if(clickedid == Text:INVALID_TEXT_DRAW)
		{//Escape
	        mui_DestroySelectionMenu(playerid);
	        PlayerPlaySound(playerid,1085,0.0,0.0,0.0);
			if(GetPVarInt(playerid,"waffenladen") == 1) ShowPlayerDialog(playerid,dialog_NPC_WAFFENDEALER_KAUF,DIALOG_STYLE_LIST,"{F1F7DC}Gespräch mit {C87E35}Dimitry","{F1F7DC}Waffen ansehen\nAuf Wiedersehen","Ok","");
			else
			{
				SetPVarInt(playerid,"npc_gespraech",0);
				SetPVarInt(playerid,"talk_to_npc",0);
			}
	        return 1;
		}
		new curpage = GetPVarInt(playerid,"items_mui_page");
		if(clickedid == mui_NextButtonTextDrawId)
		{//Weiter
		    if(curpage < items_GetNumberOfPages(playerid))
			{
		        SetPVarInt(playerid,"items_mui_page",curpage+1);
		        items_ShowPlayerItemPreviews(playerid);
	         	items_UpdatePageTextDraw(playerid);
	         	PlayerPlaySound(playerid,1083,0.0,0.0,0.0);
			}
			else PlayerPlaySound(playerid,1085,0.0,0.0,0.0);
			return 1;
		}
		else if(clickedid == mui_PrevButtonTextDrawId)
		{//Zurück
		    if(curpage > 0)
			{
		    	SetPVarInt(playerid,"items_mui_page",curpage-1);
		    	items_ShowPlayerItemPreviews(playerid);
		    	items_UpdatePageTextDraw(playerid);
		    	PlayerPlaySound(playerid,1084,0.0,0.0,0.0);
			}
			else PlayerPlaySound(playerid,1085,0.0,0.0,0.0);
			return 1;
		}
	}
	return 0;
}

public OnPlayerClickPlayerTextDraw(playerid,PlayerText:playertextid)
{
	if(GetPVarInt(playerid,"tailor_mui_active") == 1)
	{//Bekleidungsladen
		//Weiter und Zurück unter OnPlayerClickTextDraw
		for(new x; x<SELECTION_ITEMS; x++)
		{
		    if(playertextid == mui_SelectionItems[playerid][x])
			{//Hat ein Item ausgesucht
		        PlayerPlaySound(playerid,1083,0.0,0.0,0.0);
		        mui_DestroySelectionMenu(playerid);
		        CancelSelectTextDraw(playerid);
		        if(x >= 0 && x < SELECTION_ITEMS)
		        {
		            new offset = mui_SelectionItemsTag[playerid][x];
		            if(0 >= offset < sizeof(tailor_SkinList))
		            {
			        	format(string,sizeof(string),"SkinID %d Preis %d",tailor_SkinList[x][0],tailor_SkinList[x][1]);
			        	SendClientMessage(playerid,GRUEN,string);
			        	SetPlayerSkin(playerid,tailor_SkinList[x][0]);
			        }
		        }
	        	return 1;
			}
		}
		OnPlayerClickTextDraw(playerid,Text:INVALID_TEXT_DRAW);
		return 1;
	}
	else if(GetPVarInt(playerid,"items_mui_active") == 1)
	{
		for(new x; x<SELECTION_ITEMS; x++)
		{
		    if(playertextid == mui_SelectionItems[playerid][x])
			{//Hat ein Item ausgesucht
		        PlayerPlaySound(playerid,1083,0.0,0.0,0.0);
		        mui_DestroySelectionMenu(playerid);
		        CancelSelectTextDraw(playerid);
				if(0 <= x < SELECTION_ITEMS)
				{
				    new slotid = mui_SelectionItemsTag[playerid][x];
				    if(0 <= slotid < MAX_PLAYER_ITEMS)
				    {
						item_ItemCache[playerid][iSelected] = slotid;
						item::SHOW_ITEM_ACTION_LIST(playerid);
					}
		        }
	        	return 1;
			}
		}
		OnPlayerClickTextDraw(playerid,Text:INVALID_TEXT_DRAW);
		return 1;
	}
	return 0;
}

#include "misc/pnwl_gm_commands"
public OnPlayerCommandText(playerid, cmdtext[])
{
	if(IsPlayerNPC(playerid)) return 1;
	format(string,sizeof(string),#FORMAT_CHAT_ERROR"Der Command \"%s\" existiert nicht.",cmdtext);
	SendClientMessage(playerid,ROT,string);
	return 0;
}

main()
{
    printf("\n\n");
	printf("\t- PostNuke Wasteland Version %s",PNWL_VERSION);
	printf("\t- Tested with SA:MP Version %s",SAMP_VERSION);
	printf("\t- Latest update: %s by NeoPhoenix",LATEST_UPDATE);
	printf("\t- Weburl postnukewasteland.de\n\n");
	checkOnlineRecord("Unbekannt");
	npc::Connect(0,4,1);//connect npcs
}

#if defined use_med
	#include "misc/mapeditor"
#endif
#include "libraries/lib_EX_item_use"
#include "libraries/lib_EX_item_interact"
#include "misc/pwnl_asserts"
#include "libraries/lib_pevent"
#include "libraries/lib_sevent"
#include "libraries/lib_Extended_Script"
