Guten Abend,
ich habe nun einen Bug festgestellt, das ganz oft Payday auf einmal hintereinander kommt.
Ich verstehe echt überhaupt nicht warum?
Hier mal der Code:
public OnPlayerSpawn(playerid)
{
KillTimer(Paydaytimer[playerid]);
Paydaytimer[playerid] = SetTimerEx("PDMinuten",60000,1,"i",playerid);
return 1;
}
public Payday(playerid)
{
new hathaus,Mietethaus,hatbiz,rand,rand2,rand3,string1[200],string2[200],string3[200],string4[200],string5[200];
rand = random(500);
rand2 = random(1000);
rand3 = random(200);
for(new h;h<MAX_HOUSES;h++)
{
if (strcmp(SpielerName(playerid), HausInfo[h][hOwner], true) == 0 && GetPVarInt(playerid,"Housekey") != -1)
{
hathaus = 1;
}
if (strcmp(SpielerName(playerid), HausInfo[h][hOwner], false) == 0 && GetPVarInt(playerid,"Housekey") != -1)
{
Mietethaus = 1;
}
if (strcmp(SpielerName(playerid), HausInfo[h][hOwner], false) == 0 && GetPVarInt(playerid,"Housekey") == -1)
{
Mietethaus = 0;
hathaus = 0;
}
}
if(GetPVarInt(playerid,"Bizkey") != -1)
{
hatbiz = 1;
}
if(GetPVarInt(playerid,"Tankeninhaber") != -1)
{
hatbiz = 1;
}
new ha = GetPVarInt(playerid,"Housekey");
SendClientMessage(playerid,COLOR_RED,"___________________Zahltag___________________");
if(hathaus == 1)
{
format(string1,200,"Haus: Strom u. Wasserkosten: -%d$",rand);
SendClientMessage(playerid,COLOR_WHITE,string1);
SetPVarInt(playerid,"Bank",GetPVarInt(playerid,"Bank")-rand);
}
if(Mietethaus == 1)
{
format(string2,200,"Haus: Miete: -%d$",HausInfo[ha][hMiete]);
SendClientMessage(playerid,COLOR_WHITE,string2);
SetPVarInt(playerid,"Bank",GetPVarInt(playerid,"Bank")-HausInfo[ha][hMiete]);
}
if(hatbiz == 1)
{
format(string3,200,"Gewerbesteuer: -%d$",rand2);
SendClientMessage(playerid,COLOR_WHITE,string3);
SetPVarInt(playerid,"Bank",GetPVarInt(playerid,"Bank")-rand2);
}
format(string4,200,"Steuern: -%d",rand3);
SendClientMessage(playerid,COLOR_WHITE,string4);
SetPVarInt(playerid,"Bank",GetPVarInt(playerid,"Bank")-rand3);
if(GetPVarInt(playerid,"Fraktion") == 0)
{
SendClientMessage(playerid,COLOR_WHITE,"Arbeitlosengeld: +200$");
SetPVarInt(playerid,"Bank",GetPVarInt(playerid,"Bank")+200);
}
if(GetPVarInt(playerid,"Fraktion") != 0)
{
format(string5,200,"Berufsgehalt: +%d",GetPVarInt(playerid,"FGehalt"));
SendClientMessage(playerid,COLOR_WHITE,string5);
SetPVarInt(playerid,"Bank",GetPVarInt(playerid,"Bank")+GetPVarInt(playerid,"FGehalt"));
}
if(GetPVarInt(playerid,"HatAuto") >0)
{
SendClientMessage(playerid,COLOR_WHITE,"Fahrzeugsteuern: -200$");
GivePlayerMoney(playerid,-200);
}
SendClientMessage(playerid,COLOR_RED,"______________________________________________");
SetPVarInt(playerid,"PDTime",120);
Paydaytimer[playerid] = SetTimerEx("PDMinuten",60000,1,"i",playerid);
if(GetPVarInt(playerid,"Bank")<0)
{
SendClientMessage(playerid,COLOR_RED,"Bank: Ihr Konto ist wegen nicht ausreichender Kontodeckung verschuldet, demnächst kommt, dass du diese in Zinsen zurrück bezahlen musst!");
}
return 1;
}
public PDMinuten(playerid)
{
if(GetPVarInt(playerid,"PDTime") >0)
{
SetPVarInt(playerid,"PDTime",GetPVarInt(playerid,"PDTime")-1);
}
else
{
Payday(playerid);
}
return 1;
}
Hoffe jemand weis Rat.
Danke
MfG