26.09.2012, 22:23
pawn Код:
#include <a_samp>
#define COLOR_WHITE 0xFFFFFFAA
#define COLOR_ORANGE 0xFFA500AA
#define COLOR_GREY 0xAFAFAFAA
new robbing[MAX_PLAYERS];
new alreadyrobbed[MAX_PLAYERS];
forward bankrob(playerid);
forward robbedoff(playerid);
enum pInfo
{
pCash
};
new PlayerInfo[MAX_PLAYERS][pInfo];
public bankrob(playerid)
{
SendClientMessage(playerid, COLOR_WHITE, " Your finished robbing the bank, Run now");
GivePlayerMoney(playerid, 500000);
PlayerInfo[playerid][pCash] = PlayerInfo[playerid][pCash]+500000;
alreadyrobbed[playerid] = 1;
robbing[playerid] = 0;
SetTimerEx("robbedoff", 3600000, false, "i", playerid);
SendClientMessageToAll(COLOR_ORANGE, "||----------Latest News----------||");
SendClientMessageToAll(COLOR_WHITE, " It looks like the bankrobber got the cash.");
SendClientMessageToAll(COLOR_WHITE, " The cops is currently waiting outside.");
SendClientMessageToAll(COLOR_ORANGE, "||----------Latest News----------||");
return 1;
}
public robbedoff(playerid)
{
alreadyrobbed[playerid] = 0;
SendClientMessage(playerid, COLOR_WHITE, " You can now rob the bank again");
return 1;
}
public OnPlayerConnect(playerid)
{
robbing[playerid] = 0;
alreadyrobbed[playerid] = 0;
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmdtext, "/robbank", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(robbing[playerid] == 1)
{
SendClientMessage(playerid, COLOR_GREY, " You are already robbing the bank, please slow down");
return 1;
}
if(alreadyrobbed[playerid] == 1)
{
SendClientMessage(playerid, COLOR_WHITE, "You already robbed the bank! Wait 1 hour.");
return 1;
}
if(!IsPlayerInRangeOfPoint(playerid, 5.0, 2308.8071,-13.2485,26.7422)) return SendClientMessage(playerid, COLOR_GREY, " You are not at the bank !");
SendClientMessage(playerid, COLOR_WHITE, " You started to rob the bank, This will take 10 minutes");
SetTimerEx("bankrob", 600000, false, "i", playerid);
robbing[playerid] = 1;
SendClientMessageToAll(COLOR_ORANGE, "||----------Latest News----------||");
SendClientMessageToAll(COLOR_WHITE, " The bank is currently getting robbed.");
SendClientMessageToAll(COLOR_WHITE, " We are currently waiting for the cops");
SendClientMessageToAll(COLOR_WHITE, " We will report more when we get more information");
SendClientMessageToAll(COLOR_ORANGE, "||----------Latest News----------||");
return 1;
}
}
return 0;
}
Color defines were also added at the top of the script, and 'cmd' was changed to 'cmdtext'.
If you receive errors in your game mode relating to variables which have already been defined, remove the duplicates.