Police Commands
#1

Hello there. Well I have a question about making some commands for the Police like /taze, /cuff, /jail and other.. Im a starting scripter so I actually dont even know how to make such things, so if someone could help me with this or expalin how todo these please answer here.

(I Need that these commands will work only for people who take LSPD skins.)
Reply
#2

So could someone answer this please?
Reply
#3

Use search?
Reply
#4

Yo Compton, your in my place homie, but if i were you, i would just go to advanced search, and under TUTORIALS only, search /taze, or something

Then just follow the guide.
Reply
#5

/cuff and /uncuff
Quote:

if(strcmp(cmd, "/cuff", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(gTeam[playerid] == 2 || IsACop(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /cuff [Playerid/PartOfName]");
return 1;
}
giveplayerid = ReturnUser(tmp);
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
if(gTeam[giveplayerid] == 2 || IsACop(giveplayerid))
{
SendClientMessage(playerid, COLOR_GREY, " You can't Cuff Cops !");
return 1;
}
if(PlayerCuffed[giveplayerid] > 0)
{
SendClientMessage(playerid, COLOR_GREY, " Player already Cuffed !");
return 1;
}
if (ProxDetectorS(8.0, playerid, giveplayerid))
{
new car = GetPlayerVehicleID(playerid);
if(giveplayerid == playerid) { SendClientMessage(playerid, COLOR_GREY, "You cannot Cuff yourself!"); return 1; }
if(IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == 2 && IsPlayerInVehicle(giveplayerid, car))
{
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* You were Cuffed by %s, till uncuff.", sendername);
SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "* You Cuffed %s, till uncuff.", giveplayer);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "* %s Hand Cuffs %s, so he wont go anywhere.", sendername ,giveplayer);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPL E,COLOR_PURPLE);
GameTextForPlayer(giveplayerid, "~r~Cuffed", 2500, 3);
TogglePlayerControllable(giveplayerid, 0);
PlayerCuffed[giveplayerid] = 2;
PlayerCuffedTime[giveplayerid] = 180;
}
else
{
SendClientMessage(playerid, COLOR_GREY, " Player not in your Car, or your not the Driver !");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " That player is not near you !");
return 1;
}
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " That player is Offline !");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " You are not a Cop / FBI / National Guard !");
}
}
return 1;
}
if(strcmp(cmd, "/uncuff", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(gTeam[playerid] == 2)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /uncuff [Playerid/PartOfName]");
return 1;
}
giveplayerid = ReturnUser(tmp);
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
if (ProxDetectorS(8.0, playerid, giveplayerid))
{
if(giveplayerid == playerid) { SendClientMessage(playerid, COLOR_GREY, "You cannot Uncuff yourself!"); return 1; }
if(PlayerCuffed[giveplayerid])
{
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* You were Uncuffed by %s.", sendername);
SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "* You Uncuffed %s.", giveplayer);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
GameTextForPlayer(giveplayerid, "~g~Uncuffed", 2500, 3);
TogglePlayerControllable(giveplayerid, 1);
PlayerCuffed[giveplayerid] = 0;
}
else
{
SendClientMessage(playerid, COLOR_GREY, " That player isn't Tied up !");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " That player is not near you !");
return 1;
}
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " That player is Offline !");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " You are not a Cop / FBI / National Guard !");
}
}//not connected
return 1;
}

Reply
#6

ravzy, it would help if you put it in:
Reply
#7

Here is a /cuff cmd

pawn Код:
COMMAND:cuff(playerid, params[])
{
    new pID, targetname[MAX_PLAYER_NAME], name[MAX_PLAYER_NAME], string[128];
    if(GetPlayerSkin(playerid) == 280 && 281) // Both IDs are police officer
    {
        GetPlayerName(pID, targetname, sizeof(targetname));
        GetPlayerName(playerid, name, sizeof(name));
        if (isnull(params)) return SendClientMessage(playerid, -1, "Usage: /cuff <playerid>");
        format(string, sizeof(string), "You have been cuff by Police Officer %s", name);
        format(string,sizeof(string), "You have cuff player %s", targetname);
        SendClientMessage(pID, -1, string);
        SendClientMessage(playerid, -1, string);
        TogglePlayerControllable(pID, 0); // Freezes the player. Isn't /cuff in RP, a cmd to freeze?
       
    } else return SendClientMessage(playerid, -1, "You need to have a police skin !");
    return 1;
}
Then follow how I've done it, I use sscanf + zcmd for it.
Reply
#8

Well, let me show you guys how my class selection works actually If its needed:

case 32..37:
{
SetPlayerPos(playerid, 1528.6796,-1677.4059,5.8906);
SetPlayerFacingAngle(playerid,100.0);
SetPlayerCameraPos(playerid, 1524.8724,-1677.8083,5.8906);
SetPlayerCameraLookAt(playerid, 1524.8724,-1677.8083,5.8906);
GameTextForPlayer(playerid, "~b~Los Santos Police Department", 2000, 6);
SetPlayerColor(playerid,0x0000BBAA);
}

And in that code that RaZvYxXx posted I think It might turn out pretty well, but there is a error in the if (gTeam..blabla) line, And I dont really know how to fix that, so maybe with my class selection script you can help me out a little guys :P
Reply
#9

It's really stupid to learn strcmp now when you have zcmd and sscanf to use..

But yeah you can use the gTeam part to make teams.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)