#include "n_lib/ncom_mod"

ncom:pflanze(playerid,shortcut)
{
	new plant = veg_GetNearestPlant(playerid);
	if(plant == -1)
	{
		if(!shortcut) SendClientMessage(playerid,ROT,"INFO: Du bist nicht in der Nähe einer Pflanze");
		return 1;
	}
	
	SetPVarInt(playerid,"plant_interact",plant);
	new p_id = PlantInfo[plant][pBreed],
		dlop = 0;	
	format(query,sizeof(query),"{F1F7DC}Pflanze \"%s\" Stufe %d",GrowInfo[p_id][PlantName],PlantInfo[plant][pStep]);
	
	PlayerOption[playerid][dialog][dlop] = 0;
	format(string,sizeof(string),"Informationen");
	dlop++;
	
	PlayerOption[playerid][dialog][dlop] = 1;
	format(string,sizeof(string),"%s\nPflanze gießen (Du hast %s Wasser)",string,PlayerResource[playerid][Wasser]>=1?("genug"):("kein"));
	dlop++;	

	if(PlantInfo[plant][pFruits] >= 1)
	{
		PlayerOption[playerid][dialog][dlop] = 2;
		format(string,sizeof(string),"%s\nFrüchte ernten (%d/%d) %s",string,PlantInfo[plant][pFruits],GrowInfo[p_id][MaxFruits],("(Kein Messer vorhanden)"));
		dlop++;
	}
	
	veg_ShowPlayerDialog(playerid,veg_DIALOG_PLANT_MAIN,DIALOG_STYLE_LIST,"{F1F7DC}Pflanze - Menü",string,"Weiter","Verlassen");
	return 2;
}
ncom:plant(playerid) return ncom_pflanze(playerid,0);

ncom:container(playerid,shortcut)
{
	new container = cont_GetPlayerNextContainer(playerid);
	if(container != -1)
	{
		cont_ShowPlayerMenu(playerid,container);
		return 2;
	}
	else if(!shortcut) SendClientMessage(playerid,GRUEN,"INFO: Du bist nicht in der Nähe eines Containers");
	return 1;
}
ncom:cont(playerid) return ncom_container(playerid,0);

ncom:ko(playerid) return status::SetPlayerKnockoutTime(playerid,20);
ncom:bl(playerid) return status::SetPlayerBleedingLevel(playerid,0.01);
ncom:gimme(playerid)
{
	PlayerResource[playerid][Batterien] = 100.0;
	item::GivePlayerItem(playerid,item::GetItemByName("[E] Tazer"),1);
	item::GivePlayerItem(playerid,item::GetItemByName("[K] CBIRF Helm"),1);
	item::GivePlayerItem(playerid,item::GetItemByName("Bandage"),5);
	PlayerWeapon[playerid][2][wWeaponID]= 22;
	PlayerWeapon[playerid][2][wMagAmmo]	= 12;
	return 1;
}

ncom:nehmen(playerid,shortcut)
{
	if(GetPVarInt(playerid,"pevent_ImanTake") == 1) return 1;
	new iman_id = iman_GetNearestSpawn(playerid);
	if(iman_id == -1)
	{
		if(!shortcut) SendClientMessage(playerid,GRUEN,"INFO: Du kannst nichts nehmen");
		return 1;
	}
	
	if(iman_Pickup[iman_id][iman_Anzahl] > 1)
	{
		ApplyAnimation(playerid, "BOMBER", "BOM_Plant", 4.0, 1, 0, 0, 0, 0, 1);
		SetPVarInt(playerid,"pevent_ImanTake",1);
		SetTimerEx("pevent_ImanTake",2000,0,"dd",playerid,iman_id);
	}
	else
	{
		new Float:p[3],itemid = iman_Pickup[iman_id][iman_Item];
		GetPlayerPos(playerid,p[0],p[1],p[2]);
		if((p[2]-iman_Pickup[iman_id][iman_Pos][2]) < 0.3)
		{
			if(item_ItemInfo[itemid][iSize] == iSize_carry) ApplyAnimation(playerid, "CARRY", "liftup105", 5.0, 0, 0, 0, 0, 400);
			else ApplyAnimation(playerid, "CASINO", "SLOT_PLYR", 4.0, 0, 0, 0, 0, 0);
			printf("call pickupitem 1");
			SetPVarInt(playerid,"pevent_ImanTake",1);
			SetTimerEx("pevent_PickupItem",500,false,"ddd",playerid,iman_id,1);
		}
		else
		{
			if(item_ItemInfo[itemid][iSize] == iSize_carry) ApplyAnimation(playerid, "CARRY", "liftup", 5.0, 0, 0, 0, 0, 400);
			else ApplyAnimation(playerid,"BOMBER","BOM_PLANT_IN",5.0,0,0,0,0,450);
			printf("call pickupitem 2");
			SetPVarInt(playerid,"pevent_ImanTake",1);
			SetTimerEx("pevent_PickupItem",500,false,"ddd",playerid,iman_id,0);
		}
	}
	return 2;
}
ncom:take(playerid) return ncom_nehmen(playerid,0);

ncom:auto(playerid)
{
	if(PlayerEvent[playerid][IstTot] == 0)
	{
		if(IsPlayerInAnyVehicle(playerid))
		{//Ist im Auto
			new veh = GetPlayerVehicleID(playerid);
			if(GetPlayerVehicleSeat(playerid) == 0) car::ShowPlayerCarMainDialog(playerid,veh,true);
			else
			{
				SetPVarInt(playerid,"interact_veh",veh);
				car::ShowPlayerCarMainDialog(playerid,veh,false);
			}
			return 1;
		}
		else
		{
			new Float:v_pos[3],near_veh=false;
			for(new veh; veh<=__SERVER[MAX_VEHICLE_ID]; veh++)
			{
				if(!IsVehicleConnected(veh)) 				continue;
				if(!car::IsVehicle(GetVehicleModel(veh))) 	continue;
				GetVehiclePos(veh,v_pos[0],v_pos[1],v_pos[2]);
				if(IsPlayerInRangeOfPoint(playerid,5.0,v_pos[0],v_pos[1],v_pos[2]))
				{//Ist an dem Auto 'veh'
					near_veh = true;
					SetPVarInt(playerid,"interact_veh",veh);
					car::ShowPlayerCarMainDialog(playerid,veh,false);
					break;
				}
			}
			if(!near_veh)
			{
				//ShowPlayerDialog(playerid,dialog_NULL,DIALOG_STYLE_MSGBOX,"{F1F7DC}Auto","{C85135}Fehler: Du befindest dich an keinem Fahrzeug.","Ok","");
			}
			return 1;
		}
	}
	return 1;
}
ncom:car(playerid) return ncom_auto(playerid);

ncom:revive(playerid,params[])
{
	if(!(PlayerEvent[playerid][Training] & CanRevive)) return SendClientMessage(playerid,ROT,"ERROR: Das kannst du noch nicht!");
	if(PlayerEvent[playerid][IstTot] != 0) return SendClientMessage(playerid,ROT,"ERROR: Du bist selber tot!");
	if(GetPVarInt(playerid,"next_medical_tr") > 0)
	{
		format(string,sizeof(string),"ERROR: Du kannst die nächste medizinische Aktion erst in %d Sekunden ausführen!",GetPVarInt(playerid,"next_medical_tr"));
		return SendClientMessage(playerid,ROT,string);
	}	
	new tid = strval(params);
	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]))
		{
			SetPVarInt(playerid,"medical_tr_tid",tid);
			new next_medial_tr = floatround(floatrandom(200.0-PlayerSkill[playerid][SkillGlueck]*2)+400.0);
			SetPVarInt(playerid,"next_medical_tr",next_medial_tr);
			format(string,sizeof(string),"INFO: Medizinische Aktion gestartet. Nächste bereit in %d Sekunden!",next_medial_tr);
			SendClientMessage(playerid,GRUEN,string);
			
			SetPVarInt(playerid,"medical_tr_mp_question",random(6));
			format(string,sizeof(string),"{F1F7DC}");
			switch(GetPVarInt(playerid,"medical_tr_mp_question"))
			{
				case 0: format(string,sizeof(string),"{F1F7DC}");
				case 1: format(string,sizeof(string),"{F1F7DC}");
				case 2: format(string,sizeof(string),"{F1F7DC}");
				case 3: format(string,sizeof(string),"{F1F7DC}");
				case 4: format(string,sizeof(string),"{F1F7DC}");
			}
			ShowPlayerDialog(playerid,dialog_REVIVE_QUESTION,DIALOG_STYLE_LIST,"{F1F7DC}Spieler reanimieren",string,"Ausführen","Beenden");
			return 1;
		}
	}
	SendClientMessage(playerid,ROT,"ERROR: Das geht so nicht!");
    return 1;
}

