SA-MP Forums Archive
cmds problem - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: cmds problem (/showthread.php?tid=352003)



cmds problem - N0FeaR - 18.06.2012

Код:
C:\Users\Hellman\Desktop\New folder\pawno\include\/CRP/Commands/mask.pwn(31) : warning 202: number of arguments does not match definition
C:\Users\Hellman\Desktop\New folder\pawno\include\/CRP/Commands/mask.pwn(31) : warning 202: number of arguments does not match definition
C:\Users\Hellman\Desktop\New folder\pawno\include\/CRP/Commands/mask.pwn(31) : warning 202: number of arguments does not match definition
C:\Users\Hellman\Desktop\New folder\pawno\include\/CRP/Commands/mask.pwn(31) : warning 202: number of arguments does not match definition

CMD
pawn Код:
COMMAND:mask(playerid, params[])
{
    new string[128],sendername[MAX_PLAYER_NAME];
    if (PlayerInfo[playerid][pMask] == 0) return SendClientMessage(playerid, COLOR_WHITE, "SERVER: You dont have a mask.");
    switch(PlayerInfo[playerid][pMaskuse])
    {
        case 0:
        {
            PlayerInfo[playerid][pMaskuse] = 1;
            format(string, sizeof(string), "* Stranger_%d puts on %s mask.",PlayerInfo[playerid][pMaskID], CheckSex(playerid));
            foreach (Player,i)
            {
                ShowPlayerNameTagForPlayer(i,playerid,0);
            }
            PlayerMask[playerid] = Create3DTextLabel(PlayerNameEx(playerid),0xFFFFFFFF,0.0,0.0,0.0,8.0,GetPlayerVirtualWorld(playerid),1);
            Attach3DTextLabelToPlayer(PlayerMask[playerid],playerid,0.0,0.0,0.2);
        }
        case 1:
        {
            PlayerInfo[playerid][pMaskuse] = 0;
            format(sendername, sizeof(sendername), "%s", PlayerNameEx(playerid));
            GiveNameSpace(sendername);
            format(string, sizeof(string), "* %s takes off %s mask.", sendername, CheckSex(playerid));
            foreach (Player,i)
            {
                ShowPlayerNameTagForPlayer(i,playerid,1);
            }
            Delete3DTextLabel(PlayerMask[playerid]);
        }
    }
    line 31 ProxDetector(5.0, playerid, string, COLOR_PURPLE);
    return 1;
}



Re: cmds problem - WagnerPM - 18.06.2012

pawn Код:
COMMAND:mask(playerid, params[])
{
    new string[128],sendername[MAX_PLAYER_NAME];
    if (PlayerInfo[playerid][pMask] == 0) return SendClientMessage(playerid, COLOR_WHITE, "SERVER: You dont have a mask.");
    switch(PlayerInfo[playerid][pMaskuse])
    {
        case 0:
        {
            PlayerInfo[playerid][pMaskuse] = 1;
            format(string, sizeof(string), "* Stranger_%d puts on %s mask.",PlayerInfo[playerid][pMaskID], CheckSex(playerid));
            ProxDetector(5.0, playerid, string, COLOR_PURPLE);
            foreach (Player,i)
            {
                ShowPlayerNameTagForPlayer(i,playerid,0);
            }
            PlayerMask[playerid] = Create3DTextLabel(PlayerNameEx(playerid),0xFFFFFFFF,0.0,0.0,0.0,8.0,GetPlayerVirtualWorld(playerid),1);
            Attach3DTextLabelToPlayer(PlayerMask[playerid],playerid,0.0,0.0,0.2);
        }
        case 1:
        {
            PlayerInfo[playerid][pMaskuse] = 0;
            format(sendername, sizeof(sendername), "%s", PlayerNameEx(playerid));
            GiveNameSpace(sendername);
            format(string, sizeof(string), "* %s takes off %s mask.", sendername, CheckSex(playerid));
            ProxDetector(5.0, playerid, string, COLOR_PURPLE);
            foreach (Player,i)
            {
                ShowPlayerNameTagForPlayer(i,playerid,1);
            }
            Delete3DTextLabel(PlayerMask[playerid]);
        }
    }
    return 1;
}



Re: cmds problem - iGetty - 18.06.2012

pawn Код:
ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5)
Should Be

pawn Код:
ProxDetector(5.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
Try the second line.


Re: cmds problem - WagnerPM - 18.06.2012

My mistake, @iGetty is correct.


Re: cmds problem - N0FeaR - 18.06.2012

Quote:
Originally Posted by iGetty
Посмотреть сообщение
pawn Код:
ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5)
Should Be

pawn Код:
ProxDetector(5.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
Try the second line.
Thanks now is working fine..


Re: cmds problem - iGetty - 18.06.2012

You're welcome. The reason that it wasn't working is because you had:

COLOR_PURPLE once.

Where as it was defined to be used in that stock 5 times.

The best way to solve this would be:

pawn Код:
forward CloseMessageEx(playerid, color, string[], Float:range);

public CloseMessageEx(playerid, color, string[], Float: range)
{
    new Float: PlayerX, Float: PlayerY, Float: PlayerZ;
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            GetPlayerPos(playerid, PlayerX, PlayerY, PlayerZ);
            if(IsPlayerInRangeOfPoint(i, range, PlayerX, PlayerY, PlayerZ))
            {
                if(GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(i))
                {
                    SendClientMessage(i, color, string);
                }
            }
        }
    }
}
Much quicker and easier to use.