SA-MP Forums Archive
Roadblock 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: Roadblock Problem (/showthread.php?tid=376795)



Roadblock Problem - zT KiNgKoNg - 11.09.2012

im having a problem with my roadblock system
this is the first time ever its happened ( i always use this )
PHP код:
sscanf warning Format Specifier Does Not Match Parameter Count
sscanf warning Unknown format 
pawn Код:
CMD:roadblock(playerid, params[])// road block command
{
    if(sscanf(params, "s[100]", params))
    {
        SendClientMessage(playerid, -1, "Usage: /roadblock [ID]");
        return 1;
    }
    if (PlayerInfo[playerid][pFaction] >=0){
    if(sscanf(params, "1", params)){
    new Float:X,Float:Y,Float:Z;
    GetPlayerPos(playerid,X,Y,Z);
    CreateObject(playerid,1422, X, Y, Z, 30, 0 );
    }
    else if(sscanf(params, "2", params)){
    new Float:X,Float:Y,Float:Z;
    GetPlayerPos(playerid,X,Y,Z);
    CreateObject(playerid, 1423, X, Y, Z, 30, 0 );
    }
    else if(sscanf(params, "3", params)){
    new Float:X,Float:Y,Float:Z;
    GetPlayerPos(playerid,X,Y,Z);
    CreateObject(playerid, 1424, X, Y, Z, 30, 0 );
    }
    else if(sscanf(params, "4", params)){
    new Float:X,Float:Y,Float:Z;
    GetPlayerPos(playerid,X,Y,Z);
    CreateObject(playerid, 1425, X, Y, Z, 30, 0 );
    }
    else if(sscanf(params, "5", params)){
    new Float:X,Float:Y,Float:Z;
    GetPlayerPos(playerid,X,Y,Z);
    CreateObject(playerid, 1427, X, Y, Z, 30, 0 );
    }
    else if(sscanf(params, "6", params)){
    new Float:X,Float:Y,Float:Z;
    GetPlayerPos(playerid,X,Y,Z);
    CreateObject(playerid, 1434, X, Y, Z, 30, 0 );
    }
    }
    return 1;
}



Re: Roadblock Problem - Dokins - 11.09.2012

Here:
You were using SSCANF wrong aha.

pawn Код:
CMD:roadblock(playerid, params[])// road block command
{
    new number;
    if(sscanf(params, "i", number))
    {
        SendClientMessage(playerid, -1, "Usage: /roadblock [ID]");
        return 1;
    }
    if (PlayerInfo[playerid][pFaction] >=0)
    {
        if(number == 1)
        {
            new Float:X,Float:Y,Float:Z;
            GetPlayerPos(playerid,X,Y,Z);
            CreateObject(playerid,1422, X, Y, Z, 30, 0 );
        }
        else if(number == 2)
        {
            new Float:X,Float:Y,Float:Z;
            GetPlayerPos(playerid,X,Y,Z);
            CreateObject(playerid, 1423, X, Y, Z, 30, 0 );
        }
        else if(number == 3)
        {
            new Float:X,Float:Y,Float:Z;
            GetPlayerPos(playerid,X,Y,Z);
            CreateObject(playerid, 1424, X, Y, Z, 30, 0 );
        }
        else if(number == 4)
        {
            new Float:X,Float:Y,Float:Z;
            GetPlayerPos(playerid,X,Y,Z);
            CreateObject(playerid, 1425, X, Y, Z, 30, 0 );
        }
        else if(number == 5)
        {
            new Float:X,Float:Y,Float:Z;
            GetPlayerPos(playerid,X,Y,Z);
            CreateObject(playerid, 1427, X, Y, Z, 30, 0 );
        }
        else if(number == 6)
        {
            new Float:X,Float:Y,Float:Z;
            GetPlayerPos(playerid,X,Y,Z);
            CreateObject(playerid, 1434, X, Y, Z, 30, 0 );
        }
    }
    return 1;
}

if you want an explanation, let me know!


Re: Roadblock Problem - zT KiNgKoNg - 11.09.2012

ok thanks


Re: Roadblock Problem - zT KiNgKoNg - 11.09.2012

the object aint spawning


Re: Roadblock Problem - Dokins - 11.09.2012

That should work!


Re: Roadblock Problem - zT KiNgKoNg - 11.09.2012

for some reason its not ??


Re: Roadblock Problem - Dokins - 11.09.2012

Post me errors, please.


Re: Roadblock Problem - zT KiNgKoNg - 11.09.2012

there are not error its just not spawning the objects


Re: Roadblock Problem - Dokins - 11.09.2012

My bad...Try this:

pawn Код:
CMD:roadblock(playerid, params[])// road block command
{
    new number;
    if(sscanf(params, "i", number)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /roadblock [ID]");

    if (PlayerInfo[playerid][pFaction] >=0)
    {
        if(number == 1)
        {
            new Float:X,Float:Y,Float:Z;
            GetPlayerPos(playerid,X,Y,Z);
            CreateObject(playerid,1422, X, Y, Z, 30, 0 );
        }
        else if(number == 2)
        {
            new Float:X,Float:Y,Float:Z;
            GetPlayerPos(playerid,X,Y,Z);
            CreateObject(playerid, 1423, X, Y, Z, 30, 0 );
        }
        else if(number == 3)
        {
            new Float:X,Float:Y,Float:Z;
            GetPlayerPos(playerid,X,Y,Z);
            CreateObject(playerid, 1424, X, Y, Z, 30, 0 );
        }
        else if(number == 4)
        {
            new Float:X,Float:Y,Float:Z;
            GetPlayerPos(playerid,X,Y,Z);
            CreateObject(playerid, 1425, X, Y, Z, 30, 0 );
        }
        else if(number == 5)
        {
            new Float:X,Float:Y,Float:Z;
            GetPlayerPos(playerid,X,Y,Z);
            CreateObject(playerid, 1427, X, Y, Z, 30, 0 );
        }
        else if(number == 6)
        {
            new Float:X,Float:Y,Float:Z;
            GetPlayerPos(playerid,X,Y,Z);
            CreateObject(playerid, 1434, X, Y, Z, 30, 0 );
        }
    }
    return 1;
}
That should be it.


Re: Roadblock Problem - zT KiNgKoNg - 11.09.2012

nothing??