ncom:admins(playerid)
{
	format(string,sizeof(string),"{F1F7DC}Admins online:");
	mysql_query("SELECT * FROM pnwl_permissions WHERE category='admins'");
	mysql_store_result();
	new max_admins = mysql_num_rows();
	mysql_free_result();
	
	new admins_online = 0;
	for(new pid; pid<=__SERVER[HIGHEST_PLAYER_ID]; pid++)
	{
	    if(PlayerInfo[pid][Admin][0] >= 1)
	    {
	        format(string,sizeof(string),"%s\n%s - Berechtigungsschlüssel %b",string,GetName(pid),PlayerInfo[pid][Admin][0]);
	        admins_online++;
	    }
	}

	if(admins_online) format(string,sizeof(string),"%s\n\nZur Zeit sind %d von %d Admins/Moderatoren online.",string,admins_online,max_admins);
	ShowPlayerDialog(playerid,dialog_NULL,DIALOG_STYLE_MSGBOX,"{F1F7DC}Admins online",string,"Ok","");
	return 1;
}

ncom:gang(playerid)
{
	if(PlayerInfo[playerid][pGang] == -1) return SendClientMessage(playerid,GRUEN,"INFO: Du bist in keiner Gang");
	new gid = PlayerInfo[playerid][pGang];
	
	new dia_pos=0;
	format(string,sizeof(string),"");

    format(string,sizeof(string),"{F1F7DC}Ganginformationen");
    PlayerOption[playerid][dialog][dia_pos] = 0;
	dia_pos++;
	
	if(PlayerInfo[playerid][pGangRang] == -1 || perm_HasPlayerGangPermission(playerid,'r'))
	{
	    format(string,sizeof(string),"%s\nRänge von Spielern innerhalb der Gang ändern",string);
	    PlayerOption[playerid][dialog][dia_pos] = 1;
		dia_pos++;
	}
	if(PlayerInfo[playerid][pGangRang] == -1 || perm_HasPlayerGangPermission(playerid,'i'))
	{
	    format(string,sizeof(string),"%s\nNeue Spieler einladen",string);
	    PlayerOption[playerid][dialog][dia_pos] = 2;
		dia_pos++;
	}
	if(PlayerInfo[playerid][pGangRang] == -1 || perm_HasPlayerGangPermission(playerid,'k'))
	{
	    format(string,sizeof(string),"%s\nSpieler aus der Gang werfen",string);
	    PlayerOption[playerid][dialog][dia_pos] = 3;
		dia_pos++;
	}
	if(PlayerInfo[playerid][pGangRang] == -1)
	{
	    format(string,sizeof(string),"%s\nSpielerberechtigungen ändern",string);
	    PlayerOption[playerid][dialog][dia_pos] = 4;
		dia_pos++;
	}	

    format(string,sizeof(string),"%s\nOnline Member anzeigen",string);
    PlayerOption[playerid][dialog][dia_pos] = 5;
	dia_pos++;

    format(string,sizeof(string),"%s\nGangchat konfigurieren",string);
    PlayerOption[playerid][dialog][dia_pos] = 6;
	dia_pos++;

    if(PlayerInfo[playerid][pGangRang] != -1)
	{
		format(string,sizeof(string),"%s\nDie Gang verlassen",string);
    	PlayerOption[playerid][dialog][dia_pos] = 7;
		dia_pos++;
	}

	if(PlayerInfo[playerid][pGangRang] == -1) 	format(query,sizeof(query),"Gründer");
	else										format(query,sizeof(query),"%d",PlayerInfo[playerid][pGangRang]);
	format(query,sizeof(query),"{%s}%s - Mitglieder: %d/%d - Rang: %d",gang::GetColor(GangInfo[gid][gColor]),GangInfo[gid][gName],GangInfo[gid][gMembers],GangInfo[gid][gMemberLimit]);
	
	ShowPlayerDialog(playerid,dialog_GANG_MAIN,DIALOG_STYLE_LIST,query,string,"Weiter","Beenden");
	/*#define dialog_GANG_MAIN                (216)
	#define dialog_GANG_LEAVE               (217)
	#define dialog_GANG_KICK_MEMBER_ID      (218)
	#define dialog_GANG_KICK_MEMBER_REASON  (219)
	#define dialog_GANG_SET_MEMBER_RANG_ID  (220)
	#define dialog_GANG_SET_MEMBER_RANG     (221)*/
	return 1;
}

ncom:ginvite(playerid,invite_id[])
{
	if(PlayerInfo[playerid][pGang] == -1) return 1;
	if(PlayerInfo[playerid][pGangRang] != -1 || !perm_HasPlayerGangPermission(playerid,'i')) return SendClientMessage(playerid,GRUEN,"INFO: Du hast nicht genug Berechtigungen dafür");
	if(!has_params(invite_id)) return SendClientMessage(playerid,GRUEN,"INFO: Benutze /ginvite [ID]");
	new pid = strval(invite_id);
	if(pid < 0 || pid > 499) return SendClientMessage(playerid,GRUEN,"INFO: Ungültige Spieler-ID");
	if(!IsPlayerConnected(pid) || IsPlayerNPC(pid)) return SendClientMessage(playerid,GRUEN,"INFO: Ungültiger Spieler");
	if(PlayerInfo[pid][pGang] != 0) return SendClientMessage(playerid,GRUEN,"INFO: Der Spieler ist schon in einer Gang!");
	if(GetPVarInt(pid,"invite_joining_gang") == playerid || GetPVarInt(pid,"joining_gang") == playerid) return SendClientMessage(playerid,GRUEN,"INFO: Du lädst diesen Spieler schon ein");
	new Float:p[3];
	GetPlayerPos(pid,p[0],p[1],p[2]);
	if(IsPlayerInRangeOfPoint(playerid,10.0,p[0],p[1],p[2]))
	{
		format(string,sizeof(string),"INFO: Du lädst %s ein mit dir eine Gang zu gründen.",PlayerInfo[pid][pName]);
		SendClientMessage(playerid,GRUEN,string);
		format(string,sizeof(string),"INFO: %s lädt dich ein mit ihm eine Gang zu gründen. Benutze /gjoin um zu akzeptieren.",PlayerInfo[playerid][pName]);
		SendClientMessage(pid,GRUEN,string);
		SetPVarInt(pid,"invite_joining_gang",playerid);
		SetPVarInt(playerid,"joining_gang",playerid);
		SetPVarInt(playerid,"creating_gang",1);
	}
	return 1;
}

ncom:gjoin(playerid)
{
	if(PlayerInfo[playerid][pGang] != -1) 					return SendClientMessage(playerid,GRUEN,"INFO: Du bist schon in einer Gang!");
	
	new joining = GetPVarInt(playerid,"joining_gang"),
		invite	= GetPVarInt(playerid,"invite_joining_gang");
	if(invite != -1 && joining != -1)			 			return SendClientMessage(playerid,GRUEN,"INFO: Du hast schon akzeptiert.");
    if(invite == -1 && invite == -1)					  	return SendClientMessage(playerid,GRUEN,"INFO: Du hast kein Angebot erhalten.");

	if(invite != -1 && joining == -1)
	{//Einladung zur Gründung
		if(!IsPlayerConnected(invite) || IsPlayerNPC(invite) || PlayerInfo[invite][pGang] == -1)
		{
			SetPVarInt(playerid,"joining_gang",			-1);
			SetPVarInt(playerid,"invite_joining_gang",	-1);
			return 1;
		}
		format(string,sizeof(string),"GANG: %s hat die Einladung angenommen",PlayerInfo[playerid][pName]);
		SendClientMessage(invite,GRUEN,string);
		format(string,sizeof(string),"GANG: Du hast die Einladung von %s angenommen",PlayerInfo[invite][pName]);
		SendClientMessage(playerid,GRUEN,string);
		SetPVarInt(playerid,"joining_gang",invite);
		return 1;
	}
	//Einladung einer bereits existierenden Gang
	if(invite == -1 && joining != -1)
	{
		if(!IsPlayerConnected(joining) || IsPlayerNPC(joining) || PlayerInfo[joining][pGang] == -1)
		{
			SetPVarInt(playerid,"joining_gang",			-1);
			SetPVarInt(playerid,"invite_joining_gang",	-1);
			return 1;
		}
		new gid = PlayerInfo[joining][pGang];
		if(GangInfo[gid][gMembers] >= GangInfo[gid][gMemberLimit])
		{
			SendClientMessage(playerid,ROT,"GANG: Die Gang hat das Memberlimit bereits erreicht");
			SetPVarInt(playerid,"joining_gang",			-1);
			SetPVarInt(playerid,"invite_joining_gang",	-1);
			return 1;
		}
		
		format(string,sizeof(string),"INFO: Du hast die Einladung von %s angenommen",PlayerInfo[joining][pName]);
		SendClientMessage(playerid,GRUEN,string);
		format(string,sizeof(string),"INFO: %s hat die Einladung angenommen",PlayerInfo[playerid][pName]);
		SendClientMessage(joining,GRUEN,string);
		
		gang::OnPlayerJoinGang(PlayerInfo[playerid][PLAYER_ID],gid);
		SetPVarInt(playerid,"joining_gang",			-1);
		SetPVarInt(playerid,"invite_joining_gang",	-1);
		return 1;
	}
	return 1;
}

