/bribe command help!
#1

here is my command in this there is not any bug, but i want to add a new syntax in it and other syntax's should be same.
just i want to add if i write /bribe (amount) it shoudl workd and send bribe of "amount" to nearest cop!

pawn Код:
COMMAND:bribe(playerid, params[])
{
    if (PlayerInfo[playerid][pDead] == 0)
    {
        if (PlayerInfo[playerid][pTeam] == TEAM_CIVILIAN && PlayerInfo[playerid][pVigilante] == 0)
        {
            new idx,TargetId,amount,string[256],tmp[256];
            tmp = strtok(params, idx);

            if (!strlen(tmp))
            {
                TargetId = GetClosestPlayer(playerid);

                if (TargetId == INVALID_PLAYER_ID || PlayerInfo[TargetId][pLevel] < 3)
                {
                    SendClientMessage(playerid, COLOR_ERROR, "No Police Officers Close Enough To Bribe.");
                    return 1;
                }
            }
            else
            {
                if (!isNumeric(tmp))
                {
                    TargetId = ReturnUser(playerid, tmp);
                    if (TargetId == INVALID_PLAYER_ID)
                    {
                        return 1;
                    }
                }
                else
                {
                    TargetId = strval(tmp);

                    if (!IsPlayerConnected(TargetId))
                    {
                        format(string, sizeof(string), "%d Is Not A Valid ID.", TargetId);
                        SendClientMessage(playerid, COLOR_ERROR, string);
                        return 1;
                    }
                }
            }

            tmp = strtok(params, idx);

            if (!strlen(tmp))
            {
                amount = 15000;
            }
            else
            {
                if (!isNumeric(tmp))
                {
                    SendClientMessage(playerid, COLOR_ERROR, "Invalid Amount - Enter A Numerical Character.");
                    return 1;
                }
                amount = strval(tmp);
            }

            //permissions durring doing missions needed.

            if (amount > 15000 || amount < 1000)
            {
                format(string, sizeof(string), "Invalid Amount $%d - Minimum Bribe : $1000 Maximum Bribe: $15000",amount);
                SendClientMessage(playerid,COLOR_ERROR, string);
                return 1;
            }

            if (TargetId == playerid)
            {
                SendClientMessage(playerid, COLOR_ERROR, "You Cannot Offer Yourself A Bribe.");
                return 1;
            }
            if (PlayerInfo[playerid][pWantedLevel] > 8)
            {
                SendClientMessage(playerid,COLOR_ERROR, "You Are On The List Of Most Wanted Suspects.  You Cannot Bribe The Police.");
                return 1;
            }

            if (PlayerInfo[TargetId][pSkill] != SKILL_COP && PlayerInfo[playerid][pVigilante] == 0)
            {
                format(string, sizeof(string), "%s Is Not A Police Officer.",PlayerInfo[TargetId][pName]);
                SendClientMessage(playerid,COLOR_ERROR, string);
                return 1;
            }

            if (GetDistanceBetweenPlayers(playerid,TargetId) > 5)
            {
                format(string, sizeof(string), "%s Is Too Far Away To Offer A Bribe To.",PlayerInfo[TargetId][pName]);
                SendClientMessage(playerid,COLOR_ERROR, string);
                return 1;
            }
            if (GetPlayerVirtualWorld(playerid) != GetPlayerVirtualWorld(TargetId))
            {
                SendClientMessage(playerid, COLOR_ERROR, "No Police Officers Close Enough To Bribe.");
                return 1;
            }

            if (PlayerInfo[TargetId][pDead] == 1)
            {
                format(string, sizeof(string), "%s Is Dead And Cannot Be Offered A Bribe.",PlayerInfo[TargetId][pName]);
                SendClientMessage(playerid,COLOR_ERROR, string);
                return 1;
            }

            if (PlayerInfo[TargetId][pAJailed] == 1)
            {
                format(string, sizeof(string), "%s (%i) Has Been Jailed And Cannot Be Offered a Bribe.",PlayerInfo[TargetId][pName],TargetId);
                SendClientMessage(playerid, COLOR_ERROR, string);
                return 1;
            }

            if (PlayerInfo[playerid][pBribeWaitTime] > 0)
            {
                SendClientMessage(playerid, COLOR_ERROR, "Please Wait Before Offering Another Bribe.");
                return 1;
            }


            if (PlayerInfo[playerid][pBribeOfferedTo] == TargetId)
            {
                format(string, sizeof(string), "You Have Already Offered A Bribe To %s",PlayerInfo[TargetId][pName]);
                SendClientMessage(playerid, COLOR_ERROR, string);
                return 1;
            }

            format(string, sizeof(string), "You Have Offered Officer %s (%d) A Bribe ($%d).  Wait To See If %s Will Accept.",PlayerInfo[TargetId][pName],TargetId,amount,SubjectGenderPronouns[PlayerInfo[TargetId][pGender]]);
            SendClientMessage(playerid, COLOR_SERVER_HELP_MSG, string);
            format(string, sizeof(string), "~w~BRIBE OFFERED TO OFFICER %s", PlayerInfo[TargetId][pName]);
            SendGameText(playerid, string, 3000, 3);

            format(string, sizeof(string), "%s (%d) Has Offered You A Bribe ($%d). Type /accept Or /refuse.",PlayerInfo[playerid][pName],playerid,amount);
            SendClientMessage(TargetId,COLOR_SERVER_HELP_MSG, string);
            format(string, sizeof(string), "~w~OFFERED A BRIBE BY %s~n~[$%d]~n~~y~TYPE /ACCEPT OR /REFUSE", PlayerInfo[playerid][pName],amount);
            SendGameText(TargetId, string, 3000, 3);


            PlayerInfo[playerid][pBribe] = amount;
            PlayerInfo[playerid][pBribeWaitTime] = 30;

            PlayerInfo[playerid][pBribeOfferedTo] = TargetId;
            PlayerInfo[TargetId][pBribeOfferedBy] = playerid;

            if (IsPlayerNPC(TargetId) && PlayerInfo[TargetId][pTeam] == TEAM_LAW)
            {
                if (amount < 10000)
                {
                    cmd_refuse(TargetId, " ");
                }
                else
                {
                    switch(random(5))
                    {
                        case 0, 1, 2, 3:
                        {
                        cmd_accept(TargetId, " ");
                        }

                        case 4, 5:
                        {
                        cmd_refuse(TargetId, " ");
                        }
                    }
                }
            }
        }
        else
        SendClientMessage(playerid, COLOR_ERROR, "Only Civilians Can Use This Command.");
    }
    else
    SendErrorMessage(playerid, 3);

    return 1;
}
Reply
#2

