Easy Script Fix Request
#1

Hi,
I can not script very well/at all. Could someone please help me edit a small roadblock filescript so only medics/firefighters deploy them? I have the FS, but right now ANY ONE can. Please help me. Thanks soooo much

-jakejohnsonusa
Reply
#2

post your code
Reply
#3

Quote:

/ Torrans Roadblock System
// Made by Torran
// DO NOT REMOVE THESE CREDITS

#include <a_samp>
#include <zcmd>

#define FILTERSCRIPT
#if defined FILTERSCRIPT

#define VERSION "v1"

#define COLOR_RED 0xFF0000FF
#define COLOR_GREEN 0x00FF00FF

new RoadBlockDeployed[MAX_PLAYERS];
new PlayerRB[MAX_PLAYERS];

public OnFilterScriptInit()
{
print("\n |----------------------------------|");
printf(" | * Torran's Roadblock System %s * |", VERSION);
print(" |----------------------------------|\n");
return 1;
}

public OnFilterScriptExit()
{
return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
RoadBlockDeployed[playerid] = 0;
DestroyObject(PlayerRB[playerid]);
return 1;
}

#endif

CMD:roadblock(playerid, params[])
{
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_RED, "You need to be admin to use this command");

if(RoadBlockDeployed[playerid] == 0)
{
new Float, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
new Float:angle;
GetPlayerFacingAngle(playerid, angle);
RoadBlockDeployed[playerid] = 1;
SendClientMessage(playerid, COLOR_GREEN, "Roadblock deployed, Destroy it using - /destroyrb");
PlayerRB[playerid] = CreateObject(981, x, y, z, 0, 0, angle);
SetPlayerPos(playerid, x, y, z+1);
}
else
{
SendClientMessage(playerid, COLOR_RED, "You already have a deployed roadblock, Please destroy it - /destroyrb");
}
return 1;
}

CMD:destroyrb(playerid, params[])
{
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_RED, "You need to be admin to use this command");

if(RoadBlockDeployed[playerid] == 1)
{
RoadBlockDeployed[playerid] = 0;
SendClientMessage(playerid, COLOR_GREEN, "Roadblock destroyed");
DestroyObject(PlayerRB[playerid]);
}
else
{
SendClientMessage(playerid, COLOR_RED, "There isn't a valid roadblock to destroy");
}
return 1;
}

Its NOT created by me, but Please help and thanks!
Reply
#4

First u must creat the teams . for that use somehting like
Top of the FS (Botom fo your "new" and "includ"
Quote:

static team[MAX_PLAYERS];

then try to give a id to each team for example let's say Medic will be 1 and firefighters 2 and citizians will be team 3
so when the player spawn u will give the information "in wich team are they"
let's say this will be in onplayerspawn
Код:
if( blabla )team[playerid] = 1;
if( blabla)team[playerid] = 2;
if( blabla)team[playerid] = 3;
ok now that evry players has a id team
let see how the cmd will work
So what we gonna do ? check the team of the player that is using the CMD ! and if he is a med or FireF then the roadblocks will be placed
"i take the cmd u are using in the FS"
Код:
CMD:roadblock(playerid, params[])
{
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_RED, "You need to be admin to use this command");// ok so this means that only admins can use it, remove this line if you wanna set Medic and FireF use this cmd too without beeing admin
if(team[playerid] == 1||team[playerid] == 2){
if(RoadBlockDeployed[playerid] == 0)
{
new Float, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
new Float:angle;
GetPlayerFacingAngle(playerid, angle);
RoadBlockDeployed[playerid] = 1;
SendClientMessage(playerid, COLOR_GREEN, "Roadblock deployed, Destroy it using - /destroyrb");
PlayerRB[playerid] = CreateObject(981, x, y, z, 0, 0, angle);
SetPlayerPos(playerid, x, y, z+1);
}
else
{
SendClientMessage(playerid, COLOR_RED, "You already have a deployed roadblock, Please destroy it - /destroyrb");}else return SendClientMessage(playerid, COLOR_RED, "You can't use this cmd or blablabla put your text there");
}
Hop i was helpfull
Reply
#5

[/QUOTE]Hop i was helpfull[/QUOTE]
Thanks, but could you (or anyone) tell me how to make it where Skin IDs (274 275 276 277 278 279) Can use the command instead of teams?

And maybe even do it for me... I'm REALY bad at scripting...

Thanks: jakejohnsonusa
Reply
#6

so u wanna check if the player has requierd skin instead of Teams ?
Reply
#7

Yes and that will dertermine if they can use the CMD...
Reply
#8

Код:
CMD:roadblock(playerid, params[])
{
new Skin;
Skin = GetPlayerSkin(playerid);
if(Skin == 274||Skin == 275||Skin == 276||Skin == 27||Skin == 278||Skin == 279) ){

if(RoadBlockDeployed[playerid] == 0)
{
new Float, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
new Float:angle;
GetPlayerFacingAngle(playerid, angle);
RoadBlockDeployed[playerid] = 1;
SendClientMessage(playerid, COLOR_GREEN, "Roadblock deployed, Destroy it using - /destroyrb");
PlayerRB[playerid] = CreateObject(981, x, y, z, 0, 0, angle);
SetPlayerPos(playerid, x, y, z+1);
}
else
{
SendClientMessage(playerid, COLOR_RED, "You already have a deployed roadblock, Please destroy it - /destroyrb");
}
}else return SendClientMessage(playerid, COLOR_RED, "You can't use this cmd");
return 1;
Reply
#9

Thanks, Do I need to edit the CMD:destroyrb part and if so what?
Reply
#10

wait I'm very confused. What should I put as the whole script?
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)