ncom:quest(playerid)
{
	if(PlayerEvent[playerid][TutorialStep][0] != -1 && PlayerEvent[playerid][TutorialStep][0] <= 2) return 1;
    quest::ShowPlayerList(playerid);
	return 1;
}
ncom:quests(playerid) return ncom_quest(playerid);

ncom:blume(playerid)
{
	ResetPlayerWeapons(playerid);
	GivePlayerWeapon(playerid,14,1);
}

ncom:ammo(playerid)
{
	item::GivePlayerItem(playerid,1,30);
	item::GivePlayerItem(playerid,2,100);
	return 1;
}

ncom:item(playerid)
{
	item_SHOW_ITEM_LIST(playerid);
	return 1;
}
ncom:items(playerid) return ncom_item(playerid);

ncom:albatra(playerid)
{
	w_SetPlayerPos(playerid,1163.9818, -1564.2709, 25.9239,_,3);
	return 1;
}

ncom:funk(playerid)
{
	if(PlayerEvent[playerid][TutorialStep][0] == 4 && PlayerEvent[playerid][TutorialStep][1] == 1)
    {
        HideInfobox(playerid);
		format(string,sizeof(string),"{C87E35}John Wake (Funkgerät):\n{F1F7DC}\"Test test test... Ah, scheint zu funktionieren. Du hast das Haus also\ngefunden. Wie schauts aus... ... ... ... Aha, verstehe. Das ist ganz und garnicht gut...");
		format(string,sizeof(string),"%s\nOk, du hast ja ehh den Schluessel. Suche den Kellereingang und suche die Medizin!\nSie ist recht teuer und muesste dementsprechend auch gesichert sein\"\n\n\n{878375}Hinweis:\n- Finde die Medizin.",string);
        ShowPlayerDialog(playerid,dialog_TUTORIAL_ENTERKELLER,DIALOG_STYLE_MSGBOX,"Funkverkehr mit John Wake",string,"Allet kla","");
		SetPVarInt(playerid,"tut_funk_used",1);
		return 1;
    }
    else
    {
        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;
}

ncom:setint(playerid,params[]) return SetPlayerInterior(playerid,strval(params));
ncom:setvw(playerid,params[]) return SetPlayerVirtualWorld(playerid,strval(params));
ncom:ints(playerid)
{
	format(string,sizeof(string),"INT %d VW %d",GetPlayerInterior(playerid),GetPlayerVirtualWorld(playerid));
	SendClientMessage(playerid,ROT,string);
	return 1;
}

ncom:ofen(playerid,shortcut)
{
	if(PlayerEvent[playerid][IstTot] >= 1) return 1;
	new furnace = craft_GetNearestFurnace(playerid);
	if(furnace == -1)
	{
		if(!shortcut) SendClientMessage(playerid,ROT,"INFO: Du bist an keinem Ofen");
		return 1;
	}
	craft_DisplayFurnaceDialog(playerid);
	return 2;
}

ncom:craft(playerid,shortcut)
{
	if(PlayerEvent[playerid][IstTot] >= 1) return 1;
	new craft = craft_GetNearestCraft(playerid);
	if(craft == -1)
	{
		if(!shortcut) SendClientMessage(playerid,ROT,"INFO: Du bist an keiner Craftingmaschine");
		return 1;
	}
	craft_DisplayCraftDialog(playerid);
	return 2;
}

ncom:reisen(playerid)
{
	new this_landing	= GetPlayerLanding(playerid,15.0);
	if(this_landing == -1) return 1;//Nicht am Automaten
	if(BalloonInfo[bMoving])
	{
	    ShowPlayerDialog(playerid,dialog_NULL,DIALOG_STYLE_MSGBOX,"Reisen","Reisefunktion zur Zeit nicht verfügbar","Zurück","");
	    return 2;
	}
	else
	{
	    if(BalloonInfo[bTarget] != this_landing)
	    {
	        ShowPlayerDialog(playerid,dialog_REISEN_ORDER,DIALOG_STYLE_MSGBOX,"Reisen","Der Balloon ist zur Zeit an einer anderen Landezone. Möchtest\ndu den Balloon anfordern?","Ja","Nein");
	        return 2;
	    }
	    else
	    {
	        new dlop = 0;
	        for(new lp; lp<COUNT_LANDING_POINTS; lp++)
	        {
	            if(lp != this_landing)
	            {
	                PlayerOption[playerid][dialog][dlop] = lp;
	                if(dlop == 0) format(string,sizeof(string),"%s (Kosten: 0$)",LandingNames[lp]);
	                else format(string,sizeof(string),"%s\n%s (Kosten: 0$)",string,LandingNames[lp]);
	                dlop++;
	            }
	        }
	        ShowPlayerDialog(playerid,dialog_REISEN_TARGET,DIALOG_STYLE_LIST,"Reisen - Reiseziel auswählen",string,"Reisen","Zurück");
	        return 2;
	    }
	}
}

ncom:heilen(playerid,params[])
{
	if(!(PlayerEvent[playerid][Training] & CanHeal)) return SendClientMessage(playerid,ROT,"ERROR: Das kannst du noch nicht!");
	new Float:healer_health;
	GetPlayerHealth(playerid,healer_health);
	if(healer_health < 60.0) return SendClientMessage(playerid,ROT,"ERROR: Du brauchst mehr als 60 HP um andere Spieler zu heilen!");
	new healid 			= strval(params),
		bool:success 	= false;
	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)) success = false;
	else
	{
		new Float:hpos[3];
		GetPlayerPos(healid,hpos[0],hpos[1],hpos[2]);
		if(!IsPlayerInRangeOfPoint(playerid,HEAL_RANGE,hpos[0],hpos[1],hpos[2])) success = false;
		GetPlayerHealth(healid,hpos[0]);
		if(hpos[0] > 99.0) success = false;
	}
	if(!success)
	{
		format(string,sizeof(string),"ERROR: Du kannst den Spieler mit der ID %d nicht heilen.",healid);
		SendClientMessage(playerid,ROT,string);
		return 1;
	}
	format(string,sizeof(string),"INFO: Du heilst %s (ID %d)",GetName(healid),healid);
	SendClientMessage(playerid,GRUEN,string);
	format(string,sizeof(string),"INFO: %s (ID %d) heilt dich",GetName(playerid),playerid);
	SendClientMessage(healid,GRUEN,string);
	OnPlayerHealPlayer(playerid,healid,1);
	return 1;
}

ncom:wank(playerid) 
{
	if(GetPVarInt(playerid,"pev_wank") == 1) return 1;
	SetPVarInt(playerid,"pev_wank",1);
	ApplyAnimation(playerid,"PAULNMAC", "wank_loop", 1.800001, 1, 0, 0, 1, 600);
	SetTimerEx("pevent_WankEnd",4000,0,"d",playerid);
	return 1;
}

