30.06.2009, 01:37
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:
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;
}
}
}

