dcmd_crb(playerid,params[])
{
new rb;
if(IsRegularPlayer[playerid] != 1337)
{
SendClientMessage(playerid,COLOR_ERROR,"{CACA00}[ERROR]{FFFFFF}You must be a regular player to create roadblocks.");
return 1;
}
if(IsPlayerConnected(playerid) && IsRegularPlayer[playerid] == 1337 && gTeam[playerid] == TEAM_COP || gTeam[playerid] == TEAM_ARMYAIR || gTeam[playerid] == TEAM_ARMYLAND || gTeam[playerid] == TEAM_CIA || gTeam[playerid] == TEAM_SWAT)
{
if(sscanf(params, "i", rb))
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /crb (Roadblock ID)");
SendClientMessage(playerid, COLOR_LIGHTBLUE, "[Available Roadblocks]");
SendClientMessage(playerid, COLOR_ADMIN, "| 1: Small Roadblock | 2: Medium Roadblock |");
SendClientMessage(playerid, COLOR_ADMIN, "| 3: Big Roadblock | 4: Cone | 5: Detour Sign |");
SendClientMessage(playerid, COLOR_ADMIN, "| 6: Will Be Sign | 7: Line Closed Sign |");
return 1;
}
if(IsKidnapped[playerid] >= 1)
{
SendClientMessage(playerid,COLOR_ERROR,"{CACA00}[ERROR]{FFFFFF}You are kidnapped. You cannot use this command.");
return 1;
}
if(IsRegularPlayer[playerid] != 1337)
{
SendClientMessage(playerid,COLOR_ERROR,"{CACA00}[ERROR]{FFFFFF}You must be a regular player to place roadblocks.");
return 1;
}
if(IsPlayerInAnyVehicle(playerid))
{
SendClientMessage(playerid,COLOR_ERROR,"{CACA00}[ERROR]{FFFFFF}You cannot place a roadblock while in a vehicle. What are you? Superman?");
return 1;
}
if (rb == 1)
{
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
new Float:plocx,Float:plocy,Float:plocz,Float:ploca;
GetPlayerPos(playerid, plocx, plocy, plocz);
GetPlayerFacingAngle(playerid,ploca);
CreateRoadblock(1459,plocx,plocy,plocz,ploca);
GameTextForPlayer(playerid,"~w~Roadblock ~b~Placed!",3000,1);
return 1;
}
else if (rb == 2)
{
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
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);
GameTextForPlayer(playerid,"~w~Roadblock ~b~Placed!",3000,1);
return 1;
}
else if (rb == 3)
{
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
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);
GameTextForPlayer(playerid,"~w~Roadblock ~g~Placed!",3000,1);
SafeSetPlayerPos(playerid, plocx, plocy+5, plocz);
return 1;
}
else if (rb == 4)
{
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
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);
GameTextForPlayer(playerid,"~w~Cone ~g~Placed!",3000,1);
return 1;
}
else if (rb == 5)
{
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
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);
GameTextForPlayer(playerid,"~w~Sign ~g~Placed!",3000,1);
return 1;
}
else if (rb == 6)
{
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
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);
GameTextForPlayer(playerid,"~w~Sign ~g~Placed!",3000,1);
return 1;
}
else if (rb == 7)
{
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
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);
GameTextForPlayer(playerid,"~w~Sign ~g~Placed!",3000,1);
return 1;
}
}
return 1;
}
|
What's the problem? Is it giving you an error when you compile, or does it give you an error ingame, or won't it create an roadblock?
|
dcmd_crb(playerid,params[])
{
new rb;
if(IsPlayerConnected(playerid) && gTeam[playerid] == TEAM_COP || gTeam[playerid] == TEAM_ARMY || gTeam[playerid] == TEAM_CIA || AdminLevel[playerid] == 1337)
{
if(sscanf(params, "i", rb))
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /crb (Roadblock ID)");
SendClientMessage(playerid, COLOR_LIGHTBLUE, "[Available Roadblocks]");
SendClientMessage(playerid, COLOR_GREY, "| 1: Small Roadblock | 2: Medium Roadblock |");
SendClientMessage(playerid, COLOR_GREY, "| 3: Big Roadblock | 4: Cone | 5: Detour Sign |");
SendClientMessage(playerid, COLOR_GREY, "| 6: Will Be Sign | 7: Line Closed Sign |");
return 1;
}
if(IsKidnapped[playerid] == 1)
{
SendClientMessage(playerid,COLOR_ERROR,"You are kidnapped. You cannot use this command.");
return 1;
}
if(IsRegularPlayer[playerid] != 1337)
{
SendClientMessage(playerid,COLOR_ERROR,"You must be a regular player to place roadblocks.");
return 1;
}
if(IsPlayerInAnyVehicle(playerid))
{
SendClientMessage(playerid,COLOR_ERROR,"You cannot place a roadblock while in a vehicle. What are you? Superman?");
return 1;
}
if (rb == 1)
{
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
new Float:plocx,Float:plocy,Float:plocz,Float:ploca;
GetPlayerPos(playerid, plocx, plocy, plocz);
GetPlayerFacingAngle(playerid,ploca);
CreateRoadblock(1459,plocx,plocy,plocz,ploca);
GameTextForPlayer(playerid,"~w~Roadblock ~b~Placed!",3000,1);
return 1;
}
else if (rb == 2)
{
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
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);
GameTextForPlayer(playerid,"~w~Roadblock ~b~Placed!",3000,1);
return 1;
}
else if (rb == 3)
{
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
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);
GameTextForPlayer(playerid,"~w~Roadblock ~g~Placed!",3000,1);
SafeSetPlayerPos(playerid, plocx, plocy+5, plocz);
return 1;
}
else if (rb == 4)
{
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
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);
GameTextForPlayer(playerid,"~w~Cone ~g~Placed!",3000,1);
return 1;
}
else if (rb == 5)
{
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
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);
GameTextForPlayer(playerid,"~w~Sign ~g~Placed!",3000,1);
return 1;
}
else if (rb == 6)
{
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
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);
GameTextForPlayer(playerid,"~w~Sign ~g~Placed!",3000,1);
return 1;
}
else if (rb == 7)
{
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
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);
GameTextForPlayer(playerid,"~w~Sign ~g~Placed!",3000,1);
return 1;
}
}
return 1;
}
|
Can you post your "CreateRoadblock" Function please? As it's more than likely something to do with that.
|
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;
}