ncom:give(playerid,params[])
{
	new toID,Float:anzahl,dest[120];
	if(sscanf(params,"dfs",toID,anzahl,dest))
	{
		SendClientMessage(playerid,GRUEN,"SYNTAX: /give [PlayerID {0-499}] [Float.1:Anzahl {0.1+}] [Item[]]");
		SendClientMessage(playerid,GRUEN,"Items: Wasser, Benzin, Batterie");
		SendClientMessage(playerid,GRUEN,"Beispiel: \"/give 0 15 Wasser\" um ID0 15 Liter Wasser zu geben");
		return 1;
	}
	if(toID == playerid) return SendClientMessage(playerid,ROT,"ERROR: Das geht nicht");
	if(!IsPlayerConnected(toID)) return SendClientMessage(playerid,ROT,"ERROR: Der Spieler ist offline");
	if(IsPlayerNPC(toID)) return SendClientMessage(playerid,ROT,"ERROR: Das geht mit NPCs nicht");
	
	new az[30];
	format(az,sizeof(az),"%0.1f",anzahl);
	anzahl = floatstr(az);
	
	if(anzahl <= 0.0) return SendClientMessage(playerid,ROT,"ERROR: Anzahl zu gering.");
	if(!dest[0]) return SendClientMessage(playerid,ROT,"ERROR: Falsches Item");
	
	new Float:pos[3];
	GetPlayerPos(toID,pos[0],pos[1],pos[2]);
	if(!IsPlayerInRangeOfPoint(playerid,MAX_ITEM_GIVE_RANGE,pos[0],pos[1],pos[2])) return SendClientMessage(playerid,ROT,"ERROR: Du bist nicht in der Nähe des Spielers");
	
	if(!strcmp(dest,"Wasser",true))
	{
		if(anzahl > PlayerResource[playerid][Wasser]) return SendClientMessage(playerid,ROT,"ERROR: Du hast zu wenig Wasser");
		PlayerResource[playerid][Wasser] 	-= anzahl;
		PlayerResource[toID][Wasser] 		+= anzahl;
		format(string,sizeof(string),"INFO: Du hast %s %0.2f Liter Wasser gegeben",GetName(toID),anzahl);
		SendClientMessage(playerid,GRUEN,string);
		format(string,sizeof(string),"INFO: %s hat dir %0.2f Liter Wasser gegeben",GetName(playerid),anzahl);
		SendClientMessage(toID,GRUEN,string);
	}
	else if(!strcmp(dest,"Benzin",true))
	{
		if(anzahl > PlayerResource[playerid][Benzin]) return SendClientMessage(playerid,ROT,"ERROR: Du hast zu wenig Benzin");
		PlayerResource[playerid][Benzin] 	-= anzahl;
		PlayerResource[toID][Benzin] 		+= anzahl;
		format(string,sizeof(string),"INFO: Du hast %s %0.2f Liter Benzin gegeben",GetName(toID),anzahl);
		SendClientMessage(playerid,GRUEN,string);
		format(string,sizeof(string),"INFO: %s hat dir %0.2f Liter Benzin gegeben",GetName(playerid),anzahl);
		SendClientMessage(toID,GRUEN,string);
	}
	else if(!strcmp(dest,"Batterie",true) || !strcmp(dest,"Batterien",true))
	{
		if(anzahl > PlayerResource[playerid][Batterien]) return SendClientMessage(playerid,ROT,"ERROR: Du hast zu wenig Batterien");
		PlayerResource[playerid][Batterien]	-= anzahl;
		PlayerResource[toID][Batterien]		+= anzahl;
		format(string,sizeof(string),"INFO: Du hast %s %0.2f Batterieladung gegeben",GetName(toID),anzahl);
		SendClientMessage(playerid,GRUEN,string);
		format(string,sizeof(string),"INFO: %s hat dir %0.2f Batterieladung gegeben",GetName(playerid),anzahl);
		SendClientMessage(toID,GRUEN,string);
	}
	else if(!strcmp(dest,"Oettinger",true))
	{
		SendClientMessage(playerid,ROT,"WAS!?");
		SendClientMessage(playerid,ROT,"Ungültiges Item. Verfügbare Items: Wasser, Benzin, Batterie");
	}
	else
	{
		SendClientMessage(playerid,ROT,"Ungültiges Item. Verfügbare Items: Wasser, Benzin, Batterie");
		return 1;
	}
	return 1;
}

#define P_COST_1 (5)
#define P_COST_2 (4)
new PremiumCost[P_COST_1][P_COST_2] = {
	{50,90,160,1500},	//DoubleExp (7,14,30,Life Tage)
	{50,90,160},		//Skillbooster (7,14,30 Tage)
	{75,135,320},		//Skillmodifikator (7,14,30 Tage)
	{7,14,30},			//Gasmaske (7,14,30 Tage)
	{490}				//Namechange (1 Use)
};
	
ncom:premium(playerid)
{
	/*
		DoubleExp
			- 7  Tage = 50
			- 14 Tage = 90
			- 30 Tage = 160
			- Life	  = 1500
		Skillbooster
			- 7  Tage = 40
			- 14 Tage = 70
			- 30 Tage = 140
		Skillmodifikator
			- 7 Tage  = 75
			- 14 Tage = 135
			- 30 Tage = 320
		Gasmaske
			- 7  Tage
			- 14 Tage
			- 30 Tage
		Namechange
			- 1 Use   = 490
	*/
	new Float:modificator = 2.0,
		newcost[P_COST_1][P_COST_2];
	for(new a; a<P_COST_1; a++) for(new b; b<P_COST_2; b++) newcost[a][b] = (floatround(float(PremiumCost[a][b])*modificator));
	format(string,sizeof(string),"{F1F7DC}Informationen");
	if(PlayerPremium[playerid][PointsLeft] > newcost[0][0]) 	format(string,sizeof(string),"%s\n{77AE35}DoubleExp\t(ab %d Kronkorken)",string,newcost[0][0]);
	else														format(string,sizeof(string),"%s\n{C85135}DoubleExp\t(ab %d Kronkorken)",string,newcost[0][0]);
	if(PlayerPremium[playerid][PointsLeft] > newcost[1][0]) 	format(string,sizeof(string),"%s\n{77AE35}Skillboost\t(ab %d Kronkorken)",string,newcost[1][0]);
	else														format(string,sizeof(string),"%s\n{C85135}Skillboost\t(ab %d Kronkorken)",string,newcost[1][0]);
	if(PlayerPremium[playerid][PointsLeft] > newcost[2][0]) 	format(string,sizeof(string),"%s\n{77AE35}Skillmodifikator\t(ab %d Kronkorken)",string,newcost[2][0]);
	else														format(string,sizeof(string),"%s\n{C85135}Skillmodifikator\t(ab %d Kronkorken)",string,newcost[2][0]);
	format(query,sizeof(query),"{F1F7DC}%d Kronkorken übrig",PlayerPremium[playerid][PointsLeft]);
	ShowPlayerDialog(playerid,DIALOG_PREMIUM_MAIN,DIALOG_STYLE_LIST,query,string,"Weiter","Beenden");
	return 1;
}

ncom:durchsuchen(playerid,shortcut)
{
	if(GetPVarInt(playerid,"pevent_Muelltonne") == 1) return 1;
	if(GetPVarInt(playerid,"can_mine") != 0)
	{
		if(!shortcut) ShowPlayerDialog(playerid,dialog_NULL,DIALOG_STYLE_MSGBOX,"{F1F7DC}Mülltonne durchsuchen","{F1F7DC}Du kannst jetzt keine Mülltonne durchsuchen, warte\n\noch ein wenig...","Zurück","");
		return 1;
	}
	for(new i; i<MAX_MUELLTONNEN; i++)
	{
	    if(Muelltonne[i][mActive] && Muelltonne[i][mPickup])
	    {
	        if(IsPlayerInRangeOfPoint(playerid,MAX_ITEM_GIVE_RANGE,Muelltonne[i][mPos][0],Muelltonne[i][mPos][1],Muelltonne[i][mPos][2]))
	        {
				ApplyAnimation(playerid, "BOMBER", "BOM_Plant", 4.0, 1, 0, 0, 0, 0, 1);
				SetPVarInt(playerid,"pevent_Muelltonne",1);
				SetTimerEx("pevent_Muelltonne",2000,0,"dd",playerid,i);
	            return 2;
	        }
		}
	}
	return 1;
}

