new Float: bmx1[2][3] =
{
{1860.9629,-2042.7212,13.5469},
{1866.7927,-2056.9846,13.3828}
};
new bmxo[MAX_PLAYERS];
new inviteID[MAX_PLAYERS];
new istdabei[MAX_PLAYERS];
new wurdeangefragt[MAX_PLAYERS];
new checkpointgarbage[MAX_PLAYERS];
new Float:kubik[MAX_VEHICLES];
new Float:maxkubik[MAX_VEHICLES];
CMD:garbage(playerid,params[])
{
if(IsPlayerConnected(playerid))
{
if(istdabei[playerid] == 0)
{
if(Spieler[playerid][pJob] == 1)
{
if(IsPlayerInAnyVehicle(playerid))
{
new veh = GetPlayerVehicleID(playerid);
for(new i = 0;i<sizeof(Muelllwagen);i++)
{
if(veh == Muelllwagen[i])
{
new rand = random(sizeof(bmx1));
new string[128],pID,string2[128];
//if(sscanf(params,"d",pID))return SendClientMessage(playerid,COLOR_GREY,"[Benutze] /garbage [SpielerID]");
if(wurdeangefragt[playerid] == 0)
{
inviteID[playerid] = pID;
format(string,sizeof(string),"Du hast %s erfolgreich eine Anfrage gesendet, bitte warte bis er sie annehmt!",inviteID[playerid]);
SendClientMessage(playerid,COLOR_BLUE,string);
format(string2,sizeof(string2),"%s hat dich angefragt, benutze /agarbage um die Anfrage anzunehmen",GetName(playerid));
SendClientMessage(inviteID[playerid],COLOR_BLUE,string2);
wurdeangefragt[pID] = 1;
maxkubik[veh] = 15.0;
kubik[veh] = 0.0;
istdabei[playerid] = 1;
checkpointgarbage[playerid] = playerid;
bmxo[playerid] = SetPlayerCheckpoint(checkpointgarbage[playerid],bmx1[rand][0],bmx1[rand][1],bmx1[rand][2],3);
return 1;
}
}
}
SendClientMessage(playerid, COLOR_RED, "Du bist in keinem Müllwagen.");
return 1;
}
}
else return SendClientMessage(playerid, COLOR_RED, "Du bist kein Müllmann.");
}
}
return 1;
}
public OnPlayerExitVehicle(playerid, vehicleid)
{
if(IsVehicleABus(vehicleid))
{
if(Spieler[playerid][pJob] == 1)
{
if(GetPlayerCheckpointType(playerid) == CP_TYPE_BUS)
{
SendClientMessage(playerid, COLOR_GREY, "* Deine Runde wird abgebrochen, wenn du nicht wieder in den Bus einsteigst!");
}
}
}
if(IsVehicleATruck(vehicleid))
{
if(Spieler[playerid][pJob] == 3)
{
if(GetPlayerCheckpointType(playerid) == CP_TYPE_TRUCK)
{
SendClientMessage(playerid, COLOR_GREY, "* Deine Fahrt wird abgebrochen, wenn du nicht wieder in den Truck einsteigst!");
UnfreezePlayer(playerid);
}
}
}
new rand = random(sizeof(bmx1));
if(bmxo[playerid] == 1)
{
bmxo[playerid] = SetPlayerCheckpoint(playerid,bmx1[rand][0],bmx1[rand][1],bmx1[rand][2],3);
}
inviteID[playerid] = pID;
format(string,sizeof(string),"Du hast %s erfolgreich eine Anfrage gesendet, bitte warte bis er sie annehmt!",inviteID[playerid]);
SendClientMessage(playerid,COLOR_BLUE,string);
format(string2,sizeof(string2),"%s hat dich angefragt, benutze /accept garbage um die Anfrage anzunehmen",SpielerName(playerid));
SendClientMessage(inviteID[playerid],COLOR_BLUE,string2);
wurdeangefragt[pID] = 1;
maxkubik[veh] = 15.0;
kubik[veh] = 0.0;
istdabei[playerid] = 1;
checkpointgarbage[playerid] = playerid;
return 1;
}
new fahrzeug[MAX_PLAYERS];
new muellsacke[MAX_VEHICLES];
public OnPlayerEnterDynamicCP(playerid, checkpointid)
{
if(checkpointid == bmxo[playerid])
{
SetPlayerAttachedObject(playerid,0,1264,6,0.165999,0.003000,-0.184999,0.000000,0.000000,0.000000,0.498999,0.466999,0.489000);
ApplyAnimation(playerid,"CARRY","liftup",4.1,0, 0, 0, 1, 1);
ClearAnimations(playerid,1);
SetPlayerSpecialAction(playerid,25);
new Float:vX,Float:vY,Float:vZ;
GetPosVorVeh(pMuellAuto[playerid], -5.0, vX, vY, vZ);
DestroyDynamicCP(bmxo[playerid]);
bmxo[playerid] = -1;
fahrzeug[playerid] = CreateDynamicCP(vX,vY,vZ,4.0,-1,-1,playerid,30.0);
TogglePlayerDynamicCP(playerid,fahrzeug[playerid],1);
new rand1 = 5+random(3);
muellsacke[pMuellAuto[playerid]] = rand1;
return 1;
}
else if(checkpointid == fahrzeug[playerid])
{
if(kubik[pMuellAuto[playerid]] == 5.0)
{
SendClientMessage(playerid,COLOR_RED,"Das Fahrzeug ist voll, benutze /garbagestop");
ClearAnimations(playerid,1);
SetPlayerSpecialAction(playerid,0);
RemovePlayerAttachedObject(playerid, 0);
kubik[pMuellAuto[playerid]] = 0;
DestroyDynamicCP(fahrzeug[playerid]);
fahrzeug[playerid] = -1;
}
else
{
if(muellsacke[pMuellAuto[playerid]] == 1)
{
muellsacke[pMuellAuto[playerid]] = 0;
ClearAnimations(playerid,1);
SetPlayerSpecialAction(playerid,0);
RemovePlayerAttachedObject(playerid, 0);
DestroyDynamicCP(fahrzeug[playerid]);
fahrzeug[playerid] = -1;
kubik[pMuellAuto[playerid]] += 0.5;
new rand = random(sizeof(bmx1));
bmxo[playerid] = CreateDynamicCP(bmx1[rand][0],bmx1[rand][1],bmx1[rand][2],5.0,-1,-1,playerid,1000.0);
return 1;
}
else
{
new string[123],string2[123];
ClearAnimations(playerid,1);
SetPlayerSpecialAction(playerid,0);
kubik[pMuellAuto[playerid]] += 0.5;
muellsacke[pMuellAuto[playerid]] -= 1;//HIER
RemovePlayerAttachedObject(playerid, 0);
format(string,sizeof(string),"Kubik: %0.1f/15.0",kubik[pMuellAuto[playerid]]);
SendClientMessage(playerid,COLOR_LIGHTBLUE,string);
format(string2,sizeof(string2),"Müllsäcke: %d",muellsacke[pMuellAuto[playerid]]);
SendClientMessage(playerid,COLOR_LIGHTBLUE,string2);
DestroyDynamicCP(fahrzeug[playerid]);
fahrzeug[playerid] = -1;
bmxo[playerid] = CreateDynamicCP(globalVar[playerid][0],globalVar[playerid][1],globalVar[playerid][2],4.0,-1,-1,playerid,30.0);
return 1;
}
}
}
return 1;
}
Hey, ich wollte fragen wie ich ein Befehl mache /accept garbage das der Spieler die Anfrage annehmen kann.
Meine andere frage ist das der Müllwagen Fahrer mit /garbagestop um die Route abzubrechen -> Er muss zur abladestelle fahren um die Kubiks abzuladen