/robbank Restarts the server
#1

Ok, so i made a /robbank command. Now I've defined everything and etc. but there's a problem. Right after they do /robbank and it says Government Announcement, the server restarts. :/
So what did I do wrong?

Here's the command code:

Код:
if(strcmp(cmdtext, "/robbank", true) == 0)
    {
    new suspect = GetClosestPlayer(playerid);
    if(IsPlayerConnected(suspect))
    {
  	if(GetDistanceBetweenPlayers(playerid,suspect) < 5)
    {
	if (!PlayerToPoint(100, playerid, 2313.2744,-7.2386,26.7422))
	{
	SendClientMessage(playerid, COLOR_GREY, "You are not around the bank!");
	return 1;
	}
	if(robtime > 1)
	{
	format(string, sizeof(string), "The Bank has recently been robbed please wait [%d]", robtime);
	SendClientMessage(playerid,COLOR_YELLOW,string);
	return 1;
	}
	if (robbed == 1)
	{
	SendClientMessage(playerid, COLOR_YELLOW, "someone is already attempting to rob the bank please wait.");
	return 1;
	}
    if(PlayerInfo[playerid][pFMember] == 255)
    {
    SendClientMessage(playerid,COLOR_GREY,"You are not in a gang !");
  	return 1;
	}
	if(PlayerInfo[playerid][pMember] == 1)
    {
    SendClientMessage(playerid,COLOR_GREY,"You are not in a gang !");
  	return 1;
	}
	if(gTeam[playerid] == 2 || IsACop(playerid))
	{
	SendClientMessage(playerid, COLOR_GREY, "Cops cannot rob the bank it is a crime");
	return 1;
	}
	if (playerrobbing[playerid] == 1)
	{
	SendClientMessage(playerid, COLOR_YELLOW, "You are already attempting to rob the bank please wait.");
	return 1;
	}
    if(PlayerInfo[suspect][pMember] != PlayerInfo[playerid][pMember])
    {
    SendClientMessage(playerid, COLOR_YELLOW, "You must robbank with another member");
    return 1;
    }
    if (GetPlayerWeapon(playerid) <= 1)
	{
	SendClientMessage(playerid, COLOR_GREY, "You must equip your weapon");
	return 1;
	}
    SendClientMessageToAll(COLOR_WHITE, "|_____________ Government News Announcement _____________|");
    SendClientMessageToAll(COLOR_DBLUE, " The Los Santos Bank is being robbed money will be stolen");
    SendClientMessageToAll(COLOR_DBLUE, " in about 10 MINUTES LSPD please respond.");
    SendClientMessage(playerid,COLOR_WHITE,"Stay in this area for 10 minutes");
    SendFamilyMessage(1,COLOR_RED, "The Los Santos Bank is attempting to get robbed.");
    SendFamilyMessage(PlayerInfo[playerid][pMember],COLOR_LIGHTBLUE, string);
    robbed = 1;
    SetTimerEx("RobDone",600000, true, "i", playerid);
    playerrobbing[playerid] = 1;
    }
    else
    {
    SendClientMessage(playerid, COLOR_YELLOW, "You must robbank with another member");
    return 1;
    }
    }
    }
Reply
#2

Show us the RobDone callback.
Reply
#3

Код:
public RobDone(playerid)
{

	new string[255];
	new tmp[256];
  new family;
  new cashdeposit = strval(tmp);
  playerrobbing[playerid] = 0;

  for(new i = 0; i < MAX_PLAYERS; i++)
  {
  if (PlayerToPoint(100, playerid, 2313.2744,-7.2386,26.7422)) {
  playerrobbing[playerid] = 0;
  playerrob[i] = 0;
  SendClientMessage(playerid, COLOR_WHITE, "You have succesfully robbed the bank.");
  SetPlayerCriminal(playerid,255, "Bank Robbery");
  SendClientMessageToAll(COLOR_WHITE, "|_____________ Government News Announcement _____________|");
  SendClientMessageToAll(COLOR_DBLUE, " The bank heist is over, the suspects left with the cash");
  SendFamilyMessage(1,COLOR_RED, "The Los Santos Bank has succesfully been robbed.");
  SendFamilyMessage(PlayerInfo[playerid][pMember],COLOR_LIGHTBLUE, string);
  SendFamilyMessage(PlayerInfo[playerid][pMember],COLOR_LIGHTBLUE, "Your gang receives $250000");
  FamilyInfo[family][FamilyCash] += 250000;
  FamilyInfo[family][FamilyCash] += cashdeposit;
  format(string, sizeof(string), " New Balance: $%d", FamilyInfo[family][FamilyCash]);
  SendClientMessage(playerid, COLOR_WHITE, string);
  SendFamilyMessage(family, COLOR_GREEN, "The Los Santos Bank has wired 250000 to your family safe !");
  robbed = 0;
  robtime = 30000;
  	felon[playerid] = 1;
	SetPlayerColor(playerid,0xFF800096);
  	return 1;
	}
	}

  if (!PlayerToPoint(100, playerid, 2313.2744,-7.2386,26.7422)) {
  SendClientMessageToAll(COLOR_WHITE, "|_____________ Government News Announcement _____________|");
  SendClientMessageToAll(COLOR_DBLUE, " The Los Santos Bank is clear, suspects cleaned up");
  SendFamilyMessage(1,COLOR_RED, "The Los Santos Bank has not been robbed.");
  SendFamilyMessage(PlayerInfo[playerid][pMember],COLOR_LIGHTBLUE, string);
  robbed = 0;
  playerrobbing[playerid] = 0;
  	return 1;
	}

	return 0;
}
Reply
#4

BUMP!
I'm having the same error...
If someone can post the Script or Filterscript, will help a lot of peoples...
Reply
#5

why u use that much if blabla { } {} {} { }...
just use the if and a return ex
if(somethingwron==1)return sendclientmessage
if(isnotinfamilyx == 1)return sendclientmessage
...
the code that will be executed after all if's are "ignored"... just a suggestion :P
Reply


Forum Jump:


Users browsing this thread: