Код:
if(strcmp(cmd, "/esposar", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(gTeam[playerid] == 2 || IsACop(playerid) || PlayerInfo[playerid][pMember] == 1 ||PlayerInfo[playerid][pLeader] == 1)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, COLOR_WHITE, "USA: /esposar [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, " No puedes esposar policias !");
return 1;
}
if(PlayerCuffed[giveplayerid] > 0)
{
SendClientMessage(playerid, COLOR_GREY, " Jugador ya esta esposado!");
return 1;
}
if (ProxDetectorS(8.0, playerid, giveplayerid))
{
// new car = GetPlayerVehicleID(playerid);
//if(giveplayerid == playerid) { SendClientMessage(playerid, COLOR_GREY, "No te puedes esposar a ti mismo!"); return 1; }
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "> Has sido esposado por %s, espera que el policia decida.", sendername);
SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "> Esposaste a %s.", giveplayer);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
PlayerCuffed[giveplayerid] = 2;
PlayerCuffedTime[giveplayerid] = 180;
SetPlayerSpecialAction(giveplayerid, SPECIAL_ACTION_CUFFED);
SetPlayerAttachedObject(giveplayerid, 0, 19418, 6, -0.011000, 0.028000, -0.022000, -15.600012, -33.699977, -81.700035, 0.891999, 1.000000, 1.168000);
}
else
{
SendClientMessage(playerid, COLOR_GREY, " Jugador no Cerca !");
return 1;
}
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " Jugador no conectado !");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " No eres un Policia / FBI / S.W.A.T !");
}
}
return 1;
}
if(strcmp(cmd, "/desesposar", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pMember] == 1 ||PlayerInfo[playerid][pLeader] == 1)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, COLOR_WHITE, "USA: /desesposar [Playerid/PartOfName]");
return 1;
}
giveplayerid = ReturnUser(tmp);
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
if (ProxDetectorS(8.0, playerid, giveplayerid))
{
if(PlayerCuffed[giveplayerid])
{
GameTextForPlayer(giveplayerid, "~g~ESPERA AL POLICIA", 2500, 3);
RemovePlayerAttachedObject(giveplayerid, playerid);
SetPlayerSpecialAction(playerid,SPECIAL_ACTION_NONE);
PlayerCuffed[giveplayerid] = 0;
}
else
{
SendClientMessage(playerid, COLOR_GREY, " No esta amarrado !");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " El jugador no esta cerca de ti !");
return 1;
}
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " El jugador no esta en linea !");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " No eres un Policia / FBI / S.W.A.T !");
}
}//not connected
return 1;
}