PDA

View Full Version : Roadblock


CSLangdale
17/04/2016, 07:37 PM
Hi i was wondering i have tried to get this working but i cant seem to make it happen, i have already update my streamer hoping that would help but still nothing so i turn to you for help....

when i use the command /crb it says roadblock placed but no object appear....



#define MAX_ROADBLOCKS 1000

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





CMD:crb(playerid, params[])
{

{

new rbid;
if( sscanf( params, "d", rbid ) )
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /crb [Roadblock ID]");
SendClientMessage(playerid, COLOR_WHITE, "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:X,Float:Y,Float:Z,Float:ploca;
GetPlayerPos(playerid, X, Y, Z);
GetPlayerFacingAngle(playerid,ploca);
CreateRoadblock(1459, X, Y, Z, ploca);
SendClientMessage(playerid, COLOR_WHITE, "Roadblock Placed!" );
return 1;
}
case 2:
{
new Float:X,Float:Y,Float:Z,Float:ploca;
GetPlayerPos(playerid, X, Y, Z);
GetPlayerFacingAngle(playerid,ploca);
CreateRoadblock(978, X, Y, Z, ploca);
SendClientMessage(playerid, COLOR_WHITE, "Roadblock Placed!" );
return 1;
}
case 3:
{
new Float:X,Float:Y,Float:Z,Float:ploca;
GetPlayerPos(playerid, X, Y, Z);
GetPlayerFacingAngle(playerid,ploca);
CreateRoadblock(981, X, Y, Z, ploca+180);
SendClientMessage(playerid, COLOR_WHITE, "Roadblock Placed!" );
SetPlayerPos(playerid, X, Y+1.3, Z);
return 1;
}
case 4:
{
new Float:X,Float:Y,Float:Z,Float:ploca;
GetPlayerPos(playerid, X, Y, Z);
GetPlayerFacingAngle(playerid,ploca);
CreateRoadblock(1238, X, Y, Z+0.2, ploca);
SendClientMessage(playerid, COLOR_WHITE, "Cone Placed!" );
return 1;
}
case 5:
{
new Float:X,Float:Y,Float:Z,Float:ploca;
GetPlayerPos(playerid, X, Y, Z);
GetPlayerFacingAngle(playerid,ploca);
CreateRoadblock(1425, X, Y, Z, ploca);
SendClientMessage(playerid, COLOR_WHITE, "Sign Placed!" );
return 1;
}
case 6:
{
new Float:X,Float:Y,Float:Z,Float:ploca;
GetPlayerPos(playerid, X, Y, Z);
GetPlayerFacingAngle(playerid,ploca);
CreateRoadblock(3265, X, Y, Z-0.5, ploca);
SendClientMessage(playerid, COLOR_WHITE, "Sign Placed!" );
return 1;
}
case 7:
{
new Float:X,Float:Y,Float:Z,Float:ploca;
GetPlayerPos(playerid, X, Y, Z);
GetPlayerFacingAngle(playerid,ploca);
CreateRoadblock(3091, X, Y, Z+0.5, ploca+180);
SendClientMessage(playerid, COLOR_WHITE, "Sign Placed!" );
return 1;
}
}
return 1;
}
}
CMD:rrb(playerid, params[])
{
{

DeleteClosestRoadblock(playerid);
SendClientMessage(playerid, COLOR_WHITE, "Roadblock Removed!" );
return 1;
}
}
CMD:rrball(playerid, params[])
{
{


DeleteAllRoadblocks(playerid);
SendClientMessage(playerid, COLOR_WHITE, "All Roadblocks Removed!" );
return 1;
}
}



stock CreateRoadblock(Object,Float:x,Float:y,Float:z,Flo at: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] = CreateObject(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;
DestroyObject(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;
DestroyObject(Roadblocks[i][sObject]);
return 1;
}
}
}
return 0;
}

CSLangdale
18/04/2016, 09:11 AM
Bump

CSLangdale
18/04/2016, 11:40 AM
Help please