[FilterScript] RoadBlock system
#1

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



Reply
#2

Needs Fixing, The Roadblock spawns in the ground.
Reply
#3

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
Reply
#4

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)
Reply
#5

Nice job from the screenshots!
Reply
#6

can i have your gamemode? asking...
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)