[Ajuda] Comando /arrest
#1

Oiii.

Tenho um problema e uns warrings neste comando:

pawn Код:
CMD:arrest(playerid, params[])
{
    new rand = random(sizeof(RandomAPrison));
    new playerb, time, string[128], fine;
    if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
    if(!IsACop(playerid) && !IsFBI(playerid) && !IsARES(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not a LEO.");
    if(!PlayerInfo[playerid][pFacDuty]) return SendClientMessage(playerid, COLOR_GREY, "You are not on duty.");
    if(!IsPlayerNearArrestPoint(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not near the arrest point.");
    if(sscanf(params, "uis[64]", playerb, time, fine)) return SendClientMessage(playerid, COLOR_WHITE, "[Usage]: /arrest [playerid] [minutes] [price]");
    if(!IsPlayerLoggedIn(playerb)) return SendClientMessage(playerid, COLOR_GREY, "Invalid player id.");
    if(fine <=0 || fine > 5000)return SendClientMessage(playerid, COLOR_GREY, "Invalid money amount(0-5000).");
    if(!PlayerInfo[playerb][pWanted]) return SendClientMessage(playerid, COLOR_GREY, "Player is not wanted.");
    if(IsACop(playerb) && IsFBI(playerb) && IsARES(playerb)) return SendClientMessage(playerid, COLOR_GREY, "You can't arrest an BCPD Officer.");
    if(!IsPlayerNearPlayer(playerid, playerb, 2)) return SendClientMessage(playerid, COLOR_GREY, "You are too far away from that player.");
    format(string, sizeof(string), "Local Prison: %s has been arrested by %s.", RPN(playerb), RPN(playerid));
    foreach(Player, i)
    {
        if(IsACop(i) || IsFBI(i) || IsARES(i))
        {
        SendClientMessage(i, COLOR_BLUE, string);
        }
    }
    SetPlayerColor(playerb, TRANSPARENT_ORANGE);
    PlayerInfo[playerb][pArrested] ++;
    PlayerInfo[playerb][pPrison] = 2;
    PlayerInfo[playerb][pPrisonTime] = time*60;
    GiveDodMoney(playerb, -fine);
    ClearDodWantedLevels(playerb);
    SetPlayerInterior(playerb, 0);
    SetPlayerVirtualWorld(playerb, 0);
    SetPlayerPos(playerid, RandomAPrison[rand][0], RandomAPrison[rand][1], RandomAPrison[rand][2], RandomAPrison[rand][3], RandomAPrison[rand][4], RandomAPrison[rand][5], RandomAPrison[rand][6], RandomAPrison[rand][7], RandomAPrison[rand][8], RandomAPrison[rand][9], RandomAPrison[rand][10], RandomAPrison[rand][11], RandomAPrison[rand][12], RandomAPrison[rand][13]);
    SetPlayerFacingAngle(playerb, 90.0);
    TogglePlayerControllable(playerb, 0);
    SetTimerEx("EnterExitTimer", 5000, false, "i", playerb);
    SetCameraBehindPlayer(playerb);
    format(string, sizeof(string), " You have been arrested by an officer for %d minutes (%d seconds) and fined $%d", PlayerInfo[playerb][pPrisonTime]/60, PlayerInfo[playerb][pPrisonTime], fine);
    SendClientMessage(playerb, COLOR_LIGHTBLUE, string);
    RemovePlayerAttachedObject(playerb, 0);
    SetPlayerSpecialAction(playerb, SPECIAL_ACTION_NONE);
    // Clearing robbery
    if(BankRobber[playerb])
    {
        new Rob = BankRobber[playerb]-1;
        DisablePlayerCheckpoint(playerb);
        BankRobbersCount --;
        format(BankRobbers[Rob], MAX_PLAYER_NAME, "");
        DeliverMoney[playerb] = 0;
        //
        foreach(Player, i)
        {
            if(BankRobber[i] || PlayerInfo[i][pFac] == 1)
            {
                if(Rob == 0) TextDrawHideForPlayer(i, Textdraw1);
                else if(Rob == 1) TextDrawHideForPlayer(i, Textdraw2);
                else if(Rob == 2) TextDrawHideForPlayer(i, Textdraw3);
                else if(Rob == 3) TextDrawHideForPlayer(i, Textdraw4);
                else if(Rob == 4) TextDrawHideForPlayer(i, Textdraw5);
            }
        }
        format(string, sizeof(string), "** %s has been arrested and has failed the robbery. **", RPN(playerb));
        SendRobberyMessage(COLOR_LIGHTRED, string);
        SendCopMessage(COLOR_LIGHTRED, string);
        BankRobber[playerb] = 0;
        if(BankRobbersCount == 0)
        {
            TextDrawHideForAll(Textdraw0);
            TextDrawHideForAll(Textdraw1);
            TextDrawHideForAll(Textdraw2);
            TextDrawHideForAll(Textdraw3);
            TextDrawHideForAll(Textdraw4);
            TextDrawHideForAll(Textdraw5);
//            BankRobbery = 0;
            RobberyStarted = 0;
            TotalRobbers = 0;
            new copsonline;
            foreach(Player, i)
            {
                if(IsACop(i) || IsFBI(i) || IsARES(i)) copsonline++;
            }
            foreach(Player, i)
            {
                if(IsACop(i) || IsFBI(i) || IsARES(i))
                {
                    new Saved = (TotalRobbers*50000-(TotalStolen*50000));
                    format(string, sizeof(string), "** You have received your cut from the saved money. ($%d)", Saved/copsonline);
                    SendClientMessage(i, COLOR_LIME, string);
                }
            }
  }
    }
    return 1;
}
Problema: O policial usa /arrest [playerid] [minutes] [price] e o jogador vai para a cadeia, mas o policial tambem vai :/

11 Warings:

Код:
C:\xxx\xxx\xxx\xxx\xxx\xxx.xxx(9942) : warning 202: number of arguments does not match definition
C:\xxx\xxx\xxx\xxx\xxx\xxx.xxx(9942) : warning 202: number of arguments does not match definition
C:\xxx\xxx\xxx\xxx\xxx\xxx.xxx(9942) : warning 202: number of arguments does not match definition
C:\xxx\xxx\xxx\xxx\xxx\xxx.xxx(9942) : warning 202: number of arguments does not match definition
C:\xxx\xxx\xxx\xxx\xxx\xxx.xxx(9942) : warning 202: number of arguments does not match definition
C:\xxx\xxx\xxx\xxx\xxx\xxx.xxx(9942) : warning 202: number of arguments does not match definition
C:\xxx\xxx\xxx\xxx\xxx\xxx.xxx(9942) : warning 202: number of arguments does not match definition
C:\xxx\xxx\xxx\xxx\xxx\xxx.xxx(9942) : warning 202: number of arguments does not match definition
C:\xxx\xxx\xxx\xxx\xxx\xxx.xxx(9942) : warning 202: number of arguments does not match definition
C:\xxx\xxx\xxx\xxx\xxx\xxx.xxx(9942) : warning 202: number of arguments does not match definition
C:\xxx\xxx\xxx\xxx\xxx\xxx.xxx(9942) : warning 202: number of arguments does not match definition
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


11 Warnings.
Linha do warring:

pawn Код:
SetPlayerPos(playerid, RandomAPrison[rand][0], RandomAPrison[rand][1], RandomAPrison[rand][2], RandomAPrison[rand][3], RandomAPrison[rand][4], RandomAPrison[rand][5], RandomAPrison[rand][6], RandomAPrison[rand][7], RandomAPrison[rand][8], RandomAPrison[rand][9], RandomAPrison[rand][10], RandomAPrison[rand][11], RandomAPrison[rand][12], RandomAPrison[rand][13]);
Alguem ajuda? Agradeзo :P
Reply
#2

normal...

olha quantos parametros tem a funcao SetPlayerPos https://sampwiki.blast.hk/wiki/SetPlayerPos

e olha quantos tu tens.
Reply
#3

Quote:
Originally Posted by PT
Посмотреть сообщение
normal...

olha quantos parametros tem a funcao SetPlayerPos https://sampwiki.blast.hk/wiki/SetPlayerPos

e olha quantos tu tens.
Sim, mas o setplayerpos do comando й coordenadas Random...

pawn Код:
new Float:RandomAPrison[][15] =
{
    {1821.5347,-1582.2446,5700.4287}, //F1
    {1821.3031,-1572.6338,5700.4287}, //F2
    {1821.3029,-1563.1003,5700.4287}, //F3
    {1821.2456,-1553.6901,5700.4287}, //F4
    {1798.8193,-1552.8787,5700.4287}, //F5
    {1798.8373,-1562.1873,5700.4287}, //F6
    {1798.9347,-1571.7948,5700.4287}, //F7
    {1799.3605,-1581.1560,5700.4287}, //F8
    {1821.3273,-1577.3617,5703.9131}, //S1
    {1821.4569,-1567.9677,5703.9136}, //S2
    {1820.9648,-1558.3881,5703.9131}, //S3
    {1798.9921,-1557.6187,5703.9067}, //S4
    {1799.0815,-1567.0237,5703.9097}, //S5
    {1799.4879,-1576.6790,5703.9097} //S6
};
Reply
#4

PHP код:
new rand random(sizeof(RandomAPrison));
        
SetPlayerPos(playeridRandomAPrison[rand][0], RandomAPrison[rand][1], RandomAPrison[rand][2]); 
Altere para essa linha
Reply
#5

Quote:
Originally Posted by yNexus
Посмотреть сообщение
PHP код:
new rand random(sizeof(RandomAPrison));
        
SetPlayerPos(playeridRandomAPrison[rand][0], RandomAPrison[rand][1], RandomAPrison[rand][2]); 
Altere para essa linha
Mas assim quando o jogador fizer /arrest so vai para 3 locais.... eu queria que fosse para os 14 locais random que fiz....

nгo ha maneira de colocar os 14 randoms?
Reply
#6

vc quer q ele vб para todos os randons direto ?
esse cуdigo que lhe enviei, ele escolhe uma das cordenadas e poem a pessoa
com outra pessoa ja й diferente .
Reply
#7

Eu quero que estes randons que estгo aqui, que estejam no comando

pawn Код:
new Float:RandomAPrison[][15] =
{
    {1821.5347,-1582.2446,5700.4287}, //F1 Este й o RandomAPrison[rand][0]
    {1821.3031,-1572.6338,5700.4287}, //F2 Este й o RandomAPrison[rand][1]
    {1821.3029,-1563.1003,5700.4287}, //F3 Este й o RandomAPrison[rand][2]
    {1821.2456,-1553.6901,5700.4287}, //F4 Este й o RandomAPrison[rand][3]
    {1798.8193,-1552.8787,5700.4287}, //F5 Este й o RandomAPrison[rand][4]
    {1798.8373,-1562.1873,5700.4287}, //F6 Este й o RandomAPrison[rand][5]
    {1798.9347,-1571.7948,5700.4287}, //F7 Este й o RandomAPrison[rand][6]
    {1799.3605,-1581.1560,5700.4287}, //F8 Este й o RandomAPrison[rand][7]
    {1821.3273,-1577.3617,5703.9131}, //S1 Este й o RandomAPrison[rand][8]
    {1821.4569,-1567.9677,5703.9136}, //S2 Este й o RandomAPrison[rand][9]
    {1820.9648,-1558.3881,5703.9131}, //S3 Este й o RandomAPrison[rand][10]
    {1798.9921,-1557.6187,5703.9067}, //S4 Este й o RandomAPrison[rand][11]
    {1799.0815,-1567.0237,5703.9097}, //S5 Este й o RandomAPrison[rand][12]
    {1799.4879,-1576.6790,5703.9097} //S6 Este й o RandomAPrison[rand][13]
};
Reply
#8

o problema do policial ta obvio ne?

pawn Код:
SetPlayerPos(playerid
Reply
#9

Quote:
Originally Posted by Wellington1999
Посмотреть сообщение
o problema do policial ta obvio ne?

pawn Код:
SetPlayerPos(playerid
Essa parte jб resolvi, agora falta colocar mais randons ao SetPlayerPos....
Reply
#10

Coloca mais SetPlayerPos usando else
Reply


Forum Jump:


Users browsing this thread: 6 Guest(s)