ncom:gangwar(playerid)
{
	new gid = PlayerInfo[playerid][pGang];
	if(gid == -1) 									return SendClientMessage(playerid,ROT,"INFO: Du bist in keiner Gang");
	if(PlayerInfo[playerid][pGangRang] != -1) 		return SendClientMessage(playerid,ROT,"GANG: Nur der Gangleader kann Gangfights anführen");
	if(GangInfo[gid][gTurfFight] != -1)				return SendClientMessage(playerid,ROT,"GANG: Deine Gang ist momentan schon in einen Kampf verwickelt");
	new timestamp = gettime(_,_,_),days,hours;
	if((timestamp-GangInfo[gid][gLastAttack]) < GANGWAR_ATTACK_COOLDOWN)
	{
		ConvertTime((timestamp-GangInfo[gid][gLastAttack]),_,days,hours);
		format(string,sizeof(string),"GANG: Du musst noch %d Tage und %d Stunden warten, bevor du den nächsten Angriff starten kannst",days,hours);
		SendClientMessage(playerid,ROT,string);
		return 1;
	}
	new tid = turf::GetPlayerTurfMiddle(playerid);
	if(tid == -1) 									return SendClientMessage(playerid,ROT,"GANG: Du kannst hier keinen Gangfight beginnen");
	if(GangInfo[gid][gTurfs] >= MAX_GANG_TURFS)
	{
		format(string,sizeof(string),"GANG: Deine Gang hat das Limit von %d Gebieten erreicht",MAX_GANG_TURFS);
		SendClientMessage(playerid,ROT,string);
		return 1;
	}
	new egid = TurfInfo[tid][tOwner];
	if(egid == gid)									return SendClientMessage(playerid,ROT,"GANG: Dieses Gebiet gehört deiner Gang bereits");

	if(egid != -1)
	{//Gangfight
		if(GangInfo[egid][gTurfFight] != -1)		return SendClientMessage(playerid,ROT,"GANG: Der jetzige Besitzer ist schon in einen Gangfight verwickelt");
		if((timestamp-TurfInfo[tid][tLastAttack]) < ATTACK_WAIT_TIME)
		{
			ConvertTime(timestamp-TurfInfo[tid][tLastAttack],_,days,hours);
			format(string,sizeof(string),"GANG: Dieses Gebiet wurde schon angegriffen, warte noch %d Tage und %d Stunden",days,hours);
			return SendClientMessage(playerid,ROT,string);
		}
		if((timestamp-TurfInfo[tid][tCaptured]) < CAPTURE_WAIT_TIME)
		{
			ConvertTime(timestamp-TurfInfo[tid][tCaptured],_,days,hours);
			format(string,sizeof(string),"GANG: Dieses Gebiet wurde grade erst eingenommen, warte noch %d Tage und %d Stunden",days,hours);
			return SendClientMessage(playerid,ROT,string);
		}		
		new defenders 	= gang::CountOnlineMembers(gid),
			attackers	= gang::CountOnlineMembers(egid);
		if(defenders < GANGWAR_MEMBERS_REQUIRED)
		{
			format(string,sizeof(string),"INFO: Es sind zu wenig Verteidiger online (%d/%d)",defenders,GANGWAR_MEMBERS_REQUIRED);
			SendClientMessage(playerid,ROT,string);
		}
		if(defenders < attackers)					return SendClientMessage(playerid,ROT,"INFO: Es sind zu wenig Verteidiger online");
		turf::StartGangwar(tid,gid);
		return 1;
	}
	//Gebiet direkt einnehmen, da es keinen Besitzer hat
	TurfInfo[tid][tOwner] 		=	gid;	
	TurfInfo[tid][tCaptured]	=	gettime(_,_,_);
	TurfInfo[tid][tLastAttack]	=	0;
	GangInfo[gid][gTurfs]		+=	1;
	turf::UpdateTurf(tid);
	gang::UpdateGang(gid);
	format(string,sizeof(string),"GANG: Deine Gang hat ein Gebiet erobert (%d von maximal %d),",GangInfo[gid][gTurfs],MAX_GANG_TURFS);
	gang::SendMessageToGang(gid,BLAU,string);
	return 1;
}

ncom:vote(playerid)
{
	OnDialogResponse(playerid,dialog_VOTE_MAINRE,1,0,"");
	return 1;
}

/////////////////////// ADMIN COMMANDS //////////////////////

ncom:o(playerid,message[])
{
	if(!__SERVER[GLOBAL_CHAT] && !perm_HasPlayerAdminPermission(playerid,'c')) return SendClientMessage(playerid,ROT,"Der OOC wurde abgeschaltet");
	if(!has_params(message)) return SendClientMessage(playerid,ROT,"SYNTAX: /o [message{[]}]");
	format(string,sizeof(string),"(( OOC %s (%d): %s ))",GetName(playerid),playerid,message);
	SendClientMessageToAll(ORANGE,string);
	return 1;
}

ncom:dooc(playerid)
{
	if(!perm_HasPlayerAdminPermission(playerid,'c')) return CallLocalFunction("perm_InsufficientPermissions","dsd",playerid,"CMD dooc",'c');
	__SERVER[GLOBAL_CHAT] = __SERVER[GLOBAL_CHAT]==1?0:1;
	format(string,sizeof(string),"(( %s hat den OOC %s ))",GetName(playerid),__SERVER[GLOBAL_CHAT]==1?("angeschaltet"):("ausgeschaltet"));
	SendClientMessageToAll(ORANGE,string);
	return 1;
}

ncom:kick(playerid,params[])
{
	if(!perm_HasPlayerAdminPermission(playerid,'k')) return CallLocalFunction("perm_InsufficientPermissions","dsd",playerid,"CMD kick",'k');
	new kid = -1;
	format(query,sizeof(query),"<kein Grund vorhanden>");
	if(sscanf(params,"dz",kid,query)) return SendClientMessage(playerid,ROT,"SYNTAX: /kick [playerid] [grund=\"kein grund\"]");
	if(!IsPlayerConnected(kid)) return SendClientMessage(playerid,ROT,"ERROR: Der Spieler ist offline");
	format(string,sizeof(string),"INFO: Du hast %s gekickt. Grund: %s",GetName(kid),query);
	SendClientMessage(playerid,ROT,string);
	format(string,sizeof(string),"INFO: Du wurdest von %s gekickt. Grund: %s",GetName(playerid),query);
	SendClientMessage(kid,ROT,string);
	Kick(kid);
	return 1;
}

ncom:tban(playerid,params[])
{
	if(!perm_HasPlayerAdminPermission(playerid,'t')) return CallLocalFunction("perm_InsufficientPermissions","dsd",playerid,"CMD tban",'t');
	new kid = -1,time=2;
	if(sscanf(params,"ddz",kid,time,query)) return SendClientMessage(playerid,ROT,"SYNTAX: /tban [playerid] [zeit(minuten) {2-120}] [grund=\"kein grund\"]");
	if(!IsPlayerConnected(kid)) return SendClientMessage(playerid,ROT,"ERROR: Der Spieler ist offline");
	if(time < 2 || time > MAX_TMP_BAN_TIME) return SendClientMessage(playerid,ROT,"SYNTAX: /tban [playerid] [zeit(minuten) {2-120}] [grund=\"kein grund\"]");
	format(string,sizeof(string),"INFO: Du hast %s für %d Minuten gesperrt. Grund: %s",GetName(kid),time,query[0]>=1?query:("<kein Grund>"));
	SendClientMessage(playerid,ROT,string);
	format(string,sizeof(string),"INFO: Du wurdest von %s für %d Minuten gesperrt. Grund: %s",GetName(playerid),time,query[0]>=1?query:("<kein Grund>"));
	SendClientMessage(kid,ROT,string);	
	CORE::BanEvent(PlayerInfo[kid][PLAYER_ID],time*60,PlayerInfo[playerid][PLAYER_ID],query[0]?query:("kein Grund"),false);
	Kick(kid);
	return 1;
}


ncom:ao(playerid,text[])
{
	if(!perm_HasPlayerAdminPermission(playerid,'c')) return CallLocalFunction("perm_InsufficientPermissions","dsd",playerid,"CMD ao",'c');
	if(!has_params(text)) return SendClientMessage(playerid,ROT,"SYNTAX: /ao [message]");
	format(string,sizeof(string),"ADMIN %s (%d): %s",GetName(playerid),playerid,text);
	SendClientMessageToAll(GRUEN,string);
	return 1;
}

ncom:veh(playerid,params[])
{
	if(!perm_HasPlayerAdminPermission(playerid,'v')) return CallLocalFunction("perm_InsufficientPermissions","dsd",playerid,"CMD veh",'v');
	new vmodel,color[2] = {-1,...},Float:pos[4];
	if(sscanf(params,"ds",vmodel,string)) return SendClientMessage(playerid,ROT,"SYNTAX: /veh [Model {400-611}] [Farbe1=-1] [Farbe2=-1]");
	if(vmodel < 400 || vmodel > 611) return SendClientMessage(playerid,ROT,"SYNTAX: /veh [Model {400-611}] [Farbe1=-1] [Farbe2=-1]");
	sscanf(string,"dd",color[0],color[1]);
	GetPlayerPos(playerid,pos[0],pos[1],pos[2]);
	GetPlayerFacingAngle(playerid,pos[3]);
	pos[2] += 1.5;
	new vint = GetPlayerInterior(playerid), vw = GetPlayerVirtualWorld(playerid),
		cveh = car::CreateVehicle(vmodel,pos[0],pos[1],pos[2],pos[3],color[0],color[1],-1,_,_,_,vint,vw);
	PutPlayerInVehicle(playerid,cveh,0);
	return 1;
}

