02.04.2014, 13:42
(
Последний раз редактировалось vassilis; 27.01.2015 в 04:14.
)
solved
CMD:robpizza(playerid,params[])
{
if(gteam[playerid] == TEAM_CIV)return SendClientMessage(playerid,COLOR_RED,"(Error): You must be civilian to use this command!");
if(IsPlayerInRangeOfPoint(playerid, 2.0,373.825653,-117.270904,1001.499511))return ErrorMessages(playerid,4);
if(alreadyrobbed[playerid] == 0)return SendClientMessage(playerid,COLOR_RED,"(Error): You have already robbed the shop!Try Later!");
if(isrobbing[playerid] == 0)
{
isrobbing[playerid] = 1;
new string[190],string2[160],gname[MAX_PLAYER_NAME], gmoney = random(6000);
GetPlayerName(playerid,gname,sizeof(gname));
alreadyrobbed[playerid] = 1;
GivePlayerMoney(playerid,gmoney);
pinfo[playerid][Money] = pinfo[playerid][Money]+gmoney;
IncreasePlayerWantedLevel(playerid,4);
SetTimerEx("PizzaRob",60000,false,"i",playerid);
format(string2,sizeof(string2),"Succeed: You have robbed Pizza Stack Shop and earned %d from the robbery!!Cops will be around!",gmoney);
SendClientMessage(playerid,COLOR_GREEN,string2);
pinfo[playerid][TotalRobs]++;
format(string,sizeof(string),"WARNING: %s player has robbed Pizza Stack and earned %d from the robbery!!Please respond immediately",gname,gmoney);
SendCopMessage(string);
}
return 1;
}
public PizzaRob(playerid)
{
alreadyrobbed[playerid] = 0;
return 1;
}
there is some problem with barckets i think its really confusing use like this and try --
pawn Код:
|
CMD:robpizza(playerid,params[])
{
if(gteam[playerid] != TEAM_CIV)
{
if(IsPlayerInRangeOfPoint(playerid, 2.0,373.825653,-117.270904,1001.499511))
{
if(alreadyrobbed[playerid] == 0)
{
if(isrobbing[playerid] == 0)
{
isrobbing[playerid] = 1;
new string[190],string2[160],gname[MAX_PLAYER_NAME], gmoney = random(6000);
GetPlayerName(playerid,gname,sizeof(gname));
alreadyrobbed[playerid] = 1;
GivePlayerMoney(playerid,gmoney);
pinfo[playerid][Money] = pinfo[playerid][Money]+gmoney;
IncreasePlayerWantedLevel(playerid,4);
SetTimerEx("PizzaRob",60000,false,"i",playerid);
format(string2,sizeof(string2),"Succeed: You have robbed Pizza Stack Shop and earned %d from the robbery!!Cops will be around!",gmoney);
SendClientMessage(playerid,COLOR_GREEN,string2);
pinfo[playerid][TotalRobs]++;
format(string,sizeof(string),"WARNING: %s player has robbed Pizza Stack and earned %d from the robbery!!Please respond immediately",gname,gmoney);
SendCopMessage(string);
}
else
{
SendClientMessage(playerid,COLOR_RED,"(Error): You have already robbed the shop!Try Later!");
}
}
else
{
ErrorMessages(playerid,4);
}
}
else
{
SendClientMessage(playerid,COLOR_RED,"(Error): You must be civilian to use this command!");
}
}
return 1;
}
public PizzaRob(playerid)
{
alreadyrobbed[playerid] = 0;
return 1;
}
Hello, ive seen some problems with ur brackates;
So use this pawn Код:
|
isrobbing[playerid]
TEAM_CIV
Defined on top? If yes, Then check for spellings. |
change it to this
pawn Код:
|
new AlredyRob[MAX_PLAYERS];
GetPlayerName(playerid,gname,sizeof(gname));
AlreadyRobbed[playerid] = 1;
I lend the topic a bit:
Is it enough to have: pawn Код:
And on OnPlayerSpawn blabla AlreadyRobbed[playerid] = 0; I mean to prevent a player from robbing again.. ? I also need this solution. |
No you need a timer for that... not onplayerspawn callback make a timer of how many second you want the player to rob it again and put the alreadyrobbed[playerid] = 0; value inside it. so player can rob store again
|