sscanf problem..
#1

I had this code in my GM cuz of some dcmd commands.
pawn Код:
stock sscanf(string[], format[], {Float,_}:...)
{
    new name[MAX_PLAYER_NAME];
    #if defined isnull
        if (isnull(string))
    #else
        if (string[0] == 0 || (string[0] == 1 && string[1] == 0))
    #endif
        {
            return format[0];
        }
    #pragma tabsize 4
    new
        formatPos = 0,
        stringPos = 0,
        paramPos = 2,
        paramCount = numargs(),
        delim = ' ';
    while (string[stringPos] && string[stringPos] <= ' ')
    {
        stringPos++;
    }
    while (paramPos < paramCount && string[stringPos])
    {
        switch (format[formatPos++])
        {
            case '\0':
            {
                return 0;
            }
            case 'i', 'd':
            {
                new
                    neg = 1,
                    num = 0,
                    ch = string[stringPos];
                if (ch == '-')
                {
                    neg = -1;
                    ch = string[++stringPos];
                }
                do
                {
                    stringPos++;
                    if ('0' <= ch <= '9')
                    {
                        num = (num * 10) + (ch - '0');
                    }
                    else
                    {
                        return -1;
                    }
                }
                while ((ch = string[stringPos]) > ' ' && ch != delim);
                setarg(paramPos, 0, num * neg);
            }
            case 'h', 'x':
            {
                new
                    num = 0,
                    ch = string[stringPos];
                do
                {
                    stringPos++;
                    switch (ch)
                    {
                        case 'x', 'X':
                        {
                            num = 0;
                            continue;
                        }
                        case '0' .. '9':
                        {
                            num = (num << 4) | (ch - '0');
                        }
                        case 'a' .. 'f':
                        {
                            num = (num << 4) | (ch - ('a' - 10));
                        }
                        case 'A' .. 'F':
                        {
                            num = (num << 4) | (ch - ('A' - 10));
                        }
                        default:
                        {
                            return -1;
                        }
                    }
                }
                while ((ch = string[stringPos]) > ' ' && ch != delim);
                setarg(paramPos, 0, num);
            }
            case 'c':
            {
                setarg(paramPos, 0, string[stringPos++]);
            }
            case 'f':
            {
                setarg(paramPos, 0, _:floatstr(string[stringPos]));
            }
            case 'p':
            {
                delim = format[formatPos++];
                continue;
            }
            case '\'':
            {
                new
                    end = formatPos - 1,
                    ch;
                while ((ch = format[++end]) && ch != '\'') {}
                if (!ch)
                {
                    return -1;
                }
                format[end] = '\0';
                if ((ch = strfind(string, format[formatPos], false, stringPos)) == -1)
                {
                    if (format[end + 1])
                    {
                        return -1;
                    }
                    return 0;
                }
                format[end] = '\'';
                stringPos = ch + (end - formatPos);
                formatPos = end + 1;
            }
            case 'u':
            {
                new
                    end = stringPos - 1,
                    id = 0,
                    bool:num = true,
                    ch;
                while ((ch = string[++end]) && ch != delim)
                {
                    if (num)
                    {
                        if ('0' <= ch <= '9')
                        {
                            id = (id * 10) + (ch - '0');
                        }
                        else
                        {
                            num = false;
                        }
                    }
                }
                if (num && IsPlayerConnected(id))
                {
                    setarg(paramPos, 0, id);
                }
                else
                {
                    #if !defined foreach
                        #define foreach(%1,%2) for (new %2 = 0; %2 < MAX_PLAYERS; %2++) if (IsPlayerConnected(%2))
                        #define __SSCANF_FOREACH__
                    #endif
                    string[end] = '\0';
                    num = false;
                    id = end - stringPos;
                    foreach (Player, playerid)
                    {
                        GetPlayerName(playerid, name, sizeof (name));
                        if (!strcmp(name, string[stringPos], true, id))
                        {
                            setarg(paramPos, 0, playerid);
                            num = true;
                            break;
                        }
                    }
                    if (!num)
                    {
                        setarg(paramPos, 0, INVALID_PLAYER_ID);
                    }
                    string[end] = ch;
                    #if defined __SSCANF_FOREACH__
                        #undef foreach
                        #undef __SSCANF_FOREACH__
                    #endif
                }
                stringPos = end;
            }
            case 's', 'z':
            {
                new
                    i = 0,
                    ch;
                if (format[formatPos])
                {
                    while ((ch = string[stringPos++]) && ch != delim)
                    {
                        setarg(paramPos, i++, ch);
                    }
                    if (!i)
                    {
                        return -1;
                    }
                }
                else
                {
                    while ((ch = string[stringPos++]))
                    {
                        setarg(paramPos, i++, ch);
                    }
                }
                stringPos--;
                setarg(paramPos, i, '\0');
            }
            default:
            {
                continue;
            }
        }
        while (string[stringPos] && string[stringPos] != delim && string[stringPos] > ' ')
        {
            stringPos++;
        }
        while (string[stringPos] && (string[stringPos] == delim || string[stringPos] <= ' '))
        {
            stringPos++;
        }
        paramPos++;
    }
    do
    {
        if ((delim = format[formatPos++]) > ' ')
        {
            if (delim == '\'')
            {
                while ((delim = format[formatPos++]) && delim != '\'') {}
            }
            else if (delim != 'z')
            {
                return delim;
            }
        }
    }
    while (delim > ' ');
    return 0;
}
But since I downloaded the sscanf include I thought I could remove it. But when I did I got these errors.
Код:
C:\Users\Namn\Desktop\-NLG-\pawno\include\robnpcs.inc(248) : error 017: undefined symbol "RN_OnPlayerConnect"
C:\Users\Namn\Desktop\-NLG-\pawno\include\robnpcs.inc(259) : error 017: undefined symbol "RN_OnPlayerDeath"
Reply
#2

The problem is in the include.

Also I recommend sscanf2 plugin instead of the old stock.
Reply
#3

Quote:
Originally Posted by CuervO
Посмотреть сообщение
The problem is in the include.

Also I recommend sscanf2 plugin instead of the old stock.
I downloaded the plugin and include and removed this code. Thats when I got the errors
Reply
#4

Quote:
Originally Posted by Don_Cage
Посмотреть сообщение
I downloaded the plugin and include and removed this code. Thats when I got the errors
Check if the include makes use of the sscanf stock, if it's not defined anywhere in the include (robnpcs) then include sscanf into it.
Reply
#5

download latest version of sscanaf
Reply
#6

It looks the include is having issues with hook, or is probably not ALS hooked. Post your include robnpcs, so we may look.
Reply
#7

pawn Код:
/* RNS V1.1 created by [iPs] Kreison */

// Defines
#define MAX_RBNPCS 16 // Max rob NPC number
#define NPC_PREFIX "Clerk" // NPC name prefix
#define NPC_SUFFIX "NLG" // NPC name suffix
#define ALARM_STOP 120 // Time to stop alarm (in secs) ~ TO TYPES 2 AND 3
#define ROB_INTERVAL 120 // Time interval to rob again after sucess (in secs)
#define FAILROB_INTERVAL 60 // Time interval to rob again after failure (in secs)


// Variables
// -- NPCs info
new assaltante[MAX_RBNPCS];
new robnpc[MAX_RBNPCS];
new robmax[MAX_RBNPCS];
new robmin[MAX_RBNPCS];
new robdelay[MAX_RBNPCS];
new robint[MAX_RBNPCS];
new npcnum;
// -- Timers
new timerrnpc[MAX_RBNPCS];
new timerrnpc2[MAX_RBNPCS];
new timerrplayer[MAX_RBNPCS];
// -- Configs
new ratp;
new sawd;



// Publics
forward roubop1(playerid, npcid);
public roubop1(playerid, npcid)
{
    ClearAnimations(npcid);
    timerrnpc[npcid] = SetTimerEx("roubop2", 100, false, "ii", playerid, npcid);
}


forward roubop2(playerid, npcid);
public roubop2(playerid, npcid)
{
    ClearAnimations(npcid);
    ApplyAnimation(npcid,"SHOP","SHP_Rob_GiveCash",4.1,0,1,1,1,0,1);
    timerrnpc[npcid] = SetTimerEx("roubop3", 3900, false, "ii", playerid, npcid);
}

forward roubop3(playerid, npcid);
public roubop3(playerid, npcid)
{
    KillTimer(timerrnpc2[npcid]);
    ClearAnimations(npcid);
    ApplyAnimation(npcid,"PED","DUCK_cower",4.1,1,1,1,1,1,1);
    PlayAlarm(npcid);
    assaltante[npcid] = INVALID_PLAYER_ID;
    robdelay[npcid] = 1;
    PayRobPlayer(playerid, npcid);
    SetTimerEx("RNDelay", ROB_INTERVAL*1000, false, "i", npcid);
}

forward PlayerStillAim(playerid, npcid);
public PlayerStillAim(playerid, npcid)
{
    new targetplayer = GetPlayerTargetPlayer(playerid);
    if (targetplayer != npcid)
    {
        ClearAnimations(npcid);
        ClearAnimations(npcid);
        assaltante[npcid] = INVALID_PLAYER_ID;
        KillTimer(timerrnpc[npcid]);
        KillTimer(timerrnpc2[npcid]);
        robdelay[npcid] = 1;

        SetTimerEx("RNDelay", FAILROB_INTERVAL*1000, false, "i", npcid);
        SetTimerEx("PlayerStillAim2", 100, false, "ii", playerid, npcid);
        CallLocalFunction("OnPlayerFailRob", "ii", playerid, npcid);
    }
}

forward PlayerStillAim2(playerid, npcid);
public PlayerStillAim2(playerid, npcid)
{
    ApplyAnimation(npcid,"PED","DUCK_cower",4.1,1,1,1,1,1,1);
    PlayAlarm(npcid);
}

forward StopAlarm(playerid);
public StopAlarm(playerid)
{
    PlayerPlaySound(playerid, 0, 0.0, 0.0, 0.0);
}

forward StopAlarmWhenIntChanged(playerid, npcid);
public StopAlarmWhenIntChanged(playerid, npcid)
{
    if(GetPlayerInterior(playerid) != robint[npcid])
    {
        PlayerPlaySound(playerid, 0, 0.0, 0.0, 0.0);
        KillTimer(timerrplayer[playerid]);
    }
}

forward RNDelay(npcid);
public RNDelay(npcid)
{
    robdelay[npcid] = 0;
}

forward AddRobNPC2(skin, Float:x, Float:y, Float:z, Float:ang, worldid, npcid);
public AddRobNPC2(skin, Float:x, Float:y, Float:z, Float:ang, worldid, npcid)
{
    SetPlayerPos(npcid, x, y, z);
    SetPlayerSkin(npcid, skin);
    SetPlayerVirtualWorld(npcid, worldid);
    SetPlayerFacingAngle(npcid, ang);

    ApplyAnimation(npcid,"SHOP","null",0.0,0,0,0,0,0);
    ApplyAnimation(npcid,"PED","null",0.0,0,0,0,0,0);
}



// Stocks
stock RandomEx(min, max)
{
    //Credits to ******
    new rand = random(max-min)+min;
    return rand;
}

stock IsPlayerInRangeOfPointEx(playerid, Float:range, Float:x, Float:y, Float:z, worldid)
{
    if (IsPlayerInRangeOfPoint(playerid, range, x, y, z) && GetPlayerVirtualWorld(playerid) == worldid)
    {
        return 1;
    }

    return 0;
}

stock PlayAlarm(npcid)
{
    new Float: x, Float: y, Float: z;
    GetPlayerPos(npcid, x, y, z);
   
    for (new i = 0; i <= npcnum;i++)
    {
        if (IsPlayerInRangeOfPointEx(i, 50.0, x, y, z, GetPlayerVirtualWorld(npcid)))
        {
            if (ratp == 0)
            {
                PlayerPlaySound(i, 3401, 0.0, 0.0, 0.0);
                timerrplayer[i] = SetTimerEx("StopAlarmWhenIntChanged", 500, true, "ii", i, npcid);
            } else if (ratp == 1) {
                PlayerPlaySound(i, 3401, x, y, z);
                timerrplayer[i] = SetTimerEx("StopAlarmWhenIntChanged", 500, true, "ii", i, npcid);
            } else if (ratp == 2) {
                PlayerPlaySound(i, 3401, 0.0, 0.0, 0.0);
                timerrplayer[i] = SetTimerEx("StopAlarm", ALARM_STOP*1000, false, "i", i);
            } else if (ratp == 3) {
                PlayerPlaySound(i, 3401, x, y, z);
                timerrplayer[i] = SetTimerEx("StopAlarm", ALARM_STOP*1000, false, "i", i);
            } else if (ratp == 4) {
                PlayerPlaySound(i, 3401, 0.0, 0.0, 0.0);
            } else if (ratp == 5) {
                PlayerPlaySound(i, 3401, x, y, z);
            }
        }
    }
}

stock CheckAimingRobNPC(playerid)
{
    new targetplayer = GetPlayerTargetPlayer(playerid);
   
    for (new x = 1; x <= npcnum; x++)
    {
        if(targetplayer == robnpc[x])
        {
            return robnpc[x];
        }
    }

    return INVALID_PLAYER_ID;
}

stock AddRobNPC(skin, Float:x, Float:y, Float:z, Float:ang, worldid, interiorid, min, max)
{
    npcnum++;
   
    new npcname[25];
    format(npcname, sizeof npcname, "%s%i_%s", NPC_PREFIX, npcnum, NPC_SUFFIX);
    robnpc[npcnum] = ConnectRNPC(npcname);

    assaltante[robnpc[npcnum]] = INVALID_PLAYER_ID;
   
    if(min > max) { printf("- Robbery NPCs system - WARNING: The minimum amount received by rob is bigger than the maximum!(NPC ID %i)", robnpc[npcnum]); }
    robmax[robnpc[npcnum]] = max;
    robmin[robnpc[npcnum]] = min;
    robint[robnpc[npcnum]] = interiorid;
   
    SetTimerEx("AddRobNPC2", 500, false, "iffffi", skin, Float:x, Float:y, Float:z, ang, worldid, robnpc[npcnum]);
}

stock SetAlarmType(num)
{
    if (num > 5)
    {
        ratp = 0;
        print("- Robbery NPCs system - WARNING: SetAlarmType was set to 0, because the type chosen is nonexistent.");
        return 0;
    }
   
    ratp = num;
    return 1;
}

stock StopAlarmOnDeath(num)
{
    if (num > 1)
    {
        sawd = 0;
        print("- Robbery NPCs system - WARNING: StopAlarmOnDeath was set to 0, because the option chosen is nonexistent.");
        return 0;
    }

    sawd = num;
    return 1;
}

stock PayRobPlayer(playerid, npcid)
{
    new moneyganho = RandomEx(robmin[npcid],robmax[npcid]);
    new rnmsg[35];
    format(rnmsg, sizeof rnmsg, "~g~You stole~n~$%i", moneyganho);
    GivePlayerMoney(playerid, moneyganho);
    GameTextForPlayer(playerid, rnmsg, 2000, 0);
    CallLocalFunction("OnPlayerSucessRob", "iii", playerid, npcid, moneyganho);
}



// Callbacks SA-MP

public OnPlayerConnect(playerid)
{
    #if defined RN_OnPlayerConnect
        RN_OnPlayerConnect(playerid);
    #endif
   
    ApplyAnimation(playerid,"SHOP","null",0.0,0,0,0,0,0);
    ApplyAnimation(playerid,"PED","null",0.0,0,0,0,0,0);
    return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    #if defined RN_OnPlayerDeath
        RN_OnPlayerDeath(playerid, killerid, reason);
    #endif

    if (sawd) { StopAlarm(playerid); }

    return 1;
}



// Hooks
#if defined _ALS_OnPlayerUpdate
    #undef OnPlayerUpdate
#else
    #define _ALS_OnPlayerUpdate
#endif
#define OnPlayerUpdate RN_OnPlayerUpdate
#if defined RN_OnPlayerUpdate
    forward RN_OnPlayerUpdate(playerid);
#endif

#if defined _ALS_OnPlayerConnect
    #undef OnPlayerConnect
#else
    #define _ALS_OnPlayerConnect
#endif
#define OnPlayerConnect RN_OnPlayerConnect
#if defined RN_OnPlayerConnect
    forward RN_OnPlayerConnect(playerid);
#endif

#if defined _ALS_OnPlayerDeath
    #undef OnPlayerDeath
#else
    #define _ALS_OnPlayerDeath
#endif
#define OnPlayerDeath RN_OnPlayerDeath
#if defined RN_OnPlayerDeath
    forward RN_OnPlayerDeath(playerid, killerid, reason);
#endif



// Callbacks of include
forward OnPlayerSucessRob(playerid, npcid, value);
forward OnPlayerFailRob(playerid, npcid);
Reply
#8

pawn Код:
/* RNS V1.1 created by [iPs] Kreison */

// Defines
#define MAX_RBNPCS 16 // Max rob NPC number
#define NPC_PREFIX "Clerk" // NPC name prefix
#define NPC_SUFFIX "NLG" // NPC name suffix
#define ALARM_STOP 120 // Time to stop alarm (in secs) ~ TO TYPES 2 AND 3
#define ROB_INTERVAL 120 // Time interval to rob again after sucess (in secs)
#define FAILROB_INTERVAL 60 // Time interval to rob again after failure (in secs)


// Variables
// -- NPCs info
new assaltante[MAX_RBNPCS];
new robnpc[MAX_RBNPCS];
new robmax[MAX_RBNPCS];
new robmin[MAX_RBNPCS];
new robdelay[MAX_RBNPCS];
new robint[MAX_RBNPCS];
new npcnum;
// -- Timers
new timerrnpc[MAX_RBNPCS];
new timerrnpc2[MAX_RBNPCS];
new timerrplayer[MAX_RBNPCS];
// -- Configs
new ratp;
new sawd;



// Publics
forward roubop1(playerid, npcid);
public roubop1(playerid, npcid)
{
    ClearAnimations(npcid);
    timerrnpc[npcid] = SetTimerEx("roubop2", 100, false, "ii", playerid, npcid);
}


forward roubop2(playerid, npcid);
public roubop2(playerid, npcid)
{
    ClearAnimations(npcid);
    ApplyAnimation(npcid,"SHOP","SHP_Rob_GiveCash",4.1,0,1,1,1,0,1);
    timerrnpc[npcid] = SetTimerEx("roubop3", 3900, false, "ii", playerid, npcid);
}

forward roubop3(playerid, npcid);
public roubop3(playerid, npcid)
{
    KillTimer(timerrnpc2[npcid]);
    ClearAnimations(npcid);
    ApplyAnimation(npcid,"PED","DUCK_cower",4.1,1,1,1,1,1,1);
    PlayAlarm(npcid);
    assaltante[npcid] = INVALID_PLAYER_ID;
    robdelay[npcid] = 1;
    PayRobPlayer(playerid, npcid);
    SetTimerEx("RNDelay", ROB_INTERVAL*1000, false, "i", npcid);
}

forward PlayerStillAim(playerid, npcid);
public PlayerStillAim(playerid, npcid)
{
    new targetplayer = GetPlayerTargetPlayer(playerid);
    if (targetplayer != npcid)
    {
        ClearAnimations(npcid);
        ClearAnimations(npcid);
        assaltante[npcid] = INVALID_PLAYER_ID;
        KillTimer(timerrnpc[npcid]);
        KillTimer(timerrnpc2[npcid]);
        robdelay[npcid] = 1;

        SetTimerEx("RNDelay", FAILROB_INTERVAL*1000, false, "i", npcid);
        SetTimerEx("PlayerStillAim2", 100, false, "ii", playerid, npcid);
        CallLocalFunction("OnPlayerFailRob", "ii", playerid, npcid);
    }
}

forward PlayerStillAim2(playerid, npcid);
public PlayerStillAim2(playerid, npcid)
{
    ApplyAnimation(npcid,"PED","DUCK_cower",4.1,1,1,1,1,1,1);
    PlayAlarm(npcid);
}

forward StopAlarm(playerid);
public StopAlarm(playerid)
{
    PlayerPlaySound(playerid, 0, 0.0, 0.0, 0.0);
}

forward StopAlarmWhenIntChanged(playerid, npcid);
public StopAlarmWhenIntChanged(playerid, npcid)
{
    if(GetPlayerInterior(playerid) != robint[npcid])
    {
        PlayerPlaySound(playerid, 0, 0.0, 0.0, 0.0);
        KillTimer(timerrplayer[playerid]);
    }
}

forward RNDelay(npcid);
public RNDelay(npcid)
{
    robdelay[npcid] = 0;
}

forward AddRobNPC2(skin, Float:x, Float:y, Float:z, Float:ang, worldid, npcid);
public AddRobNPC2(skin, Float:x, Float:y, Float:z, Float:ang, worldid, npcid)
{
    SetPlayerPos(npcid, x, y, z);
    SetPlayerSkin(npcid, skin);
    SetPlayerVirtualWorld(npcid, worldid);
    SetPlayerFacingAngle(npcid, ang);

    ApplyAnimation(npcid,"SHOP","null",0.0,0,0,0,0,0);
    ApplyAnimation(npcid,"PED","null",0.0,0,0,0,0,0);
}



// Stocks
stock RandomEx(min, max)
{
    //Credits to ******
    new rand = random(max-min)+min;
    return rand;
}

stock IsPlayerInRangeOfPointEx(playerid, Float:range, Float:x, Float:y, Float:z, worldid)
{
    if (IsPlayerInRangeOfPoint(playerid, range, x, y, z) && GetPlayerVirtualWorld(playerid) == worldid)
    {
        return 1;
    }

    return 0;
}

stock PlayAlarm(npcid)
{
    new Float: x, Float: y, Float: z;
    GetPlayerPos(npcid, x, y, z);
   
    for (new i = 0; i <= npcnum;i++)
    {
        if (IsPlayerInRangeOfPointEx(i, 50.0, x, y, z, GetPlayerVirtualWorld(npcid)))
        {
            if (ratp == 0)
            {
                PlayerPlaySound(i, 3401, 0.0, 0.0, 0.0);
                timerrplayer[i] = SetTimerEx("StopAlarmWhenIntChanged", 500, true, "ii", i, npcid);
            } else if (ratp == 1) {
                PlayerPlaySound(i, 3401, x, y, z);
                timerrplayer[i] = SetTimerEx("StopAlarmWhenIntChanged", 500, true, "ii", i, npcid);
            } else if (ratp == 2) {
                PlayerPlaySound(i, 3401, 0.0, 0.0, 0.0);
                timerrplayer[i] = SetTimerEx("StopAlarm", ALARM_STOP*1000, false, "i", i);
            } else if (ratp == 3) {
                PlayerPlaySound(i, 3401, x, y, z);
                timerrplayer[i] = SetTimerEx("StopAlarm", ALARM_STOP*1000, false, "i", i);
            } else if (ratp == 4) {
                PlayerPlaySound(i, 3401, 0.0, 0.0, 0.0);
            } else if (ratp == 5) {
                PlayerPlaySound(i, 3401, x, y, z);
            }
        }
    }
}

stock CheckAimingRobNPC(playerid)
{
    new targetplayer = GetPlayerTargetPlayer(playerid);
   
    for (new x = 1; x <= npcnum; x++)
    {
        if(targetplayer == robnpc[x])
        {
            return robnpc[x];
        }
    }

    return INVALID_PLAYER_ID;
}

stock AddRobNPC(skin, Float:x, Float:y, Float:z, Float:ang, worldid, interiorid, min, max)
{
    npcnum++;
   
    new npcname[25];
    format(npcname, sizeof npcname, "%s%i_%s", NPC_PREFIX, npcnum, NPC_SUFFIX);
    robnpc[npcnum] = ConnectRNPC(npcname);

    assaltante[robnpc[npcnum]] = INVALID_PLAYER_ID;
   
    if(min > max) { printf("- Robbery NPCs system - WARNING: The minimum amount received by rob is bigger than the maximum!(NPC ID %i)", robnpc[npcnum]); }
    robmax[robnpc[npcnum]] = max;
    robmin[robnpc[npcnum]] = min;
    robint[robnpc[npcnum]] = interiorid;
   
    SetTimerEx("AddRobNPC2", 500, false, "iffffi", skin, Float:x, Float:y, Float:z, ang, worldid, robnpc[npcnum]);
}

stock SetAlarmType(num)
{
    if (num > 5)
    {
        ratp = 0;
        print("- Robbery NPCs system - WARNING: SetAlarmType was set to 0, because the type chosen is nonexistent.");
        return 0;
    }
   
    ratp = num;
    return 1;
}

stock StopAlarmOnDeath(num)
{
    if (num > 1)
    {
        sawd = 0;
        print("- Robbery NPCs system - WARNING: StopAlarmOnDeath was set to 0, because the option chosen is nonexistent.");
        return 0;
    }

    sawd = num;
    return 1;
}

stock PayRobPlayer(playerid, npcid)
{
    new moneyganho = RandomEx(robmin[npcid],robmax[npcid]);
    new rnmsg[35];
    format(rnmsg, sizeof rnmsg, "~g~You stole~n~$%i", moneyganho);
    GivePlayerMoney(playerid, moneyganho);
    GameTextForPlayer(playerid, rnmsg, 2000, 0);
    CallLocalFunction("OnPlayerSucessRob", "iii", playerid, npcid, moneyganho);
}



// Callbacks SA-MP

