Die Rob-Sperre wird zwar gesetzt, aber ich kann unendlich mal den Bot ausrauben.
C
void BotTimer()
{
for(new playerid = 0; playerid < MAX_PLAYERS; playerid++)
{
new playerTargetActor = GetPlayerTargetActor(playerid);
for(new i = 0; i < sizeof(RobBot); i++)
{
if(RobBot[i][RobSperre] > 0)
{
RobBot[i][RobSperre]--;
}
if(playerTargetActor == RobBot[i][rob_ID] && DM[playerid][7] == 2)
{
new playerWeapon = GetPlayerWeapon(playerid);
new keys, updown, leftright;
GetPlayerKeys(playerid, keys, updown, leftright);
if(!ActorHandsup[RobBot[i][rob_ID]] && playerWeapon >= 22 && playerWeapon <= 42 && keys & KEY_AIM)
{
if(RobBot[i][RobSperre] > 0 && IsRobbing[playerid] == false)
{
new Sperre[256];
format(Sperre, sizeof(Sperre), "Dieses Geschäft kann erst wieder in %02d:%02d ausgeraubt werden.", RobBot[i][RobSperre]/60, RobBot[i][RobSperre]%60);
SendClientMessage(playerid, COLOR_RED, Sperre);
return 1;
}
ApplyActorAnimation(RobBot[i][rob_ID], "SHOP", "SHP_HandsUp_Scr",4.1,0,0,0,1,0);
ActorHandsup[RobBot[i][rob_ID]] = true;
//ab hier startet der ROb
RobBot[i][RobSperre] = 60;
IsRobbing[playerid] = true;
RobbedBot[playerid] = playerTargetActor;
RobSek[playerid] = random(10)+30;
Rob_Timer[playerid] = SetTimerEx("RobTimer", 1000, true, "i", playerid);
}
}
else if(playerTargetActor != RobBot[i][rob_ID] && DM[playerid][7] == 2 && IsRobbing[playerid] == true)
{
//nicht anvisiert
IsRobbing[playerid] = false;
KillTimer(Rob_Timer[playerid]);
new string[128];
format(string, sizeof(string), "Du hast %d$ ausgeraubt.", RobMoney[playerid]);
SendClientMessage(playerid, COLOR_LIGHTBLUE,string);
RobMoney[playerid] = 0;
RobbedBot[playerid] = -1;
ActorHandsup[RobBot[i][rob_ID]] = false;
ClearActorAnimations(RobBot[i][rob_ID]);
}
}
}
return 1;
}
Alles anzeigen