ncom:destroy_vehicle(playerid)
{
	if(!perm_HasPlayerAdminPermission(playerid,'v')) return CallLocalFunction("perm_InsufficientPermissions","dsd",playerid,"CMD destroy_vehicle",'v');
	if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,ROT,"ERROR: Du musst in einem Fahrzeug sitzen");
	new veh = GetPlayerVehicleID(playerid);
	format(string,sizeof(string),"INFO: Du hast das Fahrzeug %d (cID %d) zerstört",veh,VehicleInfo[veh][cID]);
	SendClientMessage(playerid,ROT,string);
	car_DestroyVehicle(veh,true);
	return 1;
}

ncom:gethere(playerid,pids[])
{
	if(!has_params(pids)) return 1;
	if(!perm_HasPlayerAdminPermission(playerid,'t')) return CallLocalFunction("perm_InsufficientPermissions","dsd",playerid,"CMD gethere",'t');
	if(is_numeric(pids))
	{
		new pid = strval(pids);
		if(pid >= 0 && pid < MAX_PLAYERS && pid != playerid && IsPlayerConnected(pid))
		{//Zu Spielern
				new Float:p[3],vw = GetPlayerVirtualWorld(playerid),int = GetPlayerInterior(playerid);
				GetPlayerPos(playerid,p[0],p[1],p[2]);
				w_SetPlayerPos(pid,p[0],p[1],p[2]);	
				SetPlayerVirtualWorld(pid,vw);
				SetPlayerInterior(pid,int);
				EndMedicalTreatment(pid);
				format(string,sizeof(string),"%s hat dich geportet",GetName(playerid));
				SendClientMessage(pid,ROT,string);
				format(string,sizeof(string),"Du hast %s geportet",GetName(pid));
				SendClientMessage(playerid,ROT,string);
		}
		format(string,sizeof(string),"Der Spieler mit der ID %d ist offline.",pid);
		SendClientMessage(playerid,ROT,string);
	}
	return 1;
}
		
ncom:goto(playerid,to[])
{
	if(!perm_HasPlayerAdminPermission(playerid,'t')) return CallLocalFunction("perm_InsufficientPermissions","dsd",playerid,"CMD goto",'t');
	if(has_params(to))
	{
		if(is_numeric(to))
		{
			new goID = strval(to);
			if(goID >= 0 && goID < MAX_PLAYERS && goID != playerid && IsPlayerConnected(goID))
			{//Zu Spielern
				new Float:p[3],vw = GetPlayerVirtualWorld(goID), int = GetPlayerInterior(goID);
				GetPlayerPos(goID,p[0],p[1],p[2]);
				w_SetPlayerPos(playerid,p[0],p[1],p[2]);	
				SetPlayerVirtualWorld(playerid,vw);
				SetPlayerInterior(playerid,int);
				EndMedicalTreatment(playerid);
				format(string,sizeof(string),"Du hast dich zu %s (VW %d, INT %d) geportet.",GetName(goID),vw,int);
				SendClientMessage(playerid,ROT,string);
				return 1;
			}
			format(string,sizeof(string),"Der Spieler mit der ID %d ist offline.",goID);
			SendClientMessage(playerid,ROT,string);
			return 1;
		}
		else if(!strcmp(to,"FortCarson",true))
		{
			w_SetPlayerPos(playerid,-177.4116,1110.8359,19.7422);
			if(PlayerEvent[playerid][IstTot] == 0) SetPlayerVirtualWorld(playerid,0);
			else SetPlayerVirtualWorld(playerid,1000);
			SetPlayerInterior(playerid,0);
			SendClientMessage(playerid,ROT,"Du hast dich nach FortCarson geportet.");
			EndMedicalTreatment(playerid);
			return 1;
			}
		else if(!strcmp(to,"Unterwelt",true))
		{
			SetPlayerInterior(playerid,2);
			if(PlayerEvent[playerid][IstTot] == 0) SetPlayerVirtualWorld(playerid,0);
			else SetPlayerVirtualWorld(playerid,1000);
			w_SetPlayerPos(playerid,614.50781250,974.70214844,98.49218750,_,2);
			SendClientMessage(playerid,ROT,"Du hast dich in die Unterwelt geportet.");
			EndMedicalTreatment(playerid);
			return 1;
		}
		else if(!strcmp(to,"Dungeon1",true))
		{
			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);
			SendClientMessage(playerid,ROT,"Du hast dich in den Dungeon1 geportet.");
			return 1;
		}
		else if(!strcmp(to,"jaegers",true))
		{
			SetPlayerInterior(playerid,0);
			if(PlayerEvent[playerid][IstTot] == 0) SetPlayerVirtualWorld(playerid,0);
			else SetPlayerVirtualWorld(playerid,1000);
			for(new i; i<MAX_JAEGER_POS; i++)
			{
				if(JaegersObject[i] >= 0)
				{
					new Float:pos[3];
					GetObjectPos(JaegersObject[i],pos[0],pos[1],pos[2]);
					w_SetPlayerPos(playerid,pos[0],pos[1],pos[2],_,1);
					format(string,sizeof(string),"moved to jaegers %d",i);
					SendClientMessage(playerid,GRUEN,string);
				}
			}
			SendClientMessage(playerid,ROT,"Du hast dich zu jaegers geportet.");
			return 1;
		}
		else
		{
			new int_param = 0xDEADBEEF;
			sscanf(to,"ds",int_param,string);
			if(int_param != 0xDEADBEEF)
			{
				if(!strcmp(string,"veh",true))
				{
					if(!IsVehicleConnected(int_param)) return SendClientMessage(playerid,ROT,"ERROR: Das Vehicle existiert nicht");
					SetPlayerInterior(playerid,VehicleInfo[int_param][cVINT][1]);
					SetPlayerVirtualWorld(playerid,VehicleInfo[int_param][cVVW]);
					for(new i; i<__SERVER[HIGHEST_PLAYER_ID]; i++)
					{
						if(IsPlayerInAnyVehicle(i) && GetPlayerVehicleID(i) == int_param && GetPlayerVehicleSeat(i) == 0)
						{
							new Float:pos[3];
							GetVehiclePos(int_param,pos[0],pos[1],pos[2]);
							w_SetPlayerPos(playerid,pos[0],pos[1],pos[2],_,2);
							return 1;
						}
					}
					PutPlayerInVehicle(playerid,int_param,0);
					return 1;
				}
			}
		}
	}
	SendClientMessage(playerid,ROT,"=== AdminCMD \"/goto\" ===");
	SendClientMessage(playerid,ROT,"=== /goto ID -> Port zu Spieler ID");
	SendClientMessage(playerid,ROT,"=== /goto O[]-> Port zu Ort O");
	SendClientMessage(playerid,ROT,"=== /goto ID [veh]->Port zum Auto");
	SendClientMessage(playerid,ROT,"=== O:");
	SendClientMessage(playerid,ROT,"FortCarson, Unterwelt, Dungeon1");
	return 1;
}

ncom:apark(playerid)
{
	if(!perm_HasPlayerAdminPermission(playerid,'v')) return CallLocalFunction("perm_InsufficientPermissions","dsd",playerid,"CMD forcepark",'v');
	if(IsPlayerInAnyVehicle(playerid)) 
	{
		new veh = GetPlayerVehicleID(playerid);
		new bool:_tmp = VehicleInfo[veh][save_vehicle_data];
		VehicleInfo[veh][save_vehicle_data] = true;
		car::OnCarUpdate(veh,true);
		VehicleInfo[veh][save_vehicle_data] = _tmp;
		SendClientMessage(playerid,GRUEN,"ADM-CMD: Fahrzeug hier geparkt.");
	}
	return 1;
}

ncom:opendoor(playerid,oids[])
{
	new oid = strval(oids);
	switch(oid)
	{
		case 1:
		{
			if(__OBJECTS[0][ssStatus] == 1)
			{
				MoveObject(__OBJECTS[0][ssID],-2922.3974,180.0527,252.6243,0.5);
				__OBJECTS[0][ssStatus] = 0;
			}
			else
			{
				MoveObject(__OBJECTS[0][ssID],-2922.4130,177.1635,252.6152,0.5);
				__OBJECTS[0][ssStatus] = 1;
			}
		}
		case 2:
		{
			if(__OBJECTS[1][ssStatus] == 1)	
			{
				MoveObject(__OBJECTS[1][ssID],-2893.3276,243.5051,251.8413,0.5);
				__OBJECTS[1][ssStatus] = 0;
			}
			else
			{
				MoveObject(__OBJECTS[1][ssID],-2893.3686,241.2637,251.8413,0.5);
				__OBJECTS[1][ssStatus] = 1;
			}
		}
	}
	return 1;
}

