16.07.2015, 12:25
Use this
REP +1 Me if I helped you.
PHP код:
CMD:setstation(playerid, params[])
{
if(GetPVarType(playerid, "pBoomBox"))
{
if(GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK) return SendClientMessage(playerid, COLOR_GREY, " You must be crouched to turnon your boombox.");
if(!IsPlayerInRangeOfPoint(playerid, 3.0, GetPVarFloat(playerid, "pBoomBoxX"), GetPVarFloat(playerid, "pBoomBoxY"), GetPVarFloat(playerid, "pBoomBoxZ"))) return SendClientMessageEx(playerid, COLOR_WHITE, "You're not near in your BoomBox");
{
ShowPlayerDialogEx(playerid, DIALOG_BOOMBOX_START, DIALOG_STYLE_LIST, "Boombox", "Search by name\nFind by genre\nPlace Music URL", "Select", "Cancel");
}
}
else
{
SendClientMessageEx(playerid, COLOR_GRAD1, " You don't have a boombox place on the floor");
}
return 1;
}
PHP код:
CMD:pickupboombox(playerid, params[])
{
if(GetPVarType(playerid, "pBoomBox"))
{
if(GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK) return SendClientMessage(playerid, COLOR_GREY, " You must be crouched to pick a the boombox.");
if(!IsPlayerInRangeOfPoint(playerid, 3.0, GetPVarFloat(playerid, "pBoomBoxX"), GetPVarFloat(playerid, "pBoomBoxY"), GetPVarFloat(playerid, "pBoomBoxZ"))) return SendClientMessageEx(playerid, COLOR_WHITE, "You're not near in your BoomBox");
DestroyDynamicObject(GetPVarInt(playerid, "pBoomBox"));
DestroyDynamic3DTextLabel(Text3D:GetPVarInt(playerid, "pBoomBoxLabel"));
DeletePVar(playerid, "pBoomBox"); DeletePVar(playerid, "pBoomBoxStation"); DeletePVar(playerid, "pBoomBoxLabel");
DeletePVar(playerid, "pBoomBoxX"); DeletePVar(playerid, "pBoomBoxY"); DeletePVar(playerid, "pBoomBoxZ");
if(GetPVarType(playerid, "pBoomBoxArea"))
{
new string[128];
format(string, sizeof(string), "* %s has pickup their boombox.", GetPlayerNameEx(playerid));
ProxDetector(30.0, playerid, string, COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW);
foreach(Player, i)
{
if(IsPlayerInDynamicArea(i, GetPVarInt(playerid, "pBoomBoxArea")))
{
StopAudioStreamForPlayerEx(i);
SendClientMessage(i, COLOR_PURPLE, string);
}
}
DeletePVar(playerid, "pBoomBoxArea");
}
SendClientMessage(playerid, COLOR_WHITE, "You've pickup your boombox!");
}
else
{
foreach(Player, i)
{
if(GetPVarType(i, "pBoomBox"))
{
if(GetPVarInt(i, "pBoomBoxVW") == GetPlayerVirtualWorld(playerid) && GetPVarInt(i, "pBoomBoxInt") == GetPlayerInterior(playerid) && IsPlayerInRangeOfPoint(playerid, 5.0, GetPVarFloat(i, "pBoomBoxX"), GetPVarFloat(i, "pBoomBoxY"), GetPVarFloat(i, "pBoomBoxZ")))
{
if(GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK) return SendClientMessage(playerid, COLOR_GREY, " You must be crouched to pick a the boombox.");
if(!IsPlayerInRangeOfPoint(playerid, 3.0, GetPVarFloat(playerid, "pBoomBoxX"), GetPVarFloat(playerid, "pBoomBoxY"), GetPVarFloat(playerid, "pBoomBoxZ"))) return SendClientMessageEx(playerid, COLOR_WHITE, "You're not near in your BoomBox");
DestroyDynamicObject(GetPVarInt(i, "pBoomBox"));
DestroyDynamic3DTextLabel(Text3D:GetPVarInt(i, "pBoomBoxLabel"));
DeletePVar(i, "pBoomBox");
DeletePVar(i, "pBoomBoxStation");
DeletePVar(i, "pBoomBoxLabel");
DeletePVar(i, "pBoomBoxX");
DeletePVar(i, "pBoomBoxY");
DeletePVar(i, "pBoomBoxZ");
DeletePVar(i, "pBoomBoxInt");
DeletePVar(i, "pBoomBoxVW");
new string[128];
if(GetPVarType(i, "pBoomBoxArea"))
{
format(string, sizeof(string), "* %s has pickup their boombox.", GetPlayerNameEx(playerid));
for(new x=0; x<MAX_PLAYERS; x++)
{
if(IsPlayerInDynamicArea(x, GetPVarInt(x, "pBoomBoxArea")))
{
StopAudioStreamForPlayerEx(x);
SendClientMessage(x, COLOR_PURPLE, string);
}
}
DeletePVar(i, "pBoomBoxArea");
}
format(string, sizeof(string), "%s has pickup their boombox!", GetPlayerNameEx(playerid));
SendClientMessage(i, COLOR_WHITE, string);
return 1;
}
}
}
SendClientMessage(playerid, COLOR_WHITE, "You don't have a boombox or you are not near one to be pickup");
}
return 1;
}
PHP код:
CMD:placeboombox(playerid, params[])
{
if(PlayerInfo[playerid][pLevel] > 1)
{
if(GetPVarInt(playerid, "IsInArena") >= 0) return SendClientMessageEx(playerid, COLOR_WHITE, "You can't do this while being in an arena!");
// if(WatchingTV[playerid] != 0) return SendClientMessageEx(playerid, COLOR_GREY, "You can not do this while watching TV!");
if(GetPVarInt(playerid, "Injured") == 1 || PlayerInfo[playerid][pHospital] == 1 || IsPlayerInAnyVehicle(playerid)) return SendClientMessageEx(playerid, COLOR_WHITE, "You can't do this right now.");
if(GetPVarType(playerid, "pBoomBox")) return SendClientMessageEx(playerid, COLOR_WHITE, "You already have a boombox out, use /pickupboombox.");
foreach(Player, i)
{
if(GetPVarType(i, "pBoomBox"))
{
if(IsPlayerInRangeOfPoint(playerid, 30.0, GetPVarFloat(i, "pBoomBoxX"), GetPVarFloat(i, "pBoomBoxY"), GetPVarFloat(i, "pBoomBoxZ")))
{
SendClientMessage(playerid, COLOR_WHITE, "You are in range of another boombox, you can't place one here!");
return 1;
}
}
}
new string[128];
format(string, sizeof(string), "%s has placed a boombox! on the floor", GetPlayerNameEx(playerid));
ProxDetector(30.0, playerid, string, COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW);
new Float:x, Float:y, Float:z, Float:a;
GetPlayerPos(playerid, x, y, z);
GetPlayerFacingAngle(playerid, a);
ApplyAnimation(playerid,"BOMBER","BOM_Plant_Crouch_In", 4.0, 0, 0, 0, 0, 0, 1);
x += (2 * floatsin(-a, degrees));
y += (2 * floatcos(-a, degrees));
z -= 1.0;
SetPVarInt(playerid, "pBoomBox", CreateDynamicObject(2226, x, y, z, 0.0, 0.0, 0.0, .worldid = GetPlayerVirtualWorld(playerid), .interiorid = GetPlayerInterior(playerid)));
SetPVarFloat(playerid, "pBoomBoxX", x); SetPVarFloat(playerid, "pBoomBoxY", y); SetPVarFloat(playerid, "pBoomBoxZ", z);
format(string, sizeof(string), "%s's BoomBox\n{FF0000}/turnon {FFFF00}or\n{FF0000}/pickupboombox", GetPlayerNameEx(playerid));
SetPVarInt(playerid, "pBoomBoxLabel", _:CreateDynamic3DTextLabel(string, COLOR_YELLOW, x, y, z+0.6, 5.0, .worldid = GetPlayerVirtualWorld(playerid), .interiorid = GetPlayerInterior(playerid)));
SetPVarInt(playerid, "pBoomBoxArea", CreateDynamicSphere(x, y, z, 30.0, GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid)));
SetPVarInt(playerid, "pBoomBoxInt", GetPlayerInterior(playerid));
SetPVarInt(playerid, "pBoomBoxVW", GetPlayerVirtualWorld(playerid));
}
else
{
SendClientMessageEx(playerid, COLOR_GRAD1, "You are not Level 1+");
}
return 1;
}