08.06.2011, 14:48
I'm making a robbery system(and I had a great idea about it,originnaly,not coppied from other servers),but I'm having a pprblem,here's code:
Basically the problem is when I pickup the ICON for entering the shop it says I robbed the shop(and it does the stuff for the Money pickup),altough it should say it when the count down for robebry is done,but the Money pick up is not created.Can you see the problem?PLEASE HELP ME FAST!!!(no problems with bomb or explosion or enetring shop ONLY WITH MONEY PICKUP)
pawn Код:
new Money;
new countn;
new counttimer;
forward CountDownRobbers(playerid);
public OnPlayerPickUpPickup(playerid, pickupid)
{
if(pickupid == ewsp)
{
SetPlayerPos(playerid,373.825653,-117.270904,1001.499511);
SetPlayerInterior(playerid,5);
}
if(pickupid == Money)
{
SetPlayerScore(playerid,GetPlayerScore(playerid) + 2);
GivePlayerMoney(playerid,543);
new pName[MAX_PLAYER_NAME];
GetPlayerName(playerid,pName,sizeof(pName));
new string[128];
format(string,sizeof(string),"%s(%d) has robbed 543$ from Well Stacked Pizza shop",pName,playerid);
SendClientMessageToAll(COLOR_PURPLE,string);
}
return 1;
}
COMMAND:rob(playerid,params[])
{
if(gTeam[playerid] == TEAM_ROBBERS)
{
if(IsPlayerInRangeOfPoint(playerid,1.0,377.0883,-115.8647,1001.4922) || IsPlayerInRangeOfPoint(playerid,1.0,-2235.9595,128.4391,1035.4141) ||
IsPlayerInRangeOfPoint(playerid,1.0,379.6420,-8.8524,1001.8516) || IsPlayerInRangeOfPoint(playerid,1.0,378.3380,-65.0391,1001.5078) ||
IsPlayerInRangeOfPoint(playerid,1.0,161.4013,-79.2683,1001.8047) || IsPlayerInRangeOfPoint(playerid,1.0,-202.0584,-5.0931,1002.2734) ||
IsPlayerInRangeOfPoint(playerid,1.0,418.5518,-75.7314,1001.8047) || IsPlayerInRangeOfPoint(playerid,1.0,502.6806,-11.5208,1000.6797) ||
IsPlayerInRangeOfPoint(playerid,1.0,204.0275,-40.4131,1001.8047) || IsPlayerInRangeOfPoint(playerid,1.0,508.1718,-84.3275,998.9609) ||
IsPlayerInRangeOfPoint(playerid,1.0,207.9089,-97.6883,1005.2578) || IsPlayerInRangeOfPoint(playerid,1.0,202.6309,-12.2767,1001.2109) ||
IsPlayerInRangeOfPoint(playerid,1.0,380.7967,-8.8136,1001.8516))
{
new Float:x,Float:y,Float:z,Float:a,Float:X,Float:Y;
GetPlayerPos(playerid,x,y,z);
GetPlayerFacingAngle(playerid,a);
X = x + (1.1 * floatsin(-a,degrees));
Y = y + (1.1 * floatcos(-a,degrees));
BOMB = CreateObject(1252,X,Y,z + 0.1,0,0,0,30.0);
countn = 10;
counttimer = SetTimer("CountDownRobbers",1000,true);
}
if(GetPlayerInterior(playerid) == 0) return SendClientMessage(playerid,COLOR_FORESTGREEN,"This command can be used only on a shop");
}
if(gTeam[playerid] == TEAM_COPS || gTeam[playerid] == TEAM_MEDICS || gTeam[playerid] == TEAM_FIREFIGHTERS) return SendClientMessage(playerid,COLOR_RED,"This command is only for robbers");
return true;
}
public CountDownRobbers(playerid)
{
new string[128];
format(string, sizeof(string), " Stay away from bomb %d seconds to complete the robbery", countn);
GameTextForPlayer(playerid,string,10000,4);
countn--;
if(countn <= -1)
{
KillTimer(counttimer);
GameTextForPlayer(playerid,"The bomb has exploded pick up your money",2000,4);
DestroyObject(BOMB);
if(IsPlayerInRangeOfPoint(playerid,10.0,377.0883,-115.8647,1001.4922))
{
CreateExplosion(377.0883,-115.8647,1001.4922,1,5.0);
Money = CreatePickup(1212, 1, 377.0883, -115.8647, 1005.4922, 0);
}
}
return 1;
}