Bustour
- reaL.
- Geschlossen
- Erledigt
-
-
Beitrag von justRevitox ()
Dieser Beitrag wurde gelöscht, Informationen über den Löschvorgang sind nicht verfügbar. -
if(nextCP >= sizeof(Bus_Stationen[]))
Oder
if(currentCP == sizeof(Bus_Stationen[])-1)Das wäre dann jeweils zum herausfinden, ob man in den letzten Checkpoint gefahren ist.
-
Beim ersten Checkpoint wird die Runde beendet???
public Bustimer(playerid)
{
new playercp = Busfahrer[playerid][bus_Checkpoint];
new route = Busfahrer[playerid][bus_Route];
if(IsPlayerInRangeOfPoint(playerid,2.5,Bus_Stationen[route][playercp][bus_x],Bus_Stationen[route][playercp][bus_y],Bus_Stationen[route][playercp][bus_z]))
{
if(Busfahrer[playerid][bust] > 0)
{
KillTimer(buswt[playerid]);
buswt[playerid] = SetTimerEx("Bustimer",1000,false,"i",playerid);
new string[20];
PlayerTextDrawHide(playerid,Textdraw0);
format(string,sizeof(string),"Haltestelle %d/10",Busfahrer[playerid][bust]);
PlayerTextDrawSetString(playerid,Textdraw0, string);
PlayerTextDrawShow(playerid,Textdraw0);
Busfahrer[playerid][bust] --;
return 1;
}
else
{
if(playercp == sizeof(Bus_Stationen[])-1)
{
DisablePlayerCheckpoint(playerid);
KillTimer(buswt[playerid]);
PlayerTextDrawHide(playerid,Textdraw0);
new veh = GetPlayerVehicleID(playerid);
SetVehicleToRespawn(veh);
if(route == 0)
{
new string[128],skill = randomEx(1, 2);
format(string,sizeof(string),"Du hast deine Route beendet, 1750€ und %d Bus-EXP erzhalten!",skill);
SendClientMessage(playerid,0x33CCFFAA,string);
GivePlayerMoney(playerid, 1750);
Busfahrer[playerid][bus_Aktiv]=false;
sInfo[playerid][busskill] += skill;
Checkbuslevel(playerid);
return 1;
}
else if(route == 1)
{
new string[128],skill = randomEx(1, 3);
format(string,sizeof(string),"Du hast deine Route beendet, 2750€ und %d Bus-EXP erhalten!",skill);
SendClientMessage(playerid,0x33CCFFAA,string);
GivePlayerMoney(playerid, 2750);
Busfahrer[playerid][bus_Aktiv]=false;
sInfo[playerid][busskill] += skill;
Checkbuslevel(playerid);
return 1;
}
}
else
{
DisablePlayerCheckpoint(playerid);
KillTimer(buswt[playerid]);
Busfahrer[playerid][bus_Checkpoint]++;
new playercp1 = Busfahrer[playerid][bus_Checkpoint];
PlayerTextDrawHide(playerid,Textdraw0);
SendClientMessage(playerid,0xFFFF00FF,"Auf zur nächsten Haltestelle!");
SetPlayerCheckpoint(playerid,Bus_Stationen[route][playercp1][bus_x],Bus_Stationen[route][playercp1][bus_y],Bus_Stationen[route][playercp1][bus_z],Bus_Stationen[route][playercp1][bus_g]);
Busfahrer[playerid][bust] = 10;
return 1;
}
}
}
else
{
KillTimer(buswt[playerid]);
buswt[playerid] = SetTimerEx("Bustimer",1000,false,"i",playerid);
Busfahrer[playerid][bust] = 10;
PlayerTextDrawHide(playerid,Textdraw0);
return 1;
}
return 1;
} -
Wie hast du denn die Positionen der Checkpoints im Array stehen? Poste das Array mit Daten mal.
-
so
enum Buscords
{
Float:bc_x,
Float:bc_y,
Float:bc_z,
Float:bc_rad
}new Bus_Stationen[][][Buscords] =
{
{
{0.0,0.0,0.0,4.0},
{0.0,0.0,0.0,4.0},
{0.0,0.0,0.0,4.0},
{0.0,0.0,0.0,4.0},
{0.0,0.0,0.0,4.0},
{0.0,0.0,0.0,4.0},
{0.0,0.0,0.0,4.0},
{0.0,0.0,0.0,4.0},
{0.0,0.0,0.0,4.0},
{0.0,0.0,0.0,4.0}
},
{
{0.0,0.0,0.0,4.0},
{0.0,0.0,0.0,4.0},
{0.0,0.0,0.0,4.0},
{0.0,0.0,0.0,4.0},
{0.0,0.0,0.0,4.0},
{0.0,0.0,0.0,4.0},
{0.0,0.0,0.0,4.0},
{0.0,0.0,0.0,4.0},
{0.0,0.0,0.0,4.0},
{0.0,0.0,0.0,4.0}
}
}; -
Beitrag von justRevitox ()
Dieser Beitrag wurde gelöscht, Informationen über den Löschvorgang sind nicht verfügbar. -
Ändere mal
if(Busfahrer[playerid][bust] > 0)
zu:
if(Busfahrer[playerid][bust] < 9)und:
Busfahrer[playerid][bust] --;
zu:
Busfahrer[playerid][bust] ++;
Und setze es vor das format. -
-
Eigentlich passt es dann.
Schreibe es so, und poste dann was im Server Log steht:
public Bustimer(playerid)
{
new playercp = Busfahrer[playerid][bus_Checkpoint];
new route = Busfahrer[playerid][bus_Route];
printf("BusTimer: %d", playerid);
if(IsPlayerInRangeOfPoint(playerid,2.5,Bus_Stationen[route][playercp][bus_x],Bus_Stationen[route][playercp][bus_y],Bus_Stationen[route][playercp][bus_z]))
{
printf("InRange: %d", Busfahrer[playerid][bust]);
if(Busfahrer[playerid][bust] > 0)
{
KillTimer(buswt[playerid]);
buswt[playerid] = SetTimerEx("Bustimer",1000,false,"i",playerid);
new string[20];
PlayerTextDrawHide(playerid,Textdraw0);
format(string,sizeof(string),"Haltestelle %d/10",Busfahrer[playerid][bust]);
PlayerTextDrawSetString(playerid,Textdraw0, string);
PlayerTextDrawShow(playerid,Textdraw0);
Busfahrer[playerid][bust] --;
return 1;
}
else
{
printf("playercp: %d | sizeof-1: %d", playercp, sizeof(Bus_Stationen[])-1);
if(playercp == sizeof(Bus_Stationen[])-1)
{
printf("Route beendet.");
DisablePlayerCheckpoint(playerid);
KillTimer(buswt[playerid]);
PlayerTextDrawHide(playerid,Textdraw0);
new veh = GetPlayerVehicleID(playerid);
SetVehicleToRespawn(veh);
if(route == 0)
{
new string[128],skill = randomEx(1, 2);
format(string,sizeof(string),"Du hast deine Route beendet, 1750€ und %d Bus-EXP erzhalten!",skill);
SendClientMessage(playerid,0x33CCFFAA,string);
GivePlayerMoney(playerid, 1750);
Busfahrer[playerid][bus_Aktiv]=false;
sInfo[playerid][busskill] += skill;
Checkbuslevel(playerid);
return 1;
}
else if(route == 1)
{
new string[128],skill = randomEx(1, 3);
format(string,sizeof(string),"Du hast deine Route beendet, 2750€ und %d Bus-EXP erhalten!",skill);
SendClientMessage(playerid,0x33CCFFAA,string);
GivePlayerMoney(playerid, 2750);
Busfahrer[playerid][bus_Aktiv]=false;
sInfo[playerid][busskill] += skill;
Checkbuslevel(playerid);
return 1;
}
}
else
{
printf("Nächster CP.");
DisablePlayerCheckpoint(playerid);
KillTimer(buswt[playerid]);
Busfahrer[playerid][bus_Checkpoint]++;
new playercp1 = Busfahrer[playerid][bus_Checkpoint];
PlayerTextDrawHide(playerid,Textdraw0);
SendClientMessage(playerid,0xFFFF00FF,"Auf zur nächsten Haltestelle!");
SetPlayerCheckpoint(playerid,Bus_Stationen[route][playercp1][bus_x],Bus_Stationen[route][playercp1][bus_y],Bus_Stationen[route][playercp1][bus_z],Bus_Stationen[route][playercp1][bus_g]);
Busfahrer[playerid][bust] = 10;
return 1;
}
}
}
else
{
KillTimer(buswt[playerid]);
buswt[playerid] = SetTimerEx("Bustimer",1000,false,"i",playerid);
Busfahrer[playerid][bust] = 10;
PlayerTextDrawHide(playerid,Textdraw0);
return 1;
}
return 1;
} -
-
Ich habs so gemacht, halt als Bauer , und funktioniert:
enum BauernCPDaten {
Float:bCP_X,
Float:bCP_Y,
Float:bCP_Z
}
new BauernCP[][BauernCPDaten] = {
{20.4214,62.7821,4.0922},
{-10.8430,-8.3040,4.0942},
{-37.7827,-82.3471,4.0944},
{-25.6119,-91.4447,4.0945},
{25.8801,35.8845,4.0945},
{42.0253,43.7315,3.4804},
{5.0298,-44.1023,4.0918},
{-12.0191,-89.1497,4.0932},
{3.7829,-106.2996,2.7385},
{45.7055,7.3281,3.4091},
{64.6364,30.4883,1.6147},
{31.3213,-59.0014,3.0735},
{20.6863,-88.6571,2.4700},
{40.1048,-101.5151,1.5939},
{65.4498,-30.4873,1.7795},
{75.5787,22.4513,1.5867},
{-132.4013,49.3706,4.0941},
{-181.2694,-75.5866,4.0944},
{-231.7830,-73.5467,4.0945},
{-270.0512,-52.6578,4.0857},
{-251.5576,28.0954,3.1874},
{-233.3778,81.1003,3.1378},
{-203.7975,158.2948,6.7198}
};
command(farmen, playerid, params[]) {
if(SpielerInfo[playerid][pJob] != 2) return SendClientMessage(playerid, COLOR_RED, "Du bist kein Farmer");
if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_RED, "Du bist in keinen Farmer-Fahrzeug");
if(IsBAUERNCAR(GetPlayerVehicleID(playerid))==0)return SendClientMessage(playerid, COLOR_RED, "Du bist in keinen Farmer-Fahrzeug2");
if(Job_Farmer[playerid] == 1) return SendClientMessage(playerid, COLOR_RED, "Du farmst bereits. Um aufzuhören verwende /stopfarmen");
Job_Farmer[playerid] = 1;
SendClientMessage(playerid, 0x009BFFFF, "Fahre nun die Checkpoins ab");
Job_Farmer_CP[playerid] = 0;
SetPlayerCheckpoint(playerid,BauernCP[0][bCP_X],BauernCP[0][bCP_Y],BauernCP[0][bCP_Z], 10.0);
return 1;
}
public OnPlayerEnterCheckpoint(playerid)
{
new str[200], ok[200];
if(Job_Farmer[playerid] == 1) {
if(IsPlayerInRangeOfPoint(playerid, 10, BauernCP[Job_Farmer_CP[playerid]][bCP_X], BauernCP[Job_Farmer_CP[playerid]][bCP_Y], BauernCP[Job_Farmer_CP[playerid]][bCP_Z])) {
Job_Farmer_CP[playerid]++;
if(Job_Farmer_CP[playerid] >= sizeof(BauernCP)) {
new v = GetPlayerVehicleID(playerid);
RemovePlayerFromVehicle(playerid);
SetVehicleToRespawn(v);
SpielerInfo[playerid][pGeld] += 200;
Job_Farmer_CP[playerid] = 0;
Job_Farmer[playerid] = 0;
SendClientMessage(playerid, 0x00FFE6FF, "Die Ernte war erfolgreich!");
SendClientMessage(playerid, 0x00FFE6FF, "Für deine Arbeit erhälst du 200$");
DisablePlayerCheckpoint(playerid);
return 1;
} else {
format(str, sizeof(str), "[FARMEN] %i / %i Punkte", Job_Farmer_CP[playerid], sizeof(BauernCP));
SendClientMessage(playerid, 0xEBFF00FF, str);
SetPlayerCheckpoint(playerid, BauernCP[Job_Farmer_CP[playerid]][bCP_X], BauernCP[Job_Farmer_CP[playerid]][bCP_Y], BauernCP[Job_Farmer_CP[playerid]][bCP_Z], 10.0);
return 1;
}
}
}
DisablePlayerCheckpoint(playerid);
return 1;
} -
breadfish.de
Hat das Thema geschlossen.