Útzár és tüske lerakó:
// Filterscript made by MrEdinLaw (Edin_Demic).
#include <a_samp>
#include <streamer>
#define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == \'\\0\') && (dcmd_%1(playerid, \"\"))) || (((%3)[(%2) + 1] == \' \') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
#define MAX_ROADBLOCKS 50
#define MAX_SPIKESTRIPS 50
////Spikes////
enum sInfo
{
sCreated,
Float:sX,
Float:sY,
Float:sZ,
sObject,
};
new SpikeInfo[MAX_SPIKESTRIPS][sInfo];
////Roadblocks////
enum rInfo
{
sCreated,
Float:sX,
Float:sY,
Float:sZ,
sObject,
};
new Roadblocks[MAX_ROADBLOCKS][rInfo];
enum pInfo
{
pRoadblock,
};
forward SafeSetPlayerPos(playerid, Float:x, Float:y, Float:z);
public OnPlayerCommandText(playerid, cmdtext[])
{
dcmd(crb,3,cmdtext);
dcmd(rrb,3,cmdtext);
dcmd(rallrb,6,cmdtext);
dcmd(spike,5,cmdtext);
dcmd(rspike,6,cmdtext);
dcmd(rallspikes,10,cmdtext);
return 1;
}
dcmd_crb(playerid,params[])
{
#pragma unused params
new rb;
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;
}
dcmd_rallrb(playerid,params[])
{
#pragma unused params
GameTextForPlayer(playerid,\"~b~All ~w~Roadblocks ~r~Removed!\",3000,1);
for(new i = 0; i < sizeof(Roadblocks); i++)
{
if(IsPlayerInRangeOfPoint(playerid, 100, Roadblocks[sX], Roadblocks[sY], Roadblocks[sZ]))
{
if(Roadblocks[sCreated] == 1)
{
Roadblocks[sCreated] = 0;
Roadblocks[sX] = 0.0;
Roadblocks[sY] = 0.0;
Roadblocks[sZ] = 0.0;
DestroyDynamicObject(Roadblocks[sObject]);
}
}
}
return 1;
}
dcmd_rrb(playerid,params[])
{
#pragma unused params
GameTextForPlayer(playerid,\"~w~Roadblock ~r~Removed!\",3000,1);
for(new i = 0; i < sizeof(Roadblocks); i++)
{
if(IsPlayerInRangeOfPoint(playerid, 5.0, Roadblocks[sX], Roadblocks[sY], Roadblocks[sZ]))
{
if(Roadblocks[sCreated] == 1)
{
Roadblocks[sCreated] = 0;
Roadblocks[sX] = 0.0;
Roadblocks[sY] = 0.0;
Roadblocks[sZ] = 0.0;
DestroyDynamicObject(Roadblocks[sObject]);
return 1;
}
}
}
return 1;
}
dcmd_spike(playerid,params[])
{
#pragma unused params
new Float:plocx,Float:plocy,Float:plocz,Float:ploca;
GetPlayerPos(playerid, plocx, plocy, plocz);
GetPlayerFacingAngle(playerid,ploca);
CreateSpike(plocx,plocy,plocz,ploca);
return 1;
}
dcmd_rspike(playerid,params[])
{
#pragma unused params
for(new i = 0; i < sizeof(SpikeInfo); i++)
{
if(IsPlayerInRangeOfPoint(playerid, 2.0, SpikeInfo[sX], SpikeInfo[sY], SpikeInfo[sZ]))
{
if(SpikeInfo[sCreated] == 1)
{
SpikeInfo[sCreated]=0;
SpikeInfo[sX]=0.0;
SpikeInfo[sY]=0.0;
SpikeInfo[sZ]=0.0;
DestroyObject(SpikeInfo[sObject]);
return 1;
}
}
}
return 1;
}
dcmd_rallspikes(playerid,params[])
{
#pragma unused playerid
#pragma unused params
for(new i = 0; i < sizeof(SpikeInfo); i++)
{
if(SpikeInfo[sCreated] == 1)
{
SpikeInfo[sCreated]=0;
SpikeInfo[sX]=0.0;
SpikeInfo[sY]=0.0;
SpikeInfo[sZ]=0.0;
DestroyObject(SpikeInfo[sObject]);
}
}
return 1;
}
stock CreateRoadblock(Object,Float:x,Float:y,Float:z,Float:Angle)
{
for(new i = 0; i < sizeof(Roadblocks); i++)
{
if(Roadblocks[sCreated] == 0)
{
Roadblocks[sCreated] = 1;
Roadblocks[sX] = x;
Roadblocks[sY] = y;
Roadblocks[sZ] = z-0.7;
Roadblocks[sObject] = CreateDynamicObject(Object, x, y, z-0.9, 0, 0, Angle);
return 1;
}
}
return 0;
}
public SafeSetPlayerPos(playerid, Float:x, Float:y, Float:z)
{
SetPlayerPos(playerid, x,y,z);
return 1;
}
public OnPlayerUpdate(playerid)
{
if(!IsPlayerConnected(playerid)) return 0;
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
for(new i = 0; i < sizeof(SpikeInfo); i++)
{
if(IsPlayerInRangeOfPoint(playerid, 3.0, SpikeInfo[sX], SpikeInfo[sY], SpikeInfo[sZ]))
{
if(SpikeInfo[sCreated] == 1)
{
new panels, doors, lights, tires;
new carid = GetPlayerVehicleID(playerid);
GetVehicleDamageStatus(carid, panels, doors, lights, tires);
UpdateVehicleDamageStatus(carid, panels, doors, lights, 15);
return 0;
}
}
}
}
return 1;
}
stock CreateSpike(Float:x,Float:y,Float:z,Float:Angle)
{
for(new i = 0; i < sizeof(SpikeInfo); i++)
{
if(SpikeInfo[sCreated] == 0)
{
SpikeInfo[sCreated]=1;
SpikeInfo[sX]=x;
SpikeInfo[sY]=y;
SpikeInfo[sZ]=z-0.7;
SpikeInfo[sObject] = CreateObject(2899, x, y, z-0.9, 0, 0, Angle-90);
return 1;
}
}
return 0;
}
Ha jól írod bele a módba akkor nem fog bugolni.
A fegyverrel való lerakáshoz nem igazán találtam scriptet és ötletem sincs, hogyan lehetne megoldani (ha egyáltalán meglehet)
De ezzel a scripttel egyszerûbb lenne megoldani:
http://forum.sa-mp.com/showthread.php?t=325392/Csak át kell írni, hogy a rendvédelmisek használhassák, valamint csak útzár objecteket lehessen lerakni.