CMD:detain(playerid, params[])
{
new playerb, seatid, string[128];
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
if(!IsACop(playerid) && !IsFBI(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not an NYPD Oficer/FBI Agent.");
if(sscanf(params, "ui", playerb, seatid)) return SendClientMessage(playerid, COLOR_WHITE, "[Usage]: /detain [playerid] [seatid]");
if(!IsPlayerLoggedIn(playerb)) return SendClientMessage(playerid, COLOR_GREY, "Invalid player id.");
if(!IsPlayerNearPlayer(playerid, playerb, 2)) return SendClientMessage(playerid, COLOR_GREY, "You can't detain someone from this disatance.");
if(!IsPlayerCuffed(playerb)) return SendClientMessage(playerid, COLOR_GREY, "Player is not cuffed.");
if(seatid < 2 || seatid > 3) return SendClientMessage(playerid, COLOR_GREY, "You can only detain people in seats 2 and 3.");
PutPlayerInVehicle(playerb, LastCar[playerid], seatid);
format(string, sizeof(string), "* %s grabs %s from their cuffs and throws him inside the NYPD cruiser.", RPN(playerid), RPN(playerb));
SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
return 1;
}
CMD:neon(playerid, params[])
{
new string[100];
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not in a vehicle.");
if(GetPlayerVehicleID(playerid) != PlayerInfo[playerid][pVeh] && GetPlayerVehicleID(playerid) != PlayerInfo[playerid][pVVeh]) return SendClientMessage(playerid, COLOR_GREY, "You are not in an owned vehicle.");
if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pVeh])
{
if(neon[playerid] == 1)
{
if(PlayerInfo[playerid][pNeon] == 0)
{
SendClientMessage(playerid, COLOR_GREY, "You don't have neons installed on this vehicle.");
}
if(PlayerInfo[playerid][pNeon] == 1)//red
{
SetPVarInt(playerid, "neon2", CreateDynamicObject(18647,0,0,0,0,0,0));
SetPVarInt(playerid, "neon3", CreateDynamicObject(18647,0,0,0,0,0,0));
AttachObjectToVehicle(GetPVarInt(playerid, "neon2"), GetPlayerVehicleID(playerid), -0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
AttachObjectToVehicle(GetPVarInt(playerid, "neon3"), GetPlayerVehicleID(playerid), 0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
format(string, sizeof(string), "* %s pushes a button on his dash and sparks his red neon tubes.", RPN(playerid));
SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
neon[playerid] = 0;
}
if(PlayerInfo[playerid][pNeon] == 2)//blue
{
SetPVarInt(playerid, "neon", CreateDynamicObject(18648,0,0,0,0,0,0));
SetPVarInt(playerid, "neon1", CreateDynamicObject(18648,0,0,0,0,0,0));
AttachObjectToVehicle(GetPVarInt(playerid, "neon"), GetPlayerVehicleID(playerid), -0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
AttachObjectToVehicle(GetPVarInt(playerid, "neon1"), GetPlayerVehicleID(playerid), 0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
format(string, sizeof(string), "* %s pushes a button on his dash and sparks his blue neon tubes.", RPN(playerid));
SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
neon[playerid] = 0;
}
if(PlayerInfo[playerid][pNeon] == 3)//green
{
SetPVarInt(playerid, "neon4", CreateDynamicObject(18649,0,0,0,0,0,0));
SetPVarInt(playerid, "neon5", CreateDynamicObject(18649,0,0,0,0,0,0));
AttachObjectToVehicle(GetPVarInt(playerid, "neon4"), GetPlayerVehicleID(playerid), -0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
AttachObjectToVehicle(GetPVarInt(playerid, "neon5"), GetPlayerVehicleID(playerid), 0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
format(string, sizeof(string), "* %s pushes a button on his dash and sparks his green neon tubes.", RPN(playerid));
SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
neon[playerid] = 0;
}
if(PlayerInfo[playerid][pNeon] == 4)//white
{
SetPVarInt(playerid, "neon6", CreateDynamicObject(18652,0,0,0,0,0,0));
SetPVarInt(playerid, "neon7", CreateDynamicObject(18652,0,0,0,0,0,0));
AttachObjectToVehicle(GetPVarInt(playerid, "neon6"), GetPlayerVehicleID(playerid), -0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
AttachObjectToVehicle(GetPVarInt(playerid, "neon7"), GetPlayerVehicleID(playerid), 0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
format(string, sizeof(string), "* %s pushes a button on his dash and sparks his white neon tubes.", RPN(playerid));
SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
neon[playerid] = 0;
}
if(PlayerInfo[playerid][pNeon] == 5)//pink
{
SetPVarInt(playerid, "neon8", CreateDynamicObject(18651,0,0,0,0,0,0));
SetPVarInt(playerid, "neon9", CreateDynamicObject(18651,0,0,0,0,0,0));
AttachObjectToVehicle(GetPVarInt(playerid, "neon8"), GetPlayerVehicleID(playerid), -0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
AttachObjectToVehicle(GetPVarInt(playerid, "neon9"), GetPlayerVehicleID(playerid), 0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
format(string, sizeof(string), "* %s pushes a button on his dash and sparks his pink neon tubes.", RPN(playerid));
SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
neon[playerid] = 0;
}
if(PlayerInfo[playerid][pNeon] == 6)//yellow
{
SetPVarInt(playerid, "neon10", CreateDynamicObject(18650,0,0,0,0,0,0));
SetPVarInt(playerid, "neon11", CreateDynamicObject(18650,0,0,0,0,0,0));
AttachObjectToVehicle(GetPVarInt(playerid, "neon10"), GetPlayerVehicleID(playerid), -0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
AttachObjectToVehicle(GetPVarInt(playerid, "neon11"), GetPlayerVehicleID(playerid), 0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
format(string, sizeof(string), "* %s pushes a button on his dash and sparks his yellow neon tubes.", RPN(playerid));
SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
neon[playerid] = 0;
}
if(Bikes(GetPlayerVehicleID(playerid)))
{
if(PlayerInfo[playerid][pNeon] == 1)//red
{
SetPVarInt(playerid, "nb1", CreateDynamicObject(18647,0,0,0,0,0,0));
AttachObjectToVehicle(GetPVarInt(playerid, "nb1"), GetPlayerVehicleID(playerid), 0.0, 0.0, -0.70, 0.0, 0.0, 0.0);
DestroyObject(GetPVarInt(playerid, "neon2"));
DestroyObject(GetPVarInt(playerid, "neon3"));
neon[playerid] = 0;
}
if(PlayerInfo[playerid][pNeon] == 2)//blue
{
SetPVarInt(playerid, "nb2", CreateDynamicObject(18648,0,0,0,0,0,0));
AttachObjectToVehicle(GetPVarInt(playerid, "nb2"), GetPlayerVehicleID(playerid), 0.0, 0.0, -0.70, 0.0, 0.0, 0.0);
DestroyObject(GetPVarInt(playerid, "neon"));
DestroyObject(GetPVarInt(playerid, "neon1"));
neon[playerid] = 0;
}
if(PlayerInfo[playerid][pNeon] == 3)//green
{
SetPVarInt(playerid, "nb3", CreateDynamicObject(18649,0,0,0,0,0,0));
AttachObjectToVehicle(GetPVarInt(playerid, "nb3"), GetPlayerVehicleID(playerid), 0.0, 0.0, -0.70, 0.0, 0.0, 0.0);
DestroyObject(GetPVarInt(playerid, "neon4"));
DestroyObject(GetPVarInt(playerid, "neon5"));
neon[playerid] = 0;
}
if(PlayerInfo[playerid][pNeon] == 4)//white
{
SetPVarInt(playerid, "nb4", CreateDynamicObject(18652,0,0,0,0,0,0));
AttachObjectToVehicle(GetPVarInt(playerid, "nb4"), GetPlayerVehicleID(playerid), 0.0, 0.0, -0.70, 0.0, 0.0, 0.0);
DestroyObject(GetPVarInt(playerid, "neon6"));
DestroyObject(GetPVarInt(playerid, "neon7"));
neon[playerid] = 0;
}
if(PlayerInfo[playerid][pNeon] == 5)//pink
{
SetPVarInt(playerid, "nb5", CreateDynamicObject(18651,0,0,0,0,0,0));
AttachObjectToVehicle(GetPVarInt(playerid, "nb5"), GetPlayerVehicleID(playerid), 0.0, 0.0, -0.70, 0.0, 0.0, 0.0);
DestroyObject(GetPVarInt(playerid, "neon8"));
DestroyObject(GetPVarInt(playerid, "neon9"));
neon[playerid] = 0;
}
if(PlayerInfo[playerid][pNeon] == 6)//yellow
{
SetPVarInt(playerid, "nb6", CreateDynamicObject(18650,0,0,0,0,0,0));
AttachObjectToVehicle(GetPVarInt(playerid, "nb6"), GetPlayerVehicleID(playerid), 0.0, 0.0, -0.70, 0.0, 0.0, 0.0);
DestroyObject(GetPVarInt(playerid, "neon10"));
DestroyObject(GetPVarInt(playerid, "neon11"));
neon[playerid] = 0;
}
}
}
CMD:detain(playerid, params[])
{
if(gTeam[playerid] == 2 || IsACop(playerid) || PlayerInfo[playerid][pMember] == 12)
{
if(IsPlayerInAnyVehicle(playerid))
{
SendClientMessageEx(playerid, COLOR_GREY, "You can't do this while you're in a vehicle.");
return 1;
}
new string[128], giveplayerid, seat;
if(sscanf(params, "ud", giveplayerid, seat)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /detain [playerid] [seatid 1-3]");
if(IsPlayerConnected(giveplayerid))
{
if(seat < 1 || seat > 3)
{
SendClientMessageEx(playerid, COLOR_GRAD1, "The seat ID cannot be above 3 or below 1.");
return 1;
}
if(gTeam[giveplayerid] == 2 || IsACop(giveplayerid))
{
SendClientMessageEx(playerid, COLOR_GREY, "You can't detain other law enforcement officers.");
return 1;
}
if(IsPlayerInAnyVehicle(giveplayerid))
{
SendClientMessageEx(playerid, COLOR_GREY, "That person is in a car - get them out first.");
return 1;
}
if (ProxDetectorS(8.0, playerid, giveplayerid))
{
if(giveplayerid == playerid) { SendClientMessageEx(playerid, COLOR_GREY, "You cannot detain yourself!"); return 1; }
if(PlayerCuffed[giveplayerid] == 2)
{
new carid = gLastCar[playerid];
if(IsSeatAvailable(carid, seat))
{
new Float:pos[6];
GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
GetPlayerPos(giveplayerid, pos[3], pos[4], pos[5]);
GetVehiclePos( carid, pos[0], pos[1], pos[2]);
if (floatcmp(floatabs(floatsub(pos[0], pos[3])), 10.0) != -1 &&
floatcmp(floatabs(floatsub(pos[1], pos[4])), 10.0) != -1 &&
floatcmp(floatabs(floatsub(pos[2], pos[5])), 10.0) != -1) return false;
format(string, sizeof(string), "* You were detained by %s .", GetPlayerNameEx(playerid));
SendClientMessageEx(giveplayerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "* You detained %s .", GetPlayerNameEx(giveplayerid));
SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "* %s throws %s in the vehicle.", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid));
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
GameTextForPlayer(giveplayerid, "~r~Detained", 2500, 3);
ClearAnimations(giveplayerid);
TogglePlayerControllable(giveplayerid, false);
PutPlayerInVehicle(giveplayerid, carid, seat);
}
else
{
SendClientMessageEx(playerid, COLOR_GREY, "That seat isn't available!");
return 1;
}
}
else
{
SendClientMessageEx(playerid, COLOR_GREY, "That person isn't cuffed.");
return 1;
}
}
else
{
SendClientMessageEx(playerid, COLOR_GREY, " You're not close enough to the player or your car!");
return 1;
}
}
else
{
SendClientMessageEx(playerid, COLOR_GREY, "Invalid player specified.");
return 1;
}
}
else
{
SendClientMessageEx(playerid, COLOR_GRAD2, " You are not a Cop / FBI / Coastguard!");
}
return 1;
}
|
/detain -
[I copied from script thats working] 100% Код:
CMD:detain(playerid, params[])
{
if(gTeam[playerid] == 2 || IsACop(playerid) || PlayerInfo[playerid][pMember] == 12)
{
if(IsPlayerInAnyVehicle(playerid))
{
SendClientMessageEx(playerid, COLOR_GREY, "You can't do this while you're in a vehicle.");
return 1;
}
new string[128], giveplayerid, seat;
if(sscanf(params, "ud", giveplayerid, seat)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /detain [playerid] [seatid 1-3]");
if(IsPlayerConnected(giveplayerid))
{
if(seat < 1 || seat > 3)
{
SendClientMessageEx(playerid, COLOR_GRAD1, "The seat ID cannot be above 3 or below 1.");
return 1;
}
if(gTeam[giveplayerid] == 2 || IsACop(giveplayerid))
{
SendClientMessageEx(playerid, COLOR_GREY, "You can't detain other law enforcement officers.");
return 1;
}
if(IsPlayerInAnyVehicle(giveplayerid))
{
SendClientMessageEx(playerid, COLOR_GREY, "That person is in a car - get them out first.");
return 1;
}
if (ProxDetectorS(8.0, playerid, giveplayerid))
{
if(giveplayerid == playerid) { SendClientMessageEx(playerid, COLOR_GREY, "You cannot detain yourself!"); return 1; }
if(PlayerCuffed[giveplayerid] == 2)
{
new carid = gLastCar[playerid];
if(IsSeatAvailable(carid, seat))
{
new Float:pos[6];
GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
GetPlayerPos(giveplayerid, pos[3], pos[4], pos[5]);
GetVehiclePos( carid, pos[0], pos[1], pos[2]);
if (floatcmp(floatabs(floatsub(pos[0], pos[3])), 10.0) != -1 &&
floatcmp(floatabs(floatsub(pos[1], pos[4])), 10.0) != -1 &&
floatcmp(floatabs(floatsub(pos[2], pos[5])), 10.0) != -1) return false;
format(string, sizeof(string), "* You were detained by %s .", GetPlayerNameEx(playerid));
SendClientMessageEx(giveplayerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "* You detained %s .", GetPlayerNameEx(giveplayerid));
SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "* %s throws %s in the vehicle.", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid));
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
GameTextForPlayer(giveplayerid, "~r~Detained", 2500, 3);
ClearAnimations(giveplayerid);
TogglePlayerControllable(giveplayerid, false);
PutPlayerInVehicle(giveplayerid, carid, seat);
}
else
{
SendClientMessageEx(playerid, COLOR_GREY, "That seat isn't available!");
return 1;
}
}
else
{
SendClientMessageEx(playerid, COLOR_GREY, "That person isn't cuffed.");
return 1;
}
}
else
{
SendClientMessageEx(playerid, COLOR_GREY, " You're not close enough to the player or your car!");
return 1;
}
}
else
{
SendClientMessageEx(playerid, COLOR_GREY, "Invalid player specified.");
return 1;
}
}
else
{
SendClientMessageEx(playerid, COLOR_GRAD2, " You are not a Cop / FBI / Coastguard!");
}
return 1;
}
|