10.12.2012, 18:07
Hey..
I'm trying to make a /robammu so you will be able to rob weapons from ammunation but as soon as i type the cmd i crash. I get no errors in pawno but when im testing it ingame i keep crashing so please help me!
and here is the public shit
I'm trying to make a /robammu so you will be able to rob weapons from ammunation but as soon as i type the cmd i crash. I get no errors in pawno but when im testing it ingame i keep crashing so please help me!
pawn Код:
if(strcmp(cmd, "/robammu", true) == 0)
{
new success = random(2);
if(AmmuRobbedRecently == 1)
{
SendClientMessage(playerid, COLOR_GREY, "* This Location Was Robbed Recently, Try Again Later");
return 1;
}
if(PlayerInfo[playerid][pRobTime] >= 1)
{
SendClientMessage(playerid, COLOR_GREY, "* You already attempted or robbed a place recently, please wait.");
return 1;
}
if(IsPlayerInRangeOfPoint(playerid, 10, 314.2548,-133.6627,999.6016) || IsPlayerInRangeOfPoint(playerid, 3,311.9589,-166.1407,999.6010))
{
if(GetPlayerWeapon(playerid) >= 24 && GetPlayerWeapon(playerid) <= 40)
{
if(PlayerInfo[playerid][pDuty] == 0)
{
if(success == 1)
{
SendClientMessage(playerid, COLOR_ORANGE, "* You are now Robbing the Ammunation, please remain in the checkpoint for 290 Seconds!");
RobbingTime[playerid] = 95;
RobAmmuTimer = SetTimerEx("RobAmmu",3000,true,"i",playerid);
WantedPoints[playerid] = 5;
SetPlayerCriminal(playerid,255, "Robbing Ammunation");
PlayerInfo[playerid][pRobTime] = 3600;
AmmuRobbedRecently = 1;
SetTimer("UnsetAmmuRob",1500000,false);
OnePlayAnim(playerid, "SHOP", "ROB_Shifty", 4.0, 0, 0, 0, 0, 0); // Rob Lookout
}
else
{
SendClientMessage(playerid, COLOR_ORANGE, "* You failed to rob ammunation!");
WantedPoints[playerid] = 2;
SetPlayerCriminal(playerid,255, "Attempting to rob Ammunation");
PlayerInfo[playerid][pRobTime] = 3600;
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, "* Go Off duty first!");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, "* You need a deadly weapon to perform this Act!");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, "* You're not at Ammunation's Rob Point!");
return 1;
}
return 1;
}
pawn Код:
public RobAmmu(playerid)
{
new string[128];
if(IsPlayerInRangeOfPoint(playerid, 10, 314.2548,-133.6627,999.6016) || IsPlayerInRangeOfPoint(playerid, 3,311.9589,-166.1407,999.6010))
{
if(RobbingTime[playerid] > 0)
{
RobbingTime[playerid] --;
GameTextForPlayer(playerid, "~w~Remain in the ~r~Pickup ~w~~until the time ends!", 1000,4);
}
else
{
RobbingTime[playerid] = 0;
KillTimer(RobAmmuTimer);
new gun = random;
new ammo = 500;
SafeGivePlayerWeapon(playerid, gun, ammo);
format(string, sizeof(string),"~w~You Robbed ~g~%s ~w~From ~y~Ammunation!", gun);
GameTextForPlayer(playerid, string, 6000, 4);
format(string, sizeof(string),"* You robbed %s From Ammunation!",gun);
SendClientMessage(playerid, COLOR_GREY, string);
WantedPoints[playerid] = 10;
SetPlayerCriminal(playerid,255, "Robbing Ammunation");
}
}
else
{
GameTextForPlayer(playerid, "~w~You Left The Checkpoint!", 1000,4);
RobbingTime[playerid] = 0;
KillTimer(RobAmmuTimer);
}
}