26.08.2016, 15:13
If you don't help us we can't help you! I barely could realize what you're trying to achieve.
Not tested.
pawn Код:
/* ============================================================================ */
COMMAND:barrier(playerid, params[])
{
if(!Player[playerid][Authed]) return SendClientError(playerid, "You are not authed!");
if(!IsFed(playerid)) return SendClientError(playerid,"You are not authorized to use this command!");
new tmp[ 15 ], tmp2[ 64 ], barriertype;
if(sscanf(params, "s[15]DS[64]", tmp, barriertype, tmp2))
{
SendClientUsage(playerid,"/barrier [ Deploy / Destroy / List]");
return 1;
}
else if(!strcmp(tmp, "deploy", true, 5))
{
if(sscanf(params, "s[15]ds[64]", tmp, barriertype, tmp2)) return SendClientUsage(playerid, "/barrier deploy [1/2/3/4] [Note]");
if(barriertype == 1)
{
type=978;
}
else if(barriertype == 2)
{
type=978;
}
else if(barriertype == 3)
{
type=978;
}
else if(barriertype == 4)
{
type=978;
}
else
{
return SendClientUsage(playerid, "/barrier deploy [1/2/3/4] [Note]");
}
for(new i = 1; i < MAX_BARRIERS; i++)
{
if(!Barrier[i][bActive])
{
new Float:X, Float:Y, Float:Z, Float:A;
GetPlayerPos(playerid, X, Y, Z);
GetPlayerFacingAngle(playerid, A);
Barrier[i][bObject] = CreateDynamicObject(type, X, Y, Z, 0.0, 0.0, A, GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid));
Barrier[i][bLabel] = Create3DTextLabel(sprintf("Barrier ID %i",i),-1,X,Y,Z,10,GetPlayerVirtualWorld(playerid),0);
Barrier[i][bActive] = 1;
myStrcpy(Barrier[i][Note],tmp2);
SetPlayerPos(playerid, X-1, Y, Z+2);
SendClientMessage(playerid,-1,sprintf("Barrier ID %i has been deployed",i));
break;
}
}
}
else if(!strcmp(tmp, "destroy", true, 5))
{
if(sscanf(params, "s[15]dS[64]", tmp, barriertype, tmp2)) return SendClientUsage(playerid, "/barrier destroy [id]");
new bid = barriertype;
if(bid < 1 || bid > MAX_BARRIERS) return SendClientError(playerid,"Invalid barrier id.");
if(!Barrier[bid][bActive]) return SendClientError(playerid,"That barrier isn't deployed.");
DestroyDynamicObject(Barrier[bid][bObject]);
Delete3DTextLabel(Barrier[bid][bLabel]);
Barrier[bid][bActive] = 0;
SendClientMessage(playerid,-1,sprintf("Barrier ID %i has been destroyed.",bid));
}
else if(!strcmp(tmp, "list", true, 5))
{
for(new i = 1; i < MAX_BARRIERS; i++)
{
if(Barrier[i][bActive])
{
SendClientMessage(playerid,-1,sprintf("Barrier ID %i | Note: %s",i,Barrier[i][Note]));
}
}
}
else
{
SendClientUsage(playerid,"/barrier [ Deploy / Destroy / List]");
}
return 1;
}
/* ============================================================================= */