After this all the bugs in my script are solved..
Well, i have a /detain and /undetain command i copied and pasted from New York Roleplay into Carlito's Roleplay
When i cuff the player though and /detain i get the message "Bla Bla has detained Bla Bla" or what ever it is.
However, it does not actually detain the player.. Just shows a message, and thats it, nothing else happens, the player is still out side the vehicle..
pawn Код:
if(strcmp(cmd, "/detain", true) ==0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pFaction] != 255 && DynamicFactions[PlayerInfo[playerid][pFaction]][fType] == 1)
{
if(CopOnDuty[playerid] == 0)
{
SendClientMessage(playerid, COLOR_GREY, "(ERROR) You are not on duty");
return 1;
}
if(IsPlayerInAnyVehicle(playerid))
{
SendClientMessage(playerid, COLOR_GREY, "(ERROR) You can not use this whilst in a car");
return 1;
}
tmp = strtok(cmdtext, idx);
if (!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "(USAGE) /detain [playerid/partofname] [seatid]");
return 1;
}
new carid = gLastCar[playerid];
giveplayerid = ReturnUser(tmp);
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
/*if(giveplayerid == playerid)
{
SendClientMessage(playerid, COLOR_GREY, "(ERROR) You can not detain yourself");
return 1;
}*/
tmp = strtok(cmdtext, idx);
new seat = strval(tmp);
if(seat < 1 || seat > 3) { SendClientMessage(playerid, COLOR_GREY, "(ERROR) The seat ID can not be above 3 or below 1"); return 1; }
if (!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "(USAGE) /detain [playerid/partofname] [seatid]");
return 1;
}
if(!ProxDetectorS(8.0, playerid, giveplayerid))
{
SendClientMessage(playerid, COLOR_GREY, "(ERROR) That player is not in range");
return 1;
}
if(PlayerCuffed[giveplayerid] > 0)
{
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "(INFO) You were detained by %s", sendername);
SendClientMessage(giveplayerid, COLOR_WHITE, string);
format(string, sizeof(string), "(INFO) You detained %s", giveplayer);
SendClientMessage(playerid, COLOR_WHITE, string);
format(string, sizeof(string), "%s grabs %s and throws him in the car", sendername ,giveplayer);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
GameTextForPlayer(giveplayerid, "~r~BUSTED", 2500, 3);
ClearAnimations(giveplayerid);
TogglePlayerControllable(giveplayerid, 0);
PutPlayerInVehicle(giveplayerid,carid,seat);
PlayerCuffed[giveplayerid] = 1;
}
else
{
SendClientMessage(playerid, COLOR_GREY, "(ERROR) That player is not cuffed");
return 1;
}
}
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, "(ERROR) Invalid faction");
}
}//not connected
return 1;
}
if(strcmp(cmd, "/undetain", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pFaction] != 255 && DynamicFactions[PlayerInfo[playerid][pFaction]][fType] == 1)
{
if(CopOnDuty[playerid] == 0)
{
SendClientMessage(playerid, COLOR_GREY, "(ERROR) You are not on duty");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, COLOR_WHITE, "(USAGE) /undetain [playerid/partofname]");
return 1;
}
giveplayerid = ReturnUser(tmp);
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
if(giveplayerid == playerid)
{
SendClientMessage(playerid, COLOR_GREY, "(ERROR) You can not undetain yourself");
return 1;
}
if (ProxDetectorS(8.0, playerid, giveplayerid))
{
if(PlayerCuffed[giveplayerid] == 1)
{
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "(INFO) You were undetained by %s", sendername);
SendClientMessage(giveplayerid, COLOR_WHITE, string);
format(string, sizeof(string), "(INFO) You undetained %s", giveplayer);
SendClientMessage(playerid, COLOR_WHITE, string);
TogglePlayerControllable(giveplayerid, 1);
RemovePlayerFromVehicle(giveplayerid);
TogglePlayerControllable(playerid, 1);
PlayerCuffed[giveplayerid] = 0;
}
else
{
SendClientMessage(playerid, COLOR_GREY, "(ERROR) That player is not detained");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, "(ERROR) That player is not in range");
return 1;
}
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, "(ERROR) That player is not connected");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, "(ERROR) Invalid faction");
}
}//not connected
return 1;
}