Hey, wollte n kleines minijobsystem erstellen,
des funktioniert jedoch ned so wirklich...
Der erste checkpoint wird zwar angezeigt, aber der zweite nicht... somit auch die restlichen nicht...
woran liegt das ?
hier das ganze fs...
Code
#include <a_samp>
//Farben
#define GELB 0xFFFF00FF
#define ROT 0xFF000FFF
#define GRUEN 0x007600FF
enum minijob {
Float:M_fX,
Float:M_fY,
Float:M_fZ
}
new Muellabfuhr_Stationen[][minijob] = {
{-74.2252, -1128.7936, 1.6359},
{-89.2432, -1189.7782, 2.3241},
{-63.3734, -1588.5732, 3.1782},
{220.8943, -1393.5308, 52.1264},
{169.0361, -1356.8065, 69.8208},
{263.5524, -1341.0842, 53.7643},
{871.9646, -864.5255, 77.2742},
{935.7687, -835.7352, 94.4455},
{1496.5879, -698.0237, 94.5207},
{1001.1724, -935.0218, 41.9509},
{-546.9002, -488.6077, 25.2961}
};
public OnFilterScriptInit()
{
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/muelljob", cmdtext, true, 10) == 0)
{
if(GetPVarInt(playerid, "minijob")!=0) return SendClientMessage(playerid, ROT, "Du führst bereits einen Minijob aus.");
else {
new vehId = CreateVehicle(408, -70.6590,-1107.6780,1.5999, 180, 0, 1, -1);
SetVehicleNumberPlate(vehId, "Muellabfuhr");
PutPlayerInVehicle(playerid, vehId, 0);
SetPVarInt(playerid, "minijob", 1);
SetPVarInt(playerid, "minijobPoint", 0);
SendClientMessage(playerid, GRUEN, "Minijob gestartet, Verlasse das Fahrzeug nicht.");
SetPlayerCheckpoint(playerid,Muellabfuhr_Stationen[0][M_fX],Muellabfuhr_Stationen[0][M_fY],Muellabfuhr_Stationen[0][M_fZ],4.0);
}
}
return 0;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(GetPVarInt(playerid, "minijob")!=0 && oldstate & PLAYER_STATE_DRIVER) {
SendClientMessage(playerid, ROT, "Du hast den Job abgebrochen.");
DeletePVar(playerid, "minijob");
DeletePVar(playerid, "minijobpoint");
}
return 1;
}
public OnPlayerEnterCheckpoint(playerid) {
if(GetPVarInt(playerid, "minijob")==1) {
SetPVarInt(playerid, "minijobpoint", GetPVarInt(playerid, "minijobpoint")+1);
DisablePlayerCheckpoint(playerid);
if(GetVehicleModel(GetPlayerVehicleID(playerid))!=408) {
//printf("%s ist am Muellcheckpoint nichtmehr im Muellauto", SpielerName(playerid));
SendClientMessage(playerid, ROT, "Du bist nichtmehr im Müllauto, schlechter Buguser!");
DeletePVar(playerid, "minijob");
DeletePVar(playerid, "minijobpoint");
return 1;
}
else {
new playercp = GetPVarInt(playerid, "minijobpoint");
if(playercp == sizeof(Muellabfuhr_Stationen)) {
DeletePVar(playerid, "minijob");
DeletePVar(playerid, "minijobpoint");
GivePlayerMoney(playerid, 200);
DestroyVehicle(GetPlayerVehicleID(playerid));
return SendClientMessage(playerid, GRUEN, "Du hast die Route erfolgreich beendet und erhältst 200$");
//printf("%s beendet Minijob[Muellauto]", SpielerName(playerid));
}
else {
GivePlayerMoney(playerid, 20);
SetPlayerCheckpoint(playerid, Muellabfuhr_Stationen[playercp][M_fX], Muellabfuhr_Stationen[playercp][M_fY], Muellabfuhr_Stationen[playercp][M_fZ], 4.0);
return SendClientMessage(playerid, GRUEN, "Weiter so ! Du erhältst 20$");
//printf("%s ist am Muellcheckpoint angekommen.", SpielerName(playerid));
}
}
}
return 1;
}
Alles anzeigen