14.09.2012, 07:07
(
Последний раз редактировалось _Khaled_; 14.09.2012 в 16:59.
)
Hello guys,
these things I've tried hard in it but couldn't figure it out..
first) between robberies timers and a 15 seconds timer with gametext showing
Example for my robbery code.
second) Player stats saved every once and a while..
these things I've tried hard in it but couldn't figure it out..
first) between robberies timers and a 15 seconds timer with gametext showing
Example for my robbery code.
pawn Код:
if(listitem == 3) //Rob 24/7
{
new frand =random(10);
new mrand =random(16000);
if(gTeam[playerid] != TEAM_CIVIL)
{
SendClientMessage(playerid,COLOR_RED,"Law enforcement officers cannot rob anything.");
return 1;
}
if(frand <= 2)
{
if(WantedLevel ==0)
{
SendClientMessage(playerid, COLOR_RED, "You've attempted to rob 24/7 in old venturas strip (LV), but failed.");
GetPlayerName(playerid, pname, sizeof(pname));
SetPlayerWantedLevel(playerid, 3);
SetPlayerColor(playerid, COLOR_YELLOW);
format(string,sizeof(string), "[LAW ENFORCEMENT RADIO] %s(%d) has attempted to rob the 24/7 in Old Venturas Strip (LV).",pname, playerid);
SendCopMessage(COLOR_BLUE, string);
SendCIAMessage(COLOR_BLUE, string);
SendArmyMessage(COLOR_GREEN, string);
return 1;
}
if(WantedLevel ==3)
{
SendClientMessage(playerid, COLOR_RED, "You've attempted to rob 24/7 in old venturas strip (LV), but failed.");
GetPlayerName(playerid, pname, sizeof(pname));
SetPlayerWantedLevel(playerid, 6);
SetPlayerColor(playerid, COLOR_RED);
format(string,sizeof(string), "[LAW ENFORCEMENT RADIO] %s(%d) has attempted to rob the 24/7 in Old Venturas Strip (LV).",pname, playerid);
SendCopMessage(COLOR_BLUE, string);
SendCIAMessage(COLOR_BLUE, string);
SendArmyMessage(COLOR_GREEN, string);
return 1;
}
}
GivePlayerMoney(playerid, mrand);
GetPlayerName(playerid, pname, sizeof(pname));
format(string,sizeof(string), "You've successfully robbed the 24/7 in Old Venturas Strip (LV), and got away with $%d",mrand);
SendClientMessage(playerid,COLOR_GREEN, string);
SetPlayerColor(playerid, COLOR_RED);
SetPlayerWantedLevel(playerid, 6);
PlayerInfo[playerid][pRobberies] = PlayerInfo[playerid][pRobberies]+1;
IncreasePlayerScore(playerid,2);
GetPlayerName(playerid, pname, sizeof(pname));
format(string,sizeof(string), "[ROBBERY] {FFFFFF}%s(%d) {F81414}has robbed{FFFFFF} the 24/7{F81414 in {FFFFFF}Old Venturas Strip (LV),{F81414} and got away with {FFFFFF}$%d",pname, playerid, mrand);
SendClientMessageToAll(COLOR_RED, string);
GetPlayerName(playerid, pname, sizeof(pname));
format(string,sizeof(string), "[LAW ENFORCEMENT RADIO] %s(%d) has robbed the 24/7 in Old Venturas Strip (LV), and got away with $%d",pname, playerid, mrand);
SendCopMessage(COLOR_BLUE, string);
SendCIAMessage(COLOR_BLUE, string);
SendArmyMessage(COLOR_GREEN, string);
GetPlayerName(playerid,pname,MAX_PLAYER_NAME);
format(string,sizeof(string),"[ROBBERY] %s(%d) has robbed the 24/7 in Old Venturas Strip (LV), and got away with $%d",pname,playerid,mrand);
IRC_GroupSay(groupID,ADMIN_CHANNEL,string);
IRC_GroupSay(groupID,IRC_CHANNEL,string);
return 1;
}
pawn Код:
enum pInfo
{
pPass,
pCash,
pScore,
pAdminLevel,
pWantedLevel,
pArmy,
pArrests,
pRobberies,
pKills,
pDeaths,
pBanned
}
new PlayerInfo[MAX_PLAYERS][pInfo];
//======================================//
//Time system..
public time()
{
// HOURS
new hour,minute,second;
gettime(hour,minute,second);
new string[256];
new string2[256];
if (minute <= 9)
{
format(string,25,"%d:0%d",hour,minute);
}
else
{
format(string,25,"%d:%d",hour,minute);
}
// DATE
new day,month,year;
getdate(year,month,day);
if (day <= 9){
format(string2,25,"0%d/%d/%d",day,month,year);
}
else if (month <= 9 && day >= 9) {
format(string2,25,"%d/0%d/%d",day,month,year);
}
else
{
format(string2,25,"%d/%d/%d",day,month,year);
}
if (hour == 0){SetWorldTime(0);}
if (hour == 1){SetWorldTime(1);}
if (hour == 2){SetWorldTime(2);}
if (hour == 3){SetWorldTime(3);}
if (hour == 4){SetWorldTime(4);}
if (hour == 5){SetWorldTime(5);}
if (hour == 6){SetWorldTime(6);}
if (hour == 7){SetWorldTime(7);}
if (hour == 8){SetWorldTime(8);}
if (hour == 9){SetWorldTime(9);}
if (hour == 10){SetWorldTime(10);}
if (hour == 11){SetWorldTime(11);}
if (hour == 12){SetWorldTime(12);}
if (hour == 13){SetWorldTime(13);}
if (hour == 14){SetWorldTime(14);}
if (hour == 15){SetWorldTime(15);}
if (hour == 16){SetWorldTime(16);}
if (hour == 17){SetWorldTime(17);}
if (hour == 18){SetWorldTime(18);}
if (hour == 19){SetWorldTime(19);}
if (hour == 20){SetWorldTime(20);}
if (hour == 21){SetWorldTime(21);}
if (hour == 22){SetWorldTime(22);}
if (hour == 23){SetWorldTime(23);}
if (hour == 24){SetWorldTime(24);}
for(new i=0;i<MAX_PLAYERS;++i)
{
TextDrawHideForPlayer(i,Clock);
TextDrawHideForPlayer(i,Date);
TextDrawSetString(Clock,string);
TextDrawSetString(Date,string2);
TextDrawShowForPlayer(i,Clock);
TextDrawShowForPlayer(i,Date);
}
return 1;
}
//timer...
SetTimer("time", 60000, 1);