Please help me (i need this)
Reply
#3

What do you exactly need?
Reply
#4

you can use this

PHP код:
new Float:xFloat:yFloat:z;
GetPlayerPos(playeridxyz);
for(new 
0MAX_PLAYERSi++)
{
    if(
IsPlayerInRangeOfPoint(i3.0x,y,z))
    {
        
///// Code  i remplace trajetid
    
}

Reply
#5

i want if i only type /br (amount) it should work also!
Reply
#6

please help me i need this!
Reply
#7

That can be achieved by doing the following:

pawn Код:
COMMAND:br(playerid, params[]) return command_bribe(playerid, params);
Reply
#8

Quote:
Originally Posted by Bible
Посмотреть сообщение
That can be achieved by doing the following:

pawn Код:
COMMAND:br(playerid, params[]) return command_bribe(playerid, params);
aa, aa, sorry its my bad i typed /br i've already shortcut of that cmd. i want to add new methode in command.

in this command it works if i only type /br(ibe) or /br(ibe) (name) (amount), but i want to add another in thhis, and it is only /br(ibe) (amount)
Reply
#9

please?
Reply
#10

test
PHP код:
COMMAND:bribe(playeridparams[])
{
    if (
PlayerInfo[playerid][pDead] == 0)
    {
        if (
PlayerInfo[playerid][pTeam] == TEAM_CIVILIAN && PlayerInfo[playerid][pVigilante] == 0)
        {
            new 
idx,amount,string[256],tmp[256];
            new 
Float:xFloat:yFloat:z;
            
GetPlayerPos(playeridxyz);
            
            
tmp strtok(paramsidx);
            if (!
strlen(tmp))
            {
                
amount 15000;
            }
            else
            {
                if (!
isNumeric(tmp))
                {
                    
SendClientMessage(playeridCOLOR_ERROR"Invalid Amount - Enter A Numerical Character.");
                    return 
1;
                }
                
amount strval(tmp);
            }
            
//permissions durring doing missions needed.
            
if (amount 15000 || amount 1000)
            {
                
format(stringsizeof(string), "Invalid Amount $%d - Minimum Bribe : $1000 Maximum Bribe: $15000",amount);
                
SendClientMessage(playerid,COLOR_ERRORstring);
                return 
1;
            }
            if (
PlayerInfo[playerid][pWantedLevel] > 8)
            {
                
SendClientMessage(playerid,COLOR_ERROR"You Are On The List Of Most Wanted Suspects.  You Cannot Bribe The Police.");
                return 
1;
            }
            if (
PlayerInfo[playerid][pBribeWaitTime] > 0)
            {
                
SendClientMessage(playeridCOLOR_ERROR"Please Wait Before Offering Another Bribe.");
                return 
1;
            }
            
            for(new 
0MAX_PLAYERSi++)
            {
                if (
PlayerInfo[i][pSkill] != SKILL_COP && PlayerInfo[playerid][pVigilante] == 0)
                {
                    
format(stringsizeof(string), "%s Is Not A Police Officer.",PlayerInfo[TargetId][pName]);
                    
SendClientMessage(playerid,COLOR_ERRORstring);
                    return 
1;
                }
                if(
IsPlayerInRangeOfPoint(i3.0x,y,z))
                {
                    
format(stringsizeof(string), "You Have Offered Officer %s (%d) A Bribe ($%d).  Wait To See If %s Will Accept.",PlayerInfo[i][pName],i,amount,SubjectGenderPronouns[PlayerInfo[i][pGender]]);
                    
SendClientMessage(playeridCOLOR_SERVER_HELP_MSGstring);
                    
format(stringsizeof(string), "~w~BRIBE OFFERED TO OFFICER %s"PlayerInfo[i][pName]);
                    
SendGameText(playeridstring30003);
                    
format(stringsizeof(string), "%s (%d) Has Offered You A Bribe ($%d). Type /accept Or /refuse.",PlayerInfo[playerid][pName],playerid,amount);
                    
SendClientMessage(i,COLOR_SERVER_HELP_MSGstring);
                    
format(stringsizeof(string), "~w~OFFERED A BRIBE BY %s~n~[$%d]~n~~y~TYPE /ACCEPT OR /REFUSE"PlayerInfo[playerid][pName],amount);
                    
SendGameText(istring30003);
                    
PlayerInfo[playerid][pBribe] = amount;
                    
PlayerInfo[playerid][pBribeWaitTime] = 30;
                    
PlayerInfo[playerid][pBribeOfferedTo] = i;
                    
PlayerInfo[i][pBribeOfferedBy] = playerid;
       
                }
            }
        }
        else
        
SendClientMessage(playeridCOLOR_ERROR"Only Civilians Can Use This Command.");
    }
    else
    
SendErrorMessage(playerid3);
    return 
1;

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)