/*ncom:tutende(playerid)
{
	SetPVarInt(playerid,"tut_finish",1);
	SetPVarInt(playerid,"tut_finish_step",0);
	OnPlayerFinishCameraMovement(playerid);
	return 1;
}*/

ncom:getanim(playerid)
{
	if(GetPlayerAnimationIndex(playerid))
    {
        GetAnimationName(GetPlayerAnimationIndex(playerid),query,32,string,32);
		format(string,sizeof(string),"Running anim: %s %s",query,string);
        SendClientMessage(playerid,0xFFFFFFFF,string);
    }
	return 1;
}

ncom:trainieren(playerid)
{
	if(PlayerEvent[playerid][IstTot] != 0) return 1;
	if(GetPVarInt(playerid,"pev_train") != 0)
	{
		switch(GetPVarInt(playerid,"pev_train"))
		{
			case -42: return 1;
			case 1:
			{//Bike
				SetPlayerPos(playerid,-1477.6403,2610.9968,40.6781);
				ApplyAnimation(playerid,"GYMNASIUM","gym_bike_getoff",4.0,0,0,0,1000,1);
				SetPVarInt(playerid,"pev_train",-1);
				SetTimerEx("pevent_Train",1200,0,"dd",playerid,-1);
			}
			case 2:
			{//Laufband
				SetPlayerPos(playerid,-1467.1683,2602.4785,40.6784);
				SetPlayerFacingAngle(playerid,270.6629);
				ApplyAnimation(playerid,"GYMNASIUM","gym_tread_getoff",4.0,0,0,0,1000,1);
				SetPVarInt(playerid,"pev_train",-2);
				SetTimerEx("pevent_Train",1500,0,"dd",playerid,-2);
			}
			case 3:
			{//Hanteln
				SetPlayerPos(playerid,-1472.2189,2602.1113,40.0524);
				SetPlayerFacingAngle(playerid,350.0);
				ApplyAnimation(playerid,"Freeweights","gym_free_putdown",4.0,0,0,0,1500,1);
				SetPVarInt(playerid,"pev_train",-3);
				SetTimerEx("pevent_Train",2000,0,"dd",playerid,-3);				
				SetTimerEx("pevent_RemoveAttachedObject",1000,0,"dd",playerid,GetPVarInt(playerid,"pev_train_hantel1"));
				SetTimerEx("pevent_RemoveAttachedObject",1000,0,"dd",playerid,GetPVarInt(playerid,"pev_train_hantel2"));
			}
		}
		return 1;
	}
	if(IsPlayerInRangeOfPoint(playerid,3.0,-1477.6047,2610.9033,40.6781))
	{//Fahrrad
		if(SportstudioUse & (1<<1)) return ShowPlayerDialog(playerid,dialog_NULL,DIALOG_STYLE_MSGBOX,"{F1F7DC}Nicht möglich","{F1F7DC}Das Fahrrad wird zur Zeit noch benutzt","Zurück","");
		SportstudioUse |= (1<<1);
		Delete3DTextLabel(SportStudioTexts[0]);
		SetPlayerPos(playerid,-1477.9034,2610.7861,39.8890);
		SetPlayerFacingAngle(playerid,178.9622);
		SetPlayerCameraPos(playerid,-1474.8247,2607.2358,43.1847);
		SetPlayerCameraLookAt(playerid,-1477.9034,2610.7861,39.8890);		
		TogglePlayerControllable(playerid,0);
		ApplyAnimation(playerid,"GYMNASIUM","gym_bike_geton",4.0,1,1,1,1,0,1);
		SetPVarInt(playerid,"pev_train",-42);
		SetTimerEx("pevent_Train",800,0,"dd",playerid,1);
		return 2;
	}
	else if(IsPlayerInRangeOfPoint(playerid,3.0,-1465.6505,2602.8389,40.7760))
	{//Laufband
		if(SportstudioUse & (1<<2)) return ShowPlayerDialog(playerid,dialog_NULL,DIALOG_STYLE_MSGBOX,"{F1F7DC}Nicht möglich","{F1F7DC}Das Laufband wird zur Zeit noch benutzt","Zurück","");
		SportstudioUse |= (1<<2);
		Delete3DTextLabel(SportStudioTexts[1]);
		SetPlayerPos(playerid,-1465.6505,2602.8389,40.7760);
		SetPlayerFacingAngle(playerid,270.6629);
		SetPlayerCameraPos(playerid,-1469.6024,2606.9409,42.9759);
		SetPlayerCameraLookAt(playerid,-1465.7362,2602.6719,40.9752);		
		TogglePlayerControllable(playerid,0);
		ApplyAnimation(playerid,"GYMNASIUM","gym_tread_geton",4.0,1,1,1,1,0,1);
		SetPVarInt(playerid,"pev_train",-42);
		SetTimerEx("pevent_Train",800,0,"dd",playerid,2);
		return 2;
	}
	else if(IsPlayerInRangeOfPoint(playerid,3.0,-1472.2189,2602.1113,40.0524))
	{//hanteln
		if(SportstudioUse & (1<<3)) return ShowPlayerDialog(playerid,dialog_NULL,DIALOG_STYLE_MSGBOX,"{F1F7DC}Nicht möglich","{F1F7DC}Die Hanteln werden zur Zeit noch benutzt","Zurück","");
		if(GetFreeAttachedSlots(playerid) < 2) return ShowPlayerDialog(playerid,dialog_NULL,DIALOG_STYLE_MSGBOX,"{F1F7DC}Nicht möglich","{F1F7DC}Du kannst jetzt nicht mit den Hanteln trainieren","Zurück","");
		SportstudioUse |= (1<<3);
		Delete3DTextLabel(SportStudioTexts[2]);
		SetPlayerPos(playerid,-1472.2189,2602.1113,40.0524);
		SetPlayerFacingAngle(playerid,350.0);
		SetPlayerCameraPos(playerid,-1472.0249,2606.7078,42.5000);
		SetPlayerCameraLookAt(playerid,-1472.2189,2602.1113,40.0524);		
		TogglePlayerControllable(playerid,0);
		ApplyAnimation(playerid,"Freeweights","gym_free_pickup",4.0,1,1,1,1,0,1);
		SetPVarInt(playerid,"pev_train",-42);
		SetTimerEx("pevent_Train",1000,0,"dd",playerid,3);
		
		new hantel=0;
		for(new slot; slot<MAX_PLAYER_ATTACHED_OBJECTS; slot++)
		{
			if(IsPlayerAttachedObjectSlotUsed(playerid,slot)) continue;
			switch(hantel)
			{
				case 0:
				{
					SetPlayerAttachedObject(playerid,slot,2916,6,0.073999,0.023000,-0.008999,84.799972,-0.099999,94.899948,1.000000,1.000000,1.000000);
					hantel = 1;
					SetPVarInt(playerid,"pev_train_hantel1",slot);
					continue;
				}
				case 1:
				{
					SetPlayerAttachedObject(playerid,slot,2916,5,0.072000,0.015000,0.005999,-19.000009,88.799972,19.800010,1.000000,1.000000,1.000000);
					SetPVarInt(playerid,"pev_train_hantel2",slot);
					break;
				}
			}
		}
		return 2;
	}
	return 1;
}

stock split(const strsrc[],strdest[][],delimiter,destsize=sizeof(strdest))
{
    new i,li,aNum,len;
    while(i <= strlen(strsrc))
    {
        if(strsrc[i] == delimiter || i == strlen(strsrc))
        {
            len = strmid(strdest[aNum],strsrc,li,i,144);
            strdest[aNum][len] = 0;
            li = i+1;
            if(++aNum >= destsize) return 0;
        }
        i++;
    }
    return 1;
}