public RN_OnPlayerConnect(playerid)
{
    ApplyAnimation(playerid,"SHOP","null",0.0,0,0,0,0,0);
    ApplyAnimation(playerid,"PED","null",0.0,0,0,0,0,0);   
   
    #if defined RN_OnPlayerConnect
        OnPlayerConnect(playerid);
    #endif 
    return 1;
}

public RN_OnPlayerDeath(playerid, killerid, reason)
{
    if (sawd) { StopAlarm(playerid); }

    #if defined RN_OnPlayerDeath
        OnPlayerDeath(playerid, killerid, reason);
    #endif
    return 1;
}



// Hooks

#if defined _ALS_OnPlayerConnect
    #undef OnPlayerConnect  
#else
    #define _ALS_OnPlayerConnect
#endif

#define OnPlayerConnect RN_OnPlayerConnect

#if defined RN_OnPlayerConnect
    forward RN_OnPlayerConnect(playerid);
#endif

#if defined _ALS_OnPlayerDeath
    #undef OnPlayerDeath
#else
    #define _ALS_OnPlayerDeath
#endif

#define OnPlayerDeath RN_OnPlayerDeath

#if defined RN_OnPlayerDeath
    forward RN_OnPlayerDeath(playerid, killerid, reason);
#endif

// Uncomment this if you get any errors. I don't why it is having OnPlayerUpdate hooked
/*
#if defined _ALS_OnPlayerUpdate
    #undef OnPlayerUpdate
#else
    #define _ALS_OnPlayerUpdate
#endif

#define OnPlayerUpdate RN_OnPlayerUpdate

#if defined RN_OnPlayerUpdate
    forward RN_OnPlayerUpdate(playerid);
#endif

*/




// Callbacks of include
forward OnPlayerSucessRob(playerid, npcid, value);
forward OnPlayerFailRob(playerid, npcid);
Reply
#9

I missed a bracket in my cmd.. But now, with your code AND with the old one I get these errors:
Код:
C:\Users\Namn\Desktop\-NLG-\pawno\include\robnpcs.inc(251) : error 004: function "FC_OnPlayerConnect" is not implemented
C:\Users\Namn\Desktop\-NLG-\pawno\include\robnpcs.inc(261) : error 004: function "OnPlayerDeath" is not implemented
C:\Users\Namn\Desktop\-NLG-\gamemodes\zcmd_test.pwn(5227) : error 033: array must be indexed (variable "-unknown-")
C:\Users\Namn\Desktop\-NLG-\gamemodes\zcmd_test.pwn(8048) : error 021: symbol already defined: "RN_OnPlayerConnect"
C:\Users\Namn\Desktop\-NLG-\gamemodes\zcmd_test.pwn(11692) : error 021: symbol already defined: "RN_OnPlayerDeath"
And this is the cmd I was making..
pawn Код:
CMD:confiscate(playerid, params[])
{
    if(IsACop(playerid))
    {
        new item[32],string[128], sendername[MAX_PLAYER_NAME], house;
        GetPlayerName(playerid, sendername, sizeof(sendername));
        if(sscanf(params,"s[32]",item))
        {
            SCM(playerid, COLOR_GREY, "USAGE: /confiscate [item]");
            SCM(playerid, COLOR_GREY,"Available items: drugs, mats, weapon, weapon2, weapon3, weapon4");
        }
        switch(item)
        {
            case 0:
            {
                if(IsPlayerInRangeOfPoint(playerid, 15, HouseInfo[house][hExitx],HouseInfo[house][hExity],HouseInfo[house][hExitz]))
                {
                    HouseInfo[house][hDrugs] = 0;
                    if(PlayerInfo[playerid][pSex] == 1) { format(string, sizeof(string), " Law Enforcer %s confiscates the suspects drugs.", sendername); }
                    else { format(string, sizeof(string), " Law Enforcer %s confiscates the suspects drugs.", sendername); }
                    Prox(5.0, playerid, string, COLOR_CHAT1);
                    new y1, m, d;
                    new h,mi,s;
                    getdate(y1,m,d);
                    gettime(h,mi,s);
                    format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /confiscate drugs",d,m,y1,h,mi,s,sendername);
                    CommandLog(string);
                }
                else return SCM(playerid, COLOR_GREY," You're not at any House!");
            }
            case 1:
            {
                if(IsPlayerInRangeOfPoint(playerid, 15, HouseInfo[house][hExitx],HouseInfo[house][hExity],HouseInfo[house][hExitz]))
                {
                    HouseInfo[house][hMaterials] = 0;
                    if(PlayerInfo[playerid][pSex] == 1) { format(string, sizeof(string), " Law Enforcer %s confiscates the suspects materials.", sendername); }
                    else { format(string, sizeof(string), " Law Enforcer %s confiscates the suspects materials.", sendername); }
                    Prox(5.0, playerid, string, COLOR_CHAT1);
                    new y1, m, d;
                    new h,mi,s;
                    getdate(y1,m,d);
                    gettime(h,mi,s);
                    format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /confiscate mats",d,m,y1,h,mi,s,sendername);
                    CommandLog(string);
                }
                else return SCM(playerid, COLOR_GREY," You're not at any House!");
            }
            case 2:
            {
                new gunname[24];
                new weapon = HouseInfo[house][hWeapon1];
                GetWeaponName(weapon,gunname, sizeof(gunname));
                if(IsPlayerInRangeOfPoint(playerid, 15, HouseInfo[house][hExitx],HouseInfo[house][hExity],HouseInfo[house][hExitz]))
                {
                    if(HouseInfo[house][hWeapon1] != 0)
                    {
                        HouseInfo[house][hAmmo1] = 0;
                        if(PlayerInfo[playerid][pSex] == 1) { format(string, sizeof(string), " Law Enforcer %s confiscates the suspects %s.", sendername,gunname); }
                        else { format(string, sizeof(string), " Law Enforcer %s confiscates the suspects %s.", sendername,gunname); }
                        Prox(5.0, playerid, string, COLOR_CHAT1);
                        new y1, m, d;
                        new h,mi,s;
                        getdate(y1,m,d);
                        gettime(h,mi,s);
                        format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /confiscate weapon",d,m,y1,h,mi,s,sendername);
                        CommandLog(string);
                    }
                    else return SCM(playerid, COLOR_GREY," There is nothing on this slot!");
                }
                else return SCM(playerid, COLOR_GREY," You're not at any House!");
            }
            case 3:
            {
                new gunname[24];
                new weapon = HouseInfo[house][hWeapon2];
                GetWeaponName(weapon,gunname, sizeof(gunname));
                if(IsPlayerInRangeOfPoint(playerid, 15, HouseInfo[house][hExitx],HouseInfo[house][hExity],HouseInfo[house][hExitz]))
                {
                    if(HouseInfo[house][hWeapon2] != 0)
                    {
                        HouseInfo[house][hAmmo2] = 0;
                        if(PlayerInfo[playerid][pSex] == 1) { format(string, sizeof(string), " Law Enforcer %s confiscates the suspects %s.", sendername,gunname); }
                        else { format(string, sizeof(string), " Law Enforcer %s confiscates the suspects %s.", sendername,gunname); }
                        Prox(5.0, playerid, string, COLOR_CHAT1);
                        new y1, m, d;
                        new h,mi,s;
                        getdate(y1,m,d);
                        gettime(h,mi,s);
                        format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /confiscate weapon2",d,m,y1,h,mi,s,sendername);
                        CommandLog(string);
                    }
                    else return SCM(playerid, COLOR_GREY," There is nothing on this slot!");
                }
                else return SCM(playerid, COLOR_GREY," You're not at any House!");
            }
            case 4:
            {
                new gunname[24];
                new weapon = HouseInfo[house][hWeapon3];
                GetWeaponName(weapon,gunname, sizeof(gunname));
                if(IsPlayerInRangeOfPoint(playerid, 15, HouseInfo[house][hExitx],HouseInfo[house][hExity],HouseInfo[house][hExitz]))
                {
                    if(HouseInfo[house][hWeapon3] != 0)
                    {
                        HouseInfo[house][hAmmo3] = 0;
                        if(PlayerInfo[playerid][pSex] == 1) { format(string, sizeof(string), " Law Enforcer %s confiscates the suspects %s.", sendername,gunname); }
                        else { format(string, sizeof(string), " Law Enforcer %s confiscates the suspects %s.", sendername,gunname); }
                        Prox(5.0, playerid, string, COLOR_CHAT1);
                        new y1, m, d;
                        new h,mi,s;
                        getdate(y1,m,d);
                        gettime(h,mi,s);
                        format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /confiscate weapon3",d,m,y1,h,mi,s,sendername);
                        CommandLog(string);
                    }
                    else return SCM(playerid, COLOR_GREY," There is nothing on this slot!");
                }
                else return SCM(playerid, COLOR_GREY," You're not at any House!");
            }
            case 5:
            {
                new gunname[24];
                new weapon = HouseInfo[house][hWeapon4];
                GetWeaponName(weapon,gunname, sizeof(gunname));
                if(IsPlayerInRangeOfPoint(playerid, 15, HouseInfo[house][hExitx],HouseInfo[house][hExity],HouseInfo[house][hExitz]))
                {
                    if(HouseInfo[house][hWeapon4] != 0)
                    {
                        HouseInfo[house][hAmmo4] = 0;
                        if(PlayerInfo[playerid][pSex] == 1) { format(string, sizeof(string), " Law Enforcer %s confiscates the suspects %s.", sendername,gunname); }
                        else { format(string, sizeof(string), " Law Enforcer %s confiscates the suspects %s.", sendername,gunname); }
                        Prox(5.0, playerid, string, COLOR_CHAT1);
                        new y1, m, d;
                        new h,mi,s;
                        getdate(y1,m,d);
                        gettime(h,mi,s);
                        format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /confiscate weapon4",d,m,y1,h,mi,s,sendername);
                        CommandLog(string);
                    }
                    else return SCM(playerid, COLOR_GREY," There is nothing on this slot!");
                }
                else return SCM(playerid, COLOR_GREY," You're not at any House!");
            }
        }
    }
    else return SCM(playerid, COLOR_GREY, "You are not a Law member!");
    return 1;
}
EDIT: the unknown variable is 'item' on switch(item) line

EDIT: Or maybe this is the right way to do the command?
pawn Код:
CMD:confiscate(playerid, params[])
{
    if(IsACop(playerid))
    {
        new item[32],string[128], sendername[MAX_PLAYER_NAME], house;
        GetPlayerName(playerid, sendername, sizeof(sendername));
        if(sscanf(params,"s[32]",item))
        {
            SCM(playerid, COLOR_GREY, "USAGE: /confiscate [item]");
            SCM(playerid, COLOR_GREY,"Available items: drugs, mats, weapon, weapon2, weapon3, weapon4");
        }
        if(!strcmp(item, "drugs", true))
        {
            if(IsPlayerInRangeOfPoint(playerid, 15, HouseInfo[house][hExitx],HouseInfo[house][hExity],HouseInfo[house][hExitz]))
            {
                HouseInfo[house][hDrugs] = 0;
                if(PlayerInfo[playerid][pSex] == 1) { format(string, sizeof(string), " Law Enforcer %s confiscates the suspects drugs.", sendername); }
                else { format(string, sizeof(string), " Law Enforcer %s confiscates the suspects drugs.", sendername); }
                Prox(5.0, playerid, string, COLOR_CHAT1);
                new y1, m, d;
                new h,mi,s;
                getdate(y1,m,d);
                gettime(h,mi,s);
                format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /confiscate drugs",d,m,y1,h,mi,s,sendername);
                CommandLog(string);
            }
            else return SCM(playerid, COLOR_GREY," You're not at any House!");
        }
        if(!strcmp(item, "mats", true))
        {
            if(IsPlayerInRangeOfPoint(playerid, 15, HouseInfo[house][hExitx],HouseInfo[house][hExity],HouseInfo[house][hExitz]))
            {
                HouseInfo[house][hMaterials] = 0;
                if(PlayerInfo[playerid][pSex] == 1) { format(string, sizeof(string), " Law Enforcer %s confiscates the suspects materials.", sendername); }
                else { format(string, sizeof(string), " Law Enforcer %s confiscates the suspects materials.", sendername); }
                Prox(5.0, playerid, string, COLOR_CHAT1);
                new y1, m, d;
                new h,mi,s;
                getdate(y1,m,d);
                gettime(h,mi,s);
                format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /confiscate mats",d,m,y1,h,mi,s,sendername);
                CommandLog(string);
            }
            else return SCM(playerid, COLOR_GREY," You're not at any House!");
        }
        if(!strcmp(item, "weapon", true))
        {
            new gunname[24];
            new weapon = HouseInfo[house][hWeapon1];
            GetWeaponName(weapon,gunname, sizeof(gunname));
            if(IsPlayerInRangeOfPoint(playerid, 15, HouseInfo[house][hExitx],HouseInfo[house][hExity],HouseInfo[house][hExitz]))
            {
                if(HouseInfo[house][hWeapon1] != 0)
                {
                    HouseInfo[house][hAmmo1] = 0;
                    if(PlayerInfo[playerid][pSex] == 1) { format(string, sizeof(string), " Law Enforcer %s confiscates the suspects %s.", sendername,gunname); }
                    else { format(string, sizeof(string), " Law Enforcer %s confiscates the suspects %s.", sendername,gunname); }
                    Prox(5.0, playerid, string, COLOR_CHAT1);
                    new y1, m, d;
                    new h,mi,s;
                    getdate(y1,m,d);
                    gettime(h,mi,s);
                    format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /confiscate weapon",d,m,y1,h,mi,s,sendername);
                    CommandLog(string);
                }
                else return SCM(playerid, COLOR_GREY," There is nothing on this slot!");
            }
            else return SCM(playerid, COLOR_GREY," You're not at any House!");
        }
        if(!strcmp(item, "weapon2", true))
        {
            new gunname[24];
            new weapon = HouseInfo[house][hWeapon2];
            GetWeaponName(weapon,gunname, sizeof(gunname));
            if(IsPlayerInRangeOfPoint(playerid, 15, HouseInfo[house][hExitx],HouseInfo[house][hExity],HouseInfo[house][hExitz]))
            {
                if(HouseInfo[house][hWeapon2] != 0)
                {
                    HouseInfo[house][hAmmo2] = 0;
                    if(PlayerInfo[playerid][pSex] == 1) { format(string, sizeof(string), " Law Enforcer %s confiscates the suspects %s.", sendername,gunname); }
                    else { format(string, sizeof(string), " Law Enforcer %s confiscates the suspects %s.", sendername,gunname); }
                    Prox(5.0, playerid, string, COLOR_CHAT1);
                    new y1, m, d;
                    new h,mi,s;
                    getdate(y1,m,d);
                    gettime(h,mi,s);
                    format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /confiscate weapon2",d,m,y1,h,mi,s,sendername);
                    CommandLog(string);
                }
                else return SCM(playerid, COLOR_GREY," There is nothing on this slot!");
            }
            else return SCM(playerid, COLOR_GREY," You're not at any House!");
        }
        if(!strcmp(item, "weapon3", true))
        {
            new gunname[24];
            new weapon = HouseInfo[house][hWeapon3];
            GetWeaponName(weapon,gunname, sizeof(gunname));
            if(IsPlayerInRangeOfPoint(playerid, 15, HouseInfo[house][hExitx],HouseInfo[house][hExity],HouseInfo[house][hExitz]))
            {
                if(HouseInfo[house][hWeapon3] != 0)
                {
                    HouseInfo[house][hAmmo3] = 0;
                    if(PlayerInfo[playerid][pSex] == 1) { format(string, sizeof(string), " Law Enforcer %s confiscates the suspects %s.", sendername,gunname); }
                    else { format(string, sizeof(string), " Law Enforcer %s confiscates the suspects %s.", sendername,gunname); }
                    Prox(5.0, playerid, string, COLOR_CHAT1);
                    new y1, m, d;
                    new h,mi,s;
                    getdate(y1,m,d);
                    gettime(h,mi,s);
                    format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /confiscate weapon3",d,m,y1,h,mi,s,sendername);
                    CommandLog(string);
                }
                else return SCM(playerid, COLOR_GREY," There is nothing on this slot!");
            }
            else return SCM(playerid, COLOR_GREY," You're not at any House!");
        }
        if(!strcmp(item, "weapon4", true))
        {
            new gunname[24];
            new weapon = HouseInfo[house][hWeapon4];
            GetWeaponName(weapon,gunname, sizeof(gunname));
            if(IsPlayerInRangeOfPoint(playerid, 15, HouseInfo[house][hExitx],HouseInfo[house][hExity],HouseInfo[house][hExitz]))
            {
                if(HouseInfo[house][hWeapon4] != 0)
                {
                    HouseInfo[house][hAmmo4] = 0;
                    if(PlayerInfo[playerid][pSex] == 1) { format(string, sizeof(string), " Law Enforcer %s confiscates the suspects %s.", sendername,gunname); }
                    else { format(string, sizeof(string), " Law Enforcer %s confiscates the suspects %s.", sendername,gunname); }
                    Prox(5.0, playerid, string, COLOR_CHAT1);
                    new y1, m, d;
                    new h,mi,s;
                    getdate(y1,m,d);
                    gettime(h,mi,s);
                    format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /confiscate weapon4",d,m,y1,h,mi,s,sendername);
                    CommandLog(string);
                }
                else return SCM(playerid, COLOR_GREY," There is nothing on this slot!");
            }
            else return SCM(playerid, COLOR_GREY," You're not at any House!");
        }
    }
    else return SCM(playerid, COLOR_GREY, "You are not a Law member!");
    return 1;
}
I guess it is since if I do it this way I don't get this error:
Код:
C:\Users\Namn\Desktop\-NLG-\gamemodes\zcmd_test.pwn(5227) : error 033: array must be indexed (variable "-unknown-")
Only the other 4
Reply
#10

pawn Код:
CMD:confiscate(playerid, params[])
{
    if(IsACop(playerid))
    {
        new item[32],string[128], sendername[MAX_PLAYER_NAME], house;
        GetPlayerName(playerid, sendername, sizeof(sendername));
        if(sscanf(params,"s[32]", item))
        {
            SCM(playerid, COLOR_GREY, "USAGE: /confiscate [item]");
            SCM(playerid, COLOR_GREY,"Available items: drugs, mats, weapon, weapon2, weapon3, weapon4");
        }
        else
        {
            if(!strcmp(item, "drugs", true))
            {
                if(IsPlayerInRangeOfPoint(playerid, 15, HouseInfo[house][hExitx],HouseInfo[house][hExity],HouseInfo[house][hExitz]))
                {
                    HouseInfo[house][hDrugs] = 0;
                    if(PlayerInfo[playerid][pSex] == 1) { format(string, sizeof(string), " Law Enforcer %s confiscates the suspects drugs.", sendername); }
                    else { format(string, sizeof(string), " Law Enforcer %s confiscates the suspects drugs.", sendername); }
                    Prox(5.0, playerid, string, COLOR_CHAT1);
                    new y1, m, d;
                    new h,mi,s;
                    getdate(y1,m,d);
                    gettime(h,mi,s);
                    format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /confiscate drugs",d,m,y1,h,mi,s,sendername);
                    CommandLog(string);
                }
                else return SCM(playerid, COLOR_GREY," You're not at any House!");
            }
            else if(!strcmp(item, "mats", true))
            {
                if(IsPlayerInRangeOfPoint(playerid, 15, HouseInfo[house][hExitx],HouseInfo[house][hExity],HouseInfo[house][hExitz]))
                {
                    HouseInfo[house][hMaterials] = 0;
                    if(PlayerInfo[playerid][pSex] == 1) { format(string, sizeof(string), " Law Enforcer %s confiscates the suspects materials.", sendername); }
                    else { format(string, sizeof(string), " Law Enforcer %s confiscates the suspects materials.", sendername); }
                    Prox(5.0, playerid, string, COLOR_CHAT1);
                    new y1, m, d;
                    new h,mi,s;
                    getdate(y1,m,d);
                    gettime(h,mi,s);
                    format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /confiscate mats",d,m,y1,h,mi,s,sendername);
                    CommandLog(string);
                }
                else return SCM(playerid, COLOR_GREY," You're not at any House!");
            }
            else if(!strcmp(item, "weapon", true))
            {
                new gunname[24];
                new weapon = HouseInfo[house][hWeapon1];
                GetWeaponName(weapon,gunname, sizeof(gunname));
                if(IsPlayerInRangeOfPoint(playerid, 15, HouseInfo[house][hExitx],HouseInfo[house][hExity],HouseInfo[house][hExitz]))
                {
                    if(HouseInfo[house][hWeapon1] != 0)
                    {
                        HouseInfo[house][hAmmo1] = 0;
                        if(PlayerInfo[playerid][pSex] == 1) { format(string, sizeof(string), " Law Enforcer %s confiscates the suspects %s.", sendername,gunname); }
                        else { format(string, sizeof(string), " Law Enforcer %s confiscates the suspects %s.", sendername,gunname); }
                        Prox(5.0, playerid, string, COLOR_CHAT1);
                        new y1, m, d;
                        new h,mi,s;
                        getdate(y1,m,d);
                        gettime(h,mi,s);
                        format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /confiscate weapon",d,m,y1,h,mi,s,sendername);
                        CommandLog(string);
                    }
                    else return SCM(playerid, COLOR_GREY," There is nothing on this slot!");
                }
                else return SCM(playerid, COLOR_GREY," You're not at any House!");
            }
            else if(!strcmp(item, "weapon2", true))
            {
                new gunname[24];
                new weapon = HouseInfo[house][hWeapon2];
                GetWeaponName(weapon,gunname, sizeof(gunname));
                if(IsPlayerInRangeOfPoint(playerid, 15, HouseInfo[house][hExitx],HouseInfo[house][hExity],HouseInfo[house][hExitz]))
                {
                    if(HouseInfo[house][hWeapon2] != 0)
                    {
                        HouseInfo[house][hAmmo2] = 0;
                        if(PlayerInfo[playerid][pSex] == 1) { format(string, sizeof(string), " Law Enforcer %s confiscates the suspects %s.", sendername,gunname); }
                        else { format(string, sizeof(string), " Law Enforcer %s confiscates the suspects %s.", sendername,gunname); }
                        Prox(5.0, playerid, string, COLOR_CHAT1);
                        new y1, m, d;
                        new h,mi,s;
                        getdate(y1,m,d);
                        gettime(h,mi,s);
                        format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /confiscate weapon2",d,m,y1,h,mi,s,sendername);
                        CommandLog(string);
                    }
                    else return SCM(playerid, COLOR_GREY," There is nothing on this slot!");
                }
                else return SCM(playerid, COLOR_GREY," You're not at any House!");
            }
            else if(!strcmp(item, "weapon3", true))
            {
                new gunname[24];
                new weapon = HouseInfo[house][hWeapon3];
                GetWeaponName(weapon,gunname, sizeof(gunname));
                if(IsPlayerInRangeOfPoint(playerid, 15, HouseInfo[house][hExitx],HouseInfo[house][hExity],HouseInfo[house][hExitz]))
                {
                    if(HouseInfo[house][hWeapon3] != 0)
                    {
                        HouseInfo[house][hAmmo3] = 0;
                        if(PlayerInfo[playerid][pSex] == 1) { format(string, sizeof(string), " Law Enforcer %s confiscates the suspects %s.", sendername,gunname); }
                        else { format(string, sizeof(string), " Law Enforcer %s confiscates the suspects %s.", sendername,gunname); }
                        Prox(5.0, playerid, string, COLOR_CHAT1);
                        new y1, m, d;
                        new h,mi,s;
                        getdate(y1,m,d);
                        gettime(h,mi,s);
                        format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /confiscate weapon3",d,m,y1,h,mi,s,sendername);
                        CommandLog(string);
                    }
                    else return SCM(playerid, COLOR_GREY," There is nothing on this slot!");
                }
                else return SCM(playerid, COLOR_GREY," You're not at any House!");
            }
            else if(!strcmp(item, "weapon4", true))
            {
                new gunname[24];
                new weapon = HouseInfo[house][hWeapon4];
                GetWeaponName(weapon,gunname, sizeof(gunname));
                if(IsPlayerInRangeOfPoint(playerid, 15, HouseInfo[house][hExitx],HouseInfo[house][hExity],HouseInfo[house][hExitz]))
                {
                    if(HouseInfo[house][hWeapon4] != 0)
                    {
                        HouseInfo[house][hAmmo4] = 0;
                        if(PlayerInfo[playerid][pSex] == 1) { format(string, sizeof(string), " Law Enforcer %s confiscates the suspects %s.", sendername,gunname); }
                        else { format(string, sizeof(string), " Law Enforcer %s confiscates the suspects %s.", sendername,gunname); }
                        Prox(5.0, playerid, string, COLOR_CHAT1);
                        new y1, m, d;
                        new h,mi,s;
                        getdate(y1,m,d);
                        gettime(h,mi,s);
                        format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /confiscate weapon4",d,m,y1,h,mi,s,sendername);
                        CommandLog(string);
                    }
                    else return SCM(playerid, COLOR_GREY," There is nothing on this slot!");
                }
                else return SCM(playerid, COLOR_GREY," You're not at any House!");
            }
    }
    else return SCM(playerid, COLOR_GREY, "You are not a Law member!");
    return 1;
}
EDIT: If you still have issues with it, I could probably re-do this command but not this way. It is using too much else return statements.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)