S.W.A.T Script -
Machinehank34 - 25.09.2009
Ok
i need to know how to put swat skin in the server, and only for players that are set to use it by a command only Swat Leaders know.
And.
A script so u can type /drag or /arrest adn it shoves them into the car you were last driving.
And
an ICON where it teleports you to jail, if ur wanted and drive through it, so when u drive through they go to jail.
Help please?
Re: S.W.A.T Script -
Calgon - 25.09.2009
Top of the Script:
pawn Код:
#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
OnPlayerCommandText:
pawn Код:
dcmd(swatskin, 8, cmdtext);
At the bottom:
pawn Код:
dcmd_swatskin(playerid, params[])
{
#pragma unused params
SetPlayerSkin(playerid, 285); // May not be the correct skin ID.
return 1;
}
Re: S.W.A.T Script -
Machinehank34 - 29.09.2009
So THATS how he does it.
ok thanks.
i was confused
i play in this awesome server, LSRCR [Los Santos RolePlay Cops N Robbers]
and i play as swat, i love swat.
and i want to see how he did the /drag command. thanks again.
MAchine
Hank.
Re: S.W.A.T Script -
coole210 - 29.09.2009
/drag seems pretty easy
just do a new variable at top of the script
pawn Код:
new swatcar[MAX_PLAYERS];
Then, inside OnPlayerExitVehicle, just do something like this:
pawn Код:
if(gTeam[playerid] == TEAM_SWAT)
{
swatcar[playerid] = vehicleid;
}
NEEDED FUNCTIONS FOR ADVANCED /drag (put at bottom of script, needs strtok too !) :
pawn Код:
stock PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
{
new Float:oldposx, Float:oldposy, Float:oldposz;
new Float:tempposx, Float:tempposy, Float:tempposz;
GetPlayerPos(playerid, oldposx, oldposy, oldposz);
tempposx = (oldposx -x);
tempposy = (oldposy -y);
tempposz = (oldposz -z);
if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
{
return 1;
}
return 0;
}
NEEDED FUNCTIONS FOR NORMAL /drag :
pawn Код:
stock strtok(const string[], &index,seperator=' ')
{
new length = strlen(string);
new offset = index;
new result[128];
while ((index < length) && (string[index] != seperator) && ((index - offset) < (sizeof(result) - 1)))
{
result[index - offset] = string[index];
index++;
}
result[index - offset] = EOS;
if ((index < length) && (string[index] == seperator))
{
index++;
}
return result;
}
NORMAL /drag :
pawn Код:
if(strcmp(cmdtext,"/drag",true) == 0) if(gTeam[playerid] == TEAM_SWAT)
{
new tmp[256];
tmp = strtok(cmdtext,idx);
if(!strlen(tmp)) return SendClientMessage(playerid,COLOR_WHITE,"USAGE: /drag (playerid)");
new giveplayerid = strval(tmp);
if(IsPlayerConnected(giveplayerid))
{
new string[128];
new player[MAX_PLAYER_NAME];
new giveplayer[MAX_PLAYER_NAME];
GetPlayerName(playerid,player,sizeof(player));
GetPlayerName(giveplayerid,giveplayer,sizeof(giveplayer));
format(string,128,"[ ! ] You have been dragged into %s's car !",player);
SendClientMessage(giveplayerid,COLOR_RED,string);
format(string,128,"[ ! ] You have dragged %s into your old vehicle !",giveplayer);
SendClientMessage(giveplayerid,COLOR_GREEN,string);
PutPlayerInVehicle(giveplayerid,swatvehicle[playerid],1);
return 1;
}
return 1;
}
ADVANCED /drag :
pawn Код:
if(strcmp(cmdtext,"/drag",true) == 0) if(gTeam[playerid] == TEAM_SWAT)
{
new tmp[256];
tmp = strtok(cmdtext,idx);
if(!strlen(tmp)) return SendClientMessage(playerid,COLOR_WHITE,"USAGE: /drag (playerid)");
new giveplayerid = strval(tmp);
if(IsPlayerConnected(giveplayerid))
{
new xs[6];
GetVehiclePos(swatvehicle[playerid],xs[0],xs[1],xs[2]);
GetPlayerPos(giveplayerid,xs[3],xs[4],xs[5]);
if(!PlayerToPoint(20.0, playerid, xs[0], xs[1], xs[2])) return SendClientMessage(playerid,COLOR_RED,"[ ! ] You are not close enough to your vehicle !");
if(!PlayerToPoint(20.0, playerid, xs[3], xs[4], xs[5])) return SendClientMessage(playerid,COLOR_RED,"[ ! ] You are not close enough to the player !");
new string[128];
new player[MAX_PLAYER_NAME];
new giveplayer[MAX_PLAYER_NAME];
GetPlayerName(playerid,player,sizeof(player));
GetPlayerName(giveplayerid,giveplayer,sizeof(giveplayer));
format(string,128,"[ ! ] You have been dragged into %s's car !",player);
SendClientMessage(giveplayerid,COLOR_RED,string);
format(string,128,"[ ! ] You have dragged %s into your old vehicle !",giveplayer);
SendClientMessage(giveplayerid,COLOR_GREEN,string);
PutPlayerInVehicle(giveplayerid,swatvehicle[playerid],1);
return 1;
}
return 1;
}
You will need to modify some things...
Re: S.W.A.T Script -
Correlli - 29.09.2009
And learn NOT to use 256 cells in this case.
Re: S.W.A.T Script -
Machinehank34 - 29.09.2009
Looks Cool [And complicated] :0