ncom:annehmen(playerid,params[])
{
	if(!has_params(params)) return SendClientMessage(playerid,ROT,"HINWEIS: /annehmen [boxkampf/anruf]");
	new token[2][144];
	split(params,token,' ');
	if(!strcmp(token[0],"boxkampf"))
	{
		if(!token[1][0]) return SendClientMessage(playerid,ROT,"HINWEIS: /annehmen boxkampf [id]");
		new pid = strval(token[1]);
		if(pid == playerid || !IsPlayerConnected(pid) || IsPlayerNPC(pid))	return SendClientMessage(playerid,ROT,"ERROR: Ungültige ID");
		if(GetPVarInt(pid,"box_invite_pid") != playerid)					return SendClientMessage(playerid,ROT,"ERROR: Der Spieler hat dich nicht eingeladen");
		if(BoxTime >= 1)													return SendClientMessage(playerid,ROT,"ERROR: Es läuft bereits ein Kampf");
		BoxerID[0]	= pid;
		BoxerID[1]	= playerid;
		TogglePlayerControllable(pid,0);
		TogglePlayerControllable(playerid,0);
		SetPlayerPos(pid,-2127.5183,1710.6642,22.1175);
		SetPlayerFacingAngle(pid,45.0491);
		SetPlayerPos(playerid,-2130.1382,1713.0629,22.1175);
		SetPlayerFacingAngle(playerid,226.4474);
		SetCameraBehindPlayer(pid);
		SetCameraBehindPlayer(playerid);
		GameTextForPlayer(pid,"~r~4 Sekunden",3000,0);
		GameTextForPlayer(playerid,"~r~4 Sekunden",3000,0);
		SetPVarFloat(pid,"box_hp",0);
		SetPVarFloat(playerid,"box_hp",0);
		BoxTime		= BOX_TIME+4;		
		PLAYER::SavePlayerWeapons(playerid);
		PLAYER::ResetPlayerWeapons(playerid,false);
		PLAYER::SavePlayerWeapons(pid);
		PLAYER::ResetPlayerWeapons(pid,false);
		SetTimerEx("pevent_BoxStart",4000,0,"dd",pid,playerid);
		return 1;
	}
	if(!strcmp(token[0],"anruf"))
	{
		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) && GetPVarInt(pid,"pev_anrufen_id") == playerid)
		{
			SendClientMessage(pid,GRUEN,"INFO: Dein Anruf wurde angenommen");
			SetPVarInt(pid,"pev_anrufen",3);
			SetPVarInt(pid,"pev_anrufen_id",playerid);
			
			SendClientMessage(playerid,GRUEN,"INFO: Du hast den Anruf angenommen");
			SetPVarInt(playerid,"pev_anrufen",3);
			SetPVarInt(playerid,"pev_anrufen_id",pid);
			return 1;
		}
		DeletePVar(playerid,"pev_anrufen");
		DeletePVar(playerid,"pev_anrufen_id");
		return SendClientMessage(playerid,ROT,"ERROR: Dein Gesprächspartner ist nicht da");
	}
	SendClientMessage(playerid,ROT,"HINWEIS: /annehmen [boxkampf/anruf]");
	return 1;
}

ncom:ablehnen(playerid,params[])
{
	if(!has_params(params)) return SendClientMessage(playerid,ROT,"HINWEIS: /ablehnen [boxkampf/anruf]");
	new token[2][144];
	split(params,token,' ');
	if(!strcmp(token[0],"boxkampf"))
	{
		if(!token[1][0]) return SendClientMessage(playerid,ROT,"HINWEIS: /ablehnen boxkampf [id]");
		new pid = strval(token[1]);
		if(pid == playerid || !IsPlayerConnected(pid) || IsPlayerNPC(pid))	return SendClientMessage(playerid,ROT,"ERROR: Ungültige ID");
		if(GetPVarInt(pid,"box_invite_pid") != playerid)					return SendClientMessage(playerid,ROT,"ERROR: Der Spieler hat dich nicht eingeladen");
		SetPVarInt(pid,"box_invite_pid",-1);
		format(string,sizeof(string),"INFO: %s (%d) hat deine Herausforderung abgelehnt",GetName(playerid),playerid);
		SendClientMessage(pid,GRUEN,string);
		format(string,sizeof(string),"INFO: Du hast die Herausforderung von %s (%d) abgelehnt",GetName(pid),pid);
		SendClientMessage(playerid,GRUEN,string);
		SendPlayerMe(playerid," lehnt die Herausforderung ab.");
		return 1;
	}
	if(!strcmp(token[0],"anruf"))
	{
		CellPhoneFinishCall(playerid);
		return 1;
	}
	SendClientMessage(playerid,ROT,"HINWEIS: /ablehnen [boxkampf/anruf]");
	return 1;
}

ncom:abbrechen(playerid,params[])
{
	if(!has_params(params)) return SendClientMessage(playerid,ROT,"HINWEIS: /abbrechen [boxkampf]");
	new token[2][144];
	split(params,token,' ');
	if(!strcmp(token[0],"boxkampf"))
	{
		new pid = GetPVarInt(playerid,"box_invite_pid");
		if(pid == -1) return SendClientMessage(playerid,ROT,"ERROR: Du hast keine Person herausgefordert");
		if(IsPlayerConnected(pid) && !IsPlayerNPC(pid))
		{
			format(string,sizeof(string),"INFO: %s (%d) zieht die Herausforderung zurück",GetName(playerid),playerid);
			SendClientMessage(pid,GRUEN,string);
			format(string,sizeof(string),"INFO: Du ziehst die Herausforderung an %s (%d) zurück",GetName(pid),pid);
			SendClientMessage(playerid,GRUEN,string);
			SendPlayerMe(playerid," zieht die Herausforderung zurück");
		}
		SetPVarInt(playerid,"box_invite_pid",-1);
		return 1;
	}
	if(!strcmp(token[0],"anruf"))
	{
		switch(GetPVarInt(playerid,"pev_anrufen"))
		{
			case 0: return SendClientMessage(playerid,ROT,"ERROR: Du benutzt dein Handy nicht");
			case 2: return CellPhoneFinishCall(playerid);
			case 3: return CellPhoneFinishCall(playerid);
		}
		return 1;
	}
	SendClientMessage(playerid,ROT,"HINWEIS: /abbrechen [boxkampf]");
	return 1;
}

ncom:boxkampf(playerid,params[])
{
	if(PlayerEvent[playerid][IstTot] >= 1)	return 1;
	if(BoxTime >= 1)						return SendClientMessage(playerid,ROT,"ERROR: Es läuft noch ein Boxkampf");
	if(!has_params(params))					return SendClientMessage(playerid,ROT,"ERROR: /boxkampf [id]");
	if(!IsPlayerInRangeOfPoint(playerid,15.0,-2118.6000,1721.9000,21.2000)) return SendClientMessage(playerid,ROT,"ERROR: Du bist nicht am Boxring");
	new pid = CORE::GetPlayerID(params);
	if(!IsPlayerConnected(pid) || IsPlayerNPC(pid))	return SendClientMessage(playerid,ROT,"ERROR: Der Spieler ist nicht online");
	if(pid == playerid)								return SendClientMessage(playerid,ROT,"ERROR: Du kannst dich nicht selber herausfordern");
	if(PlayerEvent[pid][IstTot] >= 1 || !IsPlayerInRangeOfPoint(pid,15.0,-2118.6000,1721.9000,21.2000)) return SendClientMessage(playerid,ROT,"ERROR: Der Spieler ist nicht am Boxring");
	
	format(string,sizeof(string),"INFO: Du forderst %s (%d) zum Kampf heraus. \"/abbrechen boxkampf\" zum Zurückziehen.",GetName(pid),pid);
	SendClientMessage(playerid,GRUEN,string);
	format(string,sizeof(string),"INFO: %s (%d) fordert dich zum Kampf heraus. \"/annehmen boxkampf %d\" oder \"/abbrechen boxkampf %d\"",GetName(playerid),playerid,playerid,playerid);
	SendClientMessage(pid,GRUEN,string);
	format(query,sizeof(query)," fordert %s heraus.",GetName(pid));
	SendPlayerMe(playerid,query);
	SetPVarInt(playerid,"box_invite_pid",pid);
	return 1;
}

ncom:anrufen(playerid,params[])
{
	if(PlayerEvent[playerid][IstTot] >= 1)		return 1;
	if(GetPVarInt(playerid,"pev_anrufen") == 1) return SendClientMessage(playerid,ROT,"ERROR: Du telefonierst schon. Lege mit \"/abbrechen anruf\" auf");
	SetPVarInt(playerid,"pev_anrufen",1);
	SetPlayerSpecialAction(playerid,SPECIAL_ACTION_USECELLPHONE);
	SetTimerEx("pevent_Anrufen",4000,0,"ds",playerid,params);
	return SendClientMessage(playerid,GRUEN,"...warte");
}

ncom:skinlist(playerid)
{
	if(GetPVarInt(playerid,"tailor_skinc_active") == 1) mui_DestroySelectionMenu(playerid);
	else tailor_CreateSelectionMenu(playerid);
	return 1;
}