CMD:robpizza[+rep!!!]
#1

solved
Reply
#2

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)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;
}
Reply
#3

Quote:
Originally Posted by BroZeus
Посмотреть сообщение
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)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;
}
So if the player is civilian it will return an error message to player that he needs to be civilian to use this command... ? its actually the same.. Hmm let me try otherwise
Reply
#4

change it to this
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;
}
Reply
#5

TEAM_CIV

Defined on top? If yes, Then check for spellings.
Reply
#6

Quote:
Originally Posted by Ralfie
Посмотреть сообщение
Hello, ive seen some problems with ur brackates;
So use this
pawn Код:
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] == 1)
        return SendClientMessage(playerid,COLOR_RED,"(Error): You have already robbed the shop!Try Later!");
    if(isrobbing[playerid] == 1)
           return 1;
    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;
}
I found the solution thanks anyway man.. but the problem on the solution you gave is that
pawn Код:
isrobbing[playerid]
value don't mean to return 1; because if the player isrobbing it will return message that he is already robbing it.. anyway thanks for feedback
Quote:
Originally Posted by [vTc]Patroool
Посмотреть сообщение
TEAM_CIV

Defined on top? If yes, Then check for spellings.
I didn't say there are errors.. It compiles well and yes.. the team_civ is defined...
Quote:
Originally Posted by iThePunisher
Посмотреть сообщение
change it to this
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;
}
No just No.
I found the solution thanks all repped though for feedback
Reply
#7

I lend the topic a bit:

Is it enough to have:
pawn Код:
new AlredyRob[MAX_PLAYERS];

GetPlayerName(playerid,gname,sizeof(gname));
AlreadyRobbed[playerid] = 1;

And on OnPlayerSpawn blabla AlreadyRobbed[playerid] = 0;

I mean to prevent a player from robbing again..

?

I also need this solution.
Reply
#8

Quote:
Originally Posted by davve95
Посмотреть сообщение
I lend the topic a bit:

Is it enough to have:
pawn Код:
new AlredyRob[MAX_PLAYERS];

GetPlayerName(playerid,gname,sizeof(gname));
AlreadyRobbed[playerid] = 1;

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
Reply
#9

Quote:
Originally Posted by vassilis
Посмотреть сообщение
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
Yeah, didn't think about to make it possible to rob again.

Btw: Also read a bit bad xD.

But thanks a lot!.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)