SA-MP Forums Archive
[FilterScript] RoadBlock system - 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: Filterscripts (https://sampforum.blast.hk/forumdisplay.php?fid=17)
+--- Thread: [FilterScript] RoadBlock system (/showthread.php?tid=434990)



RoadBlock system - [CG]Milito - 04.05.2013

RoadBlock System
What is this?

It's a simple roadblock system I created that allows you to create RoadBlocks in-game
Why did I create it?

I create it mainly because my internet was down and I was bored.
What are the commands?

* /Createrb - Creates a roadblock at the player's current position.
* /removerb - Removes the closest roadblock
* /deleterbs - Deletes all the roadblocks in the server.
Is this usefull?

I think so, this can be used in a RolePlay/CnR server.


SideNote: This took me around 7 minutes, so don't expect an ultra advanced script.

Pictures






Re: RoadBlock system - J4mmyHD - 05.05.2013

Needs Fixing, The Roadblock spawns in the ground.


Re: RoadBlock system - Kontrol - 06.05.2013

Quote:
Originally Posted by J4mmyHD
View Post
Needs Fixing, The Roadblock spawns in the ground.
just +1 on the z co-ord have a play around. done forget its a float +1.5... +0.5


Re: RoadBlock system - Pottus - 07.05.2013

Suggestions for some improvement

1) There is no need for rCreated in your enum initialize rObject entries to INVALID_OBJECT_ID
2) This code is written incorrectly it will always do one iteration

pawn Code:
for(new i = 0; i < sizeof(RoadBlockInfo); i++)
        {
            if(IsPlayerInRangeOfPoint(playerid,5.0,RoadBlockInfo[i][rX],RoadBlockInfo[i][rY],RoadBlockInfo[i][rZ]))
            {
                SendClientMessage(playerid,-1,"You have succesfully removed the closest roadblock");
                DeleteClosestRB(playerid);
                return 1;
            }
            else
            {
                SendClientMessage(playerid,-1,"You are not near to any roadblock!");
                return 1;
            }
        }
        return 1;
You need to do it like this

pawn Code:
for(new i = 0; i < sizeof(RoadBlockInfo); i++)
        {
            if(IsPlayerInRangeOfPoint(playerid,5.0,RoadBlockInfo[i][rX],RoadBlockInfo[i][rY],RoadBlockInfo[i][rZ]))
            {
                SendClientMessage(playerid,-1,"You have succesfully removed the closest roadblock");
                DeleteClosestRB(playerid);
                return 1;
            }
        }
                SendClientMessage(playerid,-1,"You are not near to any roadblock!");
        return 1;
3) Return the index of the road block when being created instead of returning 1 that way it can be referenced if needed return INVALID_ROAD_BLOCK if failed.... #define INVALID_ROAD_BLOCK (0xFFFF)

4) Provide an option to use incognito streamer dynamic objects instead of create object

pawn Code:
#define USE_STREAMER

#if defined USE_STREAMER
RoadBlockInfo[i][rObject] = CreateDynamicObject(973, x, y, z-0.9, 0, 0, Angle-90);
#else
RoadBlockInfo[i][rObject] = CreateObject(973, x, y, z-0.9, 0, 0, Angle-90);
#endif
5) Provide an optional parameter for the modelid

pawn Code:
stock CreateRB(Float:x,Float:y,Float:z,Float:Angle,modelid = 973)



Re: RoadBlock system - DJTunes - 07.05.2013

Nice job from the screenshots!


Re: RoadBlock system - SeanDenZYR - 26.06.2016

can i have your gamemode? asking...