21.04.2013, 16:53
I have this function set up to a tiimer to actively scan if the player is in a given checkpoint, problem is, it always returns 0, even though I use the same coordinates for a command that requires that space and that works fine. The value that's passed through the timer and into the function isn't being read either. Any ideas?
The command "/robauto" works as it should, it executes when you're in given checkpoint and doesn't if you aren't. What's up? Also the countdownfrom doesn't stay over. Forgive me for the sloppyness, I kinda tore it up trying to fix it :L
pawn Код:
new robberytimers[MAX_PLAYERS];
new PlayerText:CountDown[MAX_PLAYERS];
//blah blah blah
dcmd_robauto(playerid, params[])
{
//if(strlen(params)) return SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/robauto\"");
if(IsPlayerInRangeOfPoint(playerid, 3.0, 2200.2834, 1393.2366, 10.8203))
{
if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER && GetPlayerState(playerid) != PLAYER_STATE_PASSENGER)
{
if(autoRobTime[playerid] < gettime())
{
//SetTimerEx("IsInCheckPointe", 1000, true, %d, %d, %d, %d, %d, playerid, 2200.2834, 1393.2366, 10.8203, 3);
autoRobTime[playerid] = gettime()+ 120;
robbingauto(playerid, 30);
//new moneywon = random(30000)+30000;
//robskill[playerid]++;
//SetPlayerScore(playerid, GetPlayerScore(playerid)+1);
//GivePlayerMoney(playerid, moneywon);
//format(robskillstring, sizeof(robskillstring), "You're robskill is now: %i, and you've stolen $%i.", robskill[playerid], moneywon);
//SendClientMessage(playerid, 0xAAAAAAAA, robskillstring);
//SetPlayerWantedLevel(playerid, GetPlayerWantedLevel(playerid)+ 4);
} else {
SendClientMessage(playerid,0xAAAAAAAA, "You've just robbed the place; there is no more cash");
}
} else {
SendClientMessage(playerid, 0xAAAAAAAA, "Robbing the place in a vehicle is proving to be too hard..Try getting out and trying again.");
}
} else {
SendClientMessage(playerid, 0xAAAAAAAA, "You must be at an AutoBahn to rob it silly!");
}
return 1;
}
/ blah blah blah
forward robbingauto(playerid, countdownfrom);
public robbingauto(playerid, countdownfrom)
{
new stringah[5];
format(stringah, 5, "%i", countdownfrom);
CountDown[playerid] = CreatePlayerTextDraw(playerid, 250.0, 250.0, stringah);
PlayerTextDrawFont(playerid, CountDown[playerid], 3);
PlayerTextDrawLetterSize(playerid, CountDown[playerid], 0.499999,1.600000);
PlayerTextDrawColor(playerid, CountDown[playerid], 0xffffffff);
PlayerTextDrawShow(playerid, CountDown[playerid]);
printf("String: %i Playerid: %i CountDown: %i", countdownfrom, playerid, CountDown[playerid]);
robberytimers[playerid] = SetTimerEx("setcounter", 1000, true, "i", "i", playerid, countdownfrom);
}
/bla h blah blah
forward setcounter(playerid, countdownfrom);
public setcounter(playerid, countdownfrom)
{
new counters[57];
if(IsPlayerInRangeOfPoint(playerid, 3.0, 2200.2834, 1393.2366, 10.8203))
{
format(counters, 57, "%i", countdownfrom);
countdownfrom--;
PlayerTextDrawSetString(playerid, CountDown[playerid], counters);
if(countdownfrom <= 0)
{
GivePlayerMoney(playerid, 50000);
PlayerTextDrawDestroy(playerid, CountDown[playerid]);
KillTimer(robberytimers[playerid]);
}
} else {
SendClientMessage(playerid, 0xFF0000AA, "Robbery Failed");
PlayerTextDrawDestroy(playerid, CountDown[playerid]);
KillTimer(robberytimers[playerid]);
}
}