[Tool/Web/Other] [GM ADD-ON][For VX:RP Gamemod] Place Roadblocks, cones and signs!
#1

First of all, I have to say: I CAN NOT TAKE ALL CREDITS FOR THIS, THE SCRIPT ITSELF WAS FIRST WRITTEN BY Shadow™, AND THEN REWRITTEN BY ME.

Now, this script makes cops able to place roadblocks, cones, detour signs, keep out or you will be shot-signs and line closed-signs.

Instead of uploading the pawn file, here is the content of the file. REMEMBER: IT HAS TO BE PLACED IN YOUR GAMEMODE OR IT WON'T WORK!
Код:
#include <a_samp>

// Top of your script
#define MAX_ROADBLOCKS 85 // Can be anything you want, but don't go over the top.

// Search enum in your script and add this:

enum rInfo
{
    sCreated,
    Float:sX,
    Float:sY,
    Float:sZ,
    sObject,
};
new Roadblocks[MAX_ROADBLOCKS][rInfo];

// Place this in the command-area (just search for command( and you will find it. do not place it inside another command

	command(crb, playerid, params[])
	{
     if(Player[playerid][Group] == 1)
     {
			
			new id, rbid, string[ 128 ], Float: fCarX, Float: fCarY, Float: fCarZ;
	        if( sscanf( params, "d", rbid ) )
	        {
				SendClientMessage(playerid, WHITE, "USAGE: /crb [Roadblock ID]");
				SendClientMessage(playerid, COLOR_LIGHTBLUE, "Available Roadblocks:");
				SendClientMessage(playerid, COLOR_GRAD1, "| 1: Small Roadblock");
				SendClientMessage(playerid, COLOR_GRAD1, "| 2: Medium Roadblock");
				SendClientMessage(playerid, COLOR_GRAD1, "| 3: Big Roadblock");
				SendClientMessage(playerid, COLOR_GRAD1, "| 4: Cone");
				SendClientMessage(playerid, COLOR_GRAD1, "| 5: Detour sign");
				SendClientMessage(playerid, COLOR_GRAD1, "| 6: Will be sign");
				SendClientMessage(playerid, COLOR_GRAD1, "| 7: Line closed sign");



				return 1;
			}

        switch( rbid ){
            case 1:
			{
				new Float:plocx,Float:plocy,Float:plocz,Float:ploca;
		        GetPlayerPos(playerid, plocx, plocy, plocz);
		        GetPlayerFacingAngle(playerid,ploca);
		        CreateRoadblock(1459,plocx,plocy,plocz,ploca);
		        SendClientMessage( playerid, WHITE, "Roadblock Placed!" );
				return 1;
			}
			case 2:
			{
				new Float:plocx,Float:plocy,Float:plocz,Float:ploca;
		        GetPlayerPos(playerid, plocx, plocy, plocz);
		        GetPlayerFacingAngle(playerid,ploca);
		        CreateRoadblock(978,plocx,plocy,plocz+0.6,ploca);
		        SendClientMessage( playerid, WHITE, "Roadblock Placed!" );
				return 1;
			}
			case 3:
			{
				new Float:plocx,Float:plocy,Float:plocz,Float:ploca;
		        GetPlayerPos(playerid, plocx, plocy, plocz);
		        GetPlayerFacingAngle(playerid,ploca);
		        CreateRoadblock(981,plocx,plocy,plocz+0.9,ploca+180);
		        SendClientMessage( playerid, WHITE, "Roadblock Placed!" );
		        SetPlayerPos(playerid, plocx, plocy+1.3, plocz);
				return 1;
			}
			case 4:
			{
				new Float:plocx,Float:plocy,Float:plocz,Float:ploca;
		        GetPlayerPos(playerid, plocx, plocy, plocz);
		        GetPlayerFacingAngle(playerid,ploca);
		        CreateRoadblock(1238,plocx,plocy,plocz+0.2,ploca);
		        SendClientMessage( playerid, WHITE, "Cone Placed!" );
				return 1;
			}
			case 5:
			{
				new Float:plocx,Float:plocy,Float:plocz,Float:ploca;
		        GetPlayerPos(playerid, plocx, plocy, plocz);
		        GetPlayerFacingAngle(playerid,ploca);
		        CreateRoadblock(1425,plocx,plocy,plocz+0.6,ploca);
		        SendClientMessage( playerid, WHITE, "Sign Placed!" );
				return 1;
			}
			case 6:
			{
				new Float:plocx,Float:plocy,Float:plocz,Float:ploca;
		        GetPlayerPos(playerid, plocx, plocy, plocz);
		        GetPlayerFacingAngle(playerid,ploca);
		        CreateRoadblock(3265,plocx,plocy,plocz-0.5,ploca);
		        SendClientMessage( playerid, WHITE, "Sign Placed!" );
				return 1;
			}
			case 7:
			{
				new Float:plocx,Float:plocy,Float:plocz,Float:ploca;
		        GetPlayerPos(playerid, plocx, plocy, plocz);
		        GetPlayerFacingAngle(playerid,ploca);
		        CreateRoadblock(3091,plocx,plocy,plocz+0.5,ploca+180);
		        SendClientMessage( playerid, WHITE, "Sign Placed!" );
				return 1;
			}
        }
	    return 1;
	 }
	}
	command(rrb, playerid, params[])
	{
     if(Player[playerid][Group] == 1)
     {

        	DeleteClosestRoadblock(playerid);
	        SendClientMessage( playerid, WHITE, "Roadblock Removed!" );

     }
	}
	command(rrball, playerid, params[])
	{
     if(Player[playerid][Group] == 1)
     {


        		DeleteAllRoadblocks(playerid);
	        	SendClientMessage( playerid, WHITE, "All Roadblocks ~r~Removed!" );

	 }
	}

// Place this under your script

stock CreateRoadblock(Object,Float:x,Float:y,Float:z,Float:Angle)
{
    for(new i = 0; i < sizeof(Roadblocks); i++)
  	{
  	    if(Roadblocks[i][sCreated] == 0)
  	    {
            Roadblocks[i][sCreated] = 1;
            Roadblocks[i][sX] = x;
            Roadblocks[i][sY] = y;
            Roadblocks[i][sZ] = z-0.7;
            Roadblocks[i][sObject] = CreateDynamicObject(Object, x, y, z-0.9, 0, 0, Angle);
	        return 1;
  	    }
  	}
  	return 0;
}

stock DeleteAllRoadblocks(playerid)
{
    for(new i = 0; i < sizeof(Roadblocks); i++)
  	{
  	    if(IsPlayerInRangeOfPoint(playerid, 100, Roadblocks[i][sX], Roadblocks[i][sY], Roadblocks[i][sZ]))
        {
	  	    if(Roadblocks[i][sCreated] == 1)
	  	    {
	  	        Roadblocks[i][sCreated] = 0;
	            Roadblocks[i][sX] = 0.0;
	            Roadblocks[i][sY] = 0.0;
	            Roadblocks[i][sZ] = 0.0;
	            DestroyDynamicObject(Roadblocks[i][sObject]);
	  	    }
  	    }
	}
    return 0;
}

stock DeleteClosestRoadblock(playerid)
{
    for(new i = 0; i < sizeof(Roadblocks); i++)
  	{
  	    if(IsPlayerInRangeOfPoint(playerid, 5.0, Roadblocks[i][sX], Roadblocks[i][sY], Roadblocks[i][sZ]))
        {
  	        if(Roadblocks[i][sCreated] == 1)
            {
                Roadblocks[i][sCreated] = 0;
                Roadblocks[i][sX] = 0.0;
                Roadblocks[i][sY] = 0.0;
                Roadblocks[i][sZ] = 0.0;
                DestroyDynamicObject(Roadblocks[i][sObject]);
                return 1;
  	        }
  	    }
  	}
    return 0;
}

Here, you can find the ORIGINAL SCRIPT: http://forum.sa-mp.com/showthread.ph...oadblock+it%21

Screenshot:
Reply
#2

Nice addon for VX:RP and others. i will be using this, and ill give you credits.

Off Topic:
First Post
Reply
#3

You're shitting me? For starters, this is exactly the same as my system which was a re-creation of Freshkilla's Spike System. Secondly, I don't script for Godfather so that's a little silly.

So could you please explain what exactly you've changed?

Original: http://forum.sa-mp.com/showthread.ph...oadblock+it%21
Reply
#4

Quote:
Originally Posted by Shadow™
Посмотреть сообщение
You're shitting me? For starters, this is exactly the same as my system which was a re-creation of Freshkilla's Spike System. Secondly, I don't script for Godfather so that's a little silly.

So could you please explain what exactly you've changed?

Original: http://forum.sa-mp.com/showthread.ph...oadblock+it%21
I have changed the command section itself. And all I remembered was that there was something about the godfather, but I will change it so it will be your name there.

You see, I've removed a bit of if's and placed my own, and changed it to command() instead of the one you had.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)