Roadblock help
#1

i am trying to edit this roadblock script section so i can place more than one roadblock, i tried many things and still havn't been able to do it, any ideas people?

Код:
	//--------------------------------=[Roadblock]=-----------------------------------
	// by Luk0r
	if(strcmp(cmdtext, "/roadblock", true)==0 || strcmp(cmdtext, "/rb", true)==0)
	{
		if (PlayerInfo[playerid][pMember] != 1 && PlayerInfo[playerid][pLeader] != 1) return SendClientMessage(playerid, COLOR_GREY, "You are not a cop!");
		if (PlayerInfo[playerid][pRoadblock] != 0) return SendClientMessage(playerid, COLOR_GREY, "You can only deploy 1 roadblock at a time, type /rrb to remove your existing one.");
		if (roadblocktimer != 0) return SendClientMessage(playerid, COLOR_GREY, "Please wait before trying to spawn another roadblock!");
		new Float:X, Float:Y, Float:Z, Float:A;
		GetPlayerPos(playerid, X, Y, Z);
		GetPlayerFacingAngle(playerid, A);
		PlayerInfo[playerid][pRoadblock] = CreateObject(981, X, Y, Z, 0.0, 0.0, A+180);
		SetPlayerPos(playerid, X, Y, Z+4);
		GameTextForPlayer(playerid, "~w~Roadblock ~r~Placed", 5000, 5);
		SendClientMessage(playerid, COLOR_GREEN, "Roadblock deployed successfully, type /rrb or /roadunblock to remove it.");
		roadblocktimer = 1;
		GetPlayerName(playerid, sendername, sizeof(sendername));
		format(string, sizeof(string), "HQ: A roadblock has been deployed by %s, it has been marked on the map by a checkpoint.", sendername);
		for(new i = 0; i < MAX_PLAYERS; i++)
		{
			if(IsPlayerConnected(i))
			{
				if(PlayerInfo[i][pMember] == 1 || PlayerInfo[i][pLeader] == 1)
				{
					SetPlayerCheckpoint(playerid, X, Y, Z-10, 1.0);
					SendClientMessage(i, TEAM_BLUE_COLOR, string);
					if (PlayerInfo[i][pRank] >= 5 && PlayerInfo[i][pMember] || PlayerInfo[i][pLeader] == 1)
					{
						SendClientMessage(i, COLOR_YELLOW, "You can remove all roadblocks by typing /rrball");
					}
				}
			}
		}
		SetTimer("ResetRoadblockTimer", 60000, false);
		return 1;
	}
Reply
#2


pawn Код:
if (PlayerInfo[playerid][pRoadblock] != 0) return SendClientMessage(playerid, COLOR_GREY, "You can only deploy 1 roadblock at a time, type /rrb to remove your existing one.");
remove that line
Reply
#3

i done that, removed two lines so now the new code is
Код:
	//--------------------------------=[Roadblock]=-----------------------------------
	// by Luk0r
	if(strcmp(cmdtext, "/roadblock", true)==0 || strcmp(cmdtext, "/rb", true)==0)
	{
		if (PlayerInfo[playerid][pMember] != 1 && PlayerInfo[playerid][pLeader] != 1) return SendClientMessage(playerid, COLOR_GREY, "You are not a cop!");
		new Float:X, Float:Y, Float:Z, Float:A;
		GetPlayerPos(playerid, X, Y, Z);
		GetPlayerFacingAngle(playerid, A);
		PlayerInfo[playerid][pRoadblock] = CreateObject(981, X, Y, Z, 0.0, 0.0, A+180);
		SetPlayerPos(playerid, X, Y, Z+4);
		GameTextForPlayer(playerid, "~w~Roadblock ~r~Placed", 5000, 5);
		SendClientMessage(playerid, COLOR_GREEN, "Roadblock deployed successfully, type /rrb or /roadunblock to remove it.");
		roadblocktimer = 1;
		GetPlayerName(playerid, sendername, sizeof(sendername));
		format(string, sizeof(string), "HQ: A roadblock has been deployed by %s, it has been marked on the map by a checkpoint.", sendername);
		for(new i = 2; i < MAX_PLAYERS; i++)
		{
			if(IsPlayerConnected(i))
			{
				if(PlayerInfo[i][pMember] == 1 || PlayerInfo[i][pLeader] == 1)
				{
					SetPlayerCheckpoint(playerid, X, Y, Z-10, 1.0);
					SendClientMessage(i, TEAM_BLUE_COLOR, string);
					if (PlayerInfo[i][pRank] >= 5 && PlayerInfo[i][pMember] || PlayerInfo[i][pLeader] == 1)
					{
						SendClientMessage(i, COLOR_YELLOW, "You can remove all roadblocks by typing /rrball");
					}
				}
			}
		}
		SetTimer("ResetRoadblockTimer", 60000, false);
		return 1;
	}
but when i place two roadblocks i can only remove one, and after that it says that all roadblocks have been removed (even though all roadblocks have not been removed)
Reply
#4

yes thats why it wants you to do one at a time. other wise you must make it another way to read all the objects you create plus other then delete the ones you made i would just stick to making one to be honest.
Reply
#5

is there any easier way i could do it so it deletes all roadblocks at once? or if i replaced it with another script code, i seen one on the search somewhere
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)