SA-MP Forums Archive
Roadblocks adding (cmds) - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Roadblocks adding (cmds) (/showthread.php?tid=247309)



Roadblocks adding (cmds) - Michael@Belgium - 08.04.2011

hi everyone ! I'm working on a roadblock 'system' but it don't work ...
I have this:

pawn Код:
CMD:roadblock(playerid,params[])
{
    if(gTeam[playerid] == POLICE ||gTeam[playerid] == FIREMEN)
    {
        new number;
        if(sscanf(params,"d",number))
        {
            SendClientMessage(playerid,COLOR_BLUE,"USAGE: /roadblock <1/2/3/4/5/6/7>");
            SendClientMessage(playerid,COLOR_BLUE,"| 1: Small Roadblock");
            SendClientMessage(playerid,COLOR_BLUE,"| 2: Medium Roadblock");
            SendClientMessage(playerid,COLOR_BLUE,"| 3: Big Roadblock");
            SendClientMessage(playerid,COLOR_BLUE,"| 4: Traffic cone");
            SendClientMessage(playerid,COLOR_BLUE,"| 5: Detour sign");
            SendClientMessage(playerid,COLOR_BLUE,"| 6: Will be sign");
            SendClientMessage(playerid,COLOR_BLUE,"| 7: Line closed sign");
            SendClientMessage(playerid,COLOR_WHITE,"----------------------");
            SendClientMessage(playerid,COLOR_BLUE,"/deleteall");
            return 1;
        }
       
        switch(number)
        {
            case 1:
            {
                    new Float:X, Float:Y, Float:Z, Float:A;
                    GetPlayerPos(playerid, X, Y, Z);
                    GetPlayerFacingAngle(playerid, A);
                    block = CreateObject(1459, X, Y, A,0,0,0.0);
                    GameTextForPlayer(playerid,"~w~Roadblock ~b~Placed!",3000,1);
                    return 1;
            }


            case 2:
            {
                    new Float:X, Float:Y, Float:Z, Float:A;
                    GetPlayerPos(playerid, X, Y, Z);
                    GetPlayerFacingAngle(playerid, A);
                    block2 = CreateObject(978, X, Y, A,0,0,0.0);
                    GameTextForPlayer(playerid,"~w~Roadblock ~b~Placed!",3000,1);
                    return 1;
            }

            case 3:
            {
                    new Float:X, Float:Y, Float:Z, Float:A;
                    GetPlayerPos(playerid, X, Y, Z);
                    GetPlayerFacingAngle(playerid, A);
                    block3 = CreateObject(981, X, Y, A,0,0,0.0);
                    GameTextForPlayer(playerid,"~w~Roadblock ~b~Placed!",3000,1);
                    return 1;
            }

            case 4:
            {
                    new Float:X, Float:Y, Float:Z, Float:A;
                    GetPlayerPos(playerid, X, Y, Z);
                    GetPlayerFacingAngle(playerid, A);
                    block4 = CreateObject(1238, X, Y, A, 0.0, 0.0,0.0);
                    GameTextForPlayer(playerid,"~w~Cone ~b~Placed!",3000,1);
                    return 1;
            }

            case 5:
            {
                    new Float:X, Float:Y, Float:Z, Float:A;
                    GetPlayerPos(playerid, X, Y, Z);
                    GetPlayerFacingAngle(playerid, A);
                    block5 = CreateObject(1425, X, Y, A, 0.0, 0.0,0.0,0.0);
                    GameTextForPlayer(playerid,"~w~Sign ~b~Placed!",3000,1);
                    return 1;
            }

            case 6:
            {
                    new Float:X, Float:Y, Float:Z, Float:A;
                    GetPlayerPos(playerid, X, Y, Z);
                    GetPlayerFacingAngle(playerid, A);
                    block6 = CreateObject(3265, X, Y, A, 0.0, 0.0,0.0);
                    GameTextForPlayer(playerid,"~w~Sign ~b~Placed!",3000,1);
                    return 1;
            }

            case 7:
            {
                    new Float:X, Float:Y, Float:Z, Float:A;
                    GetPlayerPos(playerid, X, Y, Z);
                    GetPlayerFacingAngle(playerid, A);
                    block7 = CreateObject(3091, X, Y, A, 0.0, 0.0,0.0);
                    GameTextForPlayer(playerid,"~w~Sign ~b~Placed!",3000,1);
                    return 1;
            }
        }
    }
    else
    {
        SendClientMessage(playerid,COLOR_RED,"You are not a cop or a firemen so you can't use this cmd !");
    }
    return 1;
}



CMD:deleteall(playerid,params[])
{
    DestroyObject(block);
    DestroyObject(block2);
    DestroyObject(block3);
    DestroyObject(block4);
    DestroyObject(block5);
    DestroyObject(block6);
    DestroyObject(block7);
    return 1;
}

The roadblock doesn't appear

PLZ HELP ME ;p


Re: Roadblocks adding (cmds) - Vince - 08.04.2011

Why do you have playerid in your CreateObject statements?
Ow, and the Angle (A) should be Z rotation (last param) . Now you're rotating the object over the x-asis, which will mess up.


Re: Roadblocks adding (cmds) - Michael@Belgium - 08.04.2011

Quote:
Originally Posted by Vince
Посмотреть сообщение
Why do you have playerid in your CreateObject statements?
Ow, and the Angle (A) should be Z rotation (last param) . Now you're rotating the object over the x-asis, which will mess up.
Ow >_< yeah stupid mistaces ... Let's see ...


Re: Roadblocks adding (cmds) - randomkid88 - 08.04.2011

Use sscanf to get the params in one command. You can get it and there is also a tutorial HERE.


Re: Roadblocks adding (cmds) - Michael@Belgium - 08.04.2011

Quote:
Originally Posted by randomkid88
Посмотреть сообщение
Use sscanf to get the params in one command. You can get it and there is also a tutorial HERE.
Ok thanks ... look now to the script (it's 'updated')
But still ... THE OBJECTS DOESN'T APPEAR :-/


Re: Roadblocks adding (cmds) - Michael@Belgium - 09.04.2011

Sorry for bump :S But can anyone help me ?! And if i search for roadblock system, the cmds are not in ZCMD but nvm xS


Re: Roadblocks adding (cmds) - Mean - 09.04.2011

You might wanna check this.


Re: Roadblocks adding (cmds) - randomkid88 - 09.04.2011

Try making a command and post what you come up with and we can help.


Re: Roadblocks adding (cmds) - Michael@Belgium - 09.04.2011

Quote:
Originally Posted by Mean
Посмотреть сообщение
You might wanna check this.
ok ... LOL ?? I know ...
Quote:
Originally Posted by randomkid88
Посмотреть сообщение
Try making a command and post what you come up with and we can help.
Dude ?! This is a CMD !!! And i have a own server, so i know how to make a cmd >_<


Re: Roadblocks adding (cmds) - randomkid88 - 09.04.2011

Quote:
Originally Posted by Michael@Belgium
Посмотреть сообщение
Dude ?! This is a CMD !!! And i have a own server, so i know how to make a cmd >_<
I wasn't saying you didn't. What I was saying was that if you're having problems making the command, attempt to make one and post it and we can try to see what is wrong with it.

And is the code you updated in the first post working?