05.07.2013, 13:46
Try this:
pawn Код:
CMD:rob(playerid,params[])
{
for(new i=0; i<MAX_PICK; i++)
{
if(IsPlayerInRangeOfPoint(playerid,2,PickInfo[i][pX], PickInfo[i][pY], PickInfo[i][pZ]) && GetPlayerVirtualWorld(playerid) == PickInfo[i][pVw] && GetPlayerInterior(playerid) == PickInfo[i][pInt])
{
ApplyAnimation(playerid, "ROB_BANK", "CAT_SAFE_ROB", 4.0, 1, 0, 0,0, 1);
rt[playerid] = SetTimerEx("robtimer", 1000, true, "i", playerid);
SetPVarFloat(playerid, "robX", PickInfo[i][pX]);
SetPVarFloat(playerid, "robY", PickInfo[i][pY]);
SetPVarFloat(playerid, "robZ", PickInfo[i][pZ]);
return 1;
}
}
return 1;
}
forward robtimer(playerid);
public robtimer(playerid)
{
if(IsPlayerInRangeOfPoint(playerid, 2.0, GetPVarFloat(playerid, "robX"), GetPVarFloat(playerid, "robY"), GetPVarFloat(playerid, "robZ"))
{
CountDownVar--;
new str[128];
format(str, sizeof(str), "Count Down: %d",CountDownVar);
GameTextForPlayer(playerid,str,1000,6);
for(new i=0; i<MAX_PICK; i++)
{
if(CountDownVar == 0)
{
new rand = random(999);
GiveDrichMoney(playerid,rand);
format(str,128," %s has robbed %i",GetName(playerid),rand);
SCM(playerid,-1,str);
ClearAnimations(playerid);
KillTimer(rt);
CountDownVar = 15;
return 1;
}
}
}
else
{
SendClientMessage(playerid, 0xFF0000FF, "Robbery Failed");
KillTimer(rt[playerid]);
}
return 1;
}