im have this BoomBox script and All Can place a boombox im want The Players to buy it from the 24/7 in my RP Server then can use it! Please Help me
pawn Код:
#define FILTERSCRIPT
#include <a_samp>
#include <zcmd>
#include <sscanf2>
#include <streamer>
#include <foreach>
//COLOURS
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_WHITE 0xFFFFFFAA
#define COLOR_PURPLE 0xC2A2DAAA
//Boombox Dialog
#define DIALOG_BOOMBOX 31997
#define DIALOG_BOOMBOX1 31998
#define DIALOG_BOOMBOX2 31999
#define DIALOG_BOOMBOX3 32000
#define DIALOG_BOOMBOX4 32001
#define DIALOG_BOOMBOX5 32002
#define DIALOG_BOOMBOX6 32003
#define DIALOG_BOOMBOX7 32004
new gPlayerLoggin[MAX_PLAYERS char];
public OnPlayerConnect(playerid)
{
gPlayerLoggin{playerid} = 1;
return 1;
}
public OnPlayerDisconnect(playerid)
{
if(GetPVarType(playerid, "pDynamicBB"))
{
DestroyDynamicObject(GetPVarInt(playerid, "pDynamicBB"));
DestroyDynamic3DTextLabel(Text3D:GetPVarInt(playerid, "pDynamicBBLabel"));
if(GetPVarType(playerid, "pDynamicBBArea"))
{
new string[128];
format(string, sizeof(string), "The boombox owner (%s) has logged off", SenderName(playerid));
foreach(Player, i)
{
if(IsPlayerInDynamicArea(i, GetPVarInt(playerid, "pDynamicBBArea")))
{
StopAudioEx(i);
SendClientMessage(i, COLOR_PURPLE, string);
}
}
}
}
return 1;
}
CMD:placeboombox(playerid, params[])
{
if(GetPVarType(playerid, "pDynamicBB")) return SendClientMessage(playerid, COLOR_WHITE, "You already have a boombox out, use /pickupboombox.");
foreach(Player, i)
{
if(GetPVarType(i, "pDynamicBB"))
{
if(IsPlayerInRangeOfPoint(playerid, 30.0, GetPVarFloat(i, "pDynamicBBX"), GetPVarFloat(i, "pDynamicBBY"), GetPVarFloat(i, "pDynamicBBZ")))
{
SendClientMessage(playerid, COLOR_WHITE, "You cannot put your boombox in this Radius");
return 1;
}
}
new string[128];
format(string, sizeof(string), "%s has placed a boombox on the floor!", SenderName(playerid));
SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
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, "pDynamicBB", CreateDynamicObject(2226, x, y, z, 0.0, 0.0, 0.0, .worldid = GetPlayerVirtualWorld(playerid), .interiorid = GetPlayerInterior(playerid)));
SetPVarFloat(playerid, "pDynamicBBX", x); SetPVarFloat(playerid, "pDynamicBBY", y); SetPVarFloat(playerid, "pDynamicBBZ", z);
format(string, sizeof(string), "{00FF00}Boombox Owner:{FFFFFF}%s\n{FF0000}/turnon{FFFFFF} to set your boombox \n{FFFF00}or\n{FF0000}/pickupboombox", SenderName(playerid));
SetPVarInt(playerid, "pDynamicBBLabel", _:CreateDynamic3DTextLabel(string, COLOR_WHITE, x, y, z+0.6, 5.0, .worldid = GetPlayerVirtualWorld(playerid), .interiorid = GetPlayerInterior(playerid)));
SetPVarInt(playerid, "pDynamicBBArea", CreateDynamicSphere(x, y, z, 30.0, GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid)));
SetPVarInt(playerid, "pDynamicBBInt", GetPlayerInterior(playerid));
SetPVarInt(playerid, "pDynamicBBVW", GetPlayerVirtualWorld(playerid));
}
return 1;
}
CMD:turnon(playerid, params[])
{
if(GetPVarType(playerid, "pDynamicBB"))
{
if(GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK) return SendClientMessage(playerid, COLOR_WHITE, " You must be crouched to set your boombox.");
if(IsPlayerInRangeOfPoint(playerid, 3.0, GetPVarFloat(playerid, "pDynamicBBX"), GetPVarFloat(playerid, "pDynamicBBY"), GetPVarFloat(playerid, "pDynamicBBZ")))
{
ShowPlayerDialog(playerid,DIALOG_BOOMBOX,DIALOG_STYLE_LIST,"Radio Menu","Jazz\nPop\nRap\nR&B and Urban\nRock\nPlace a URL\nTurn Off Boombox","Select", "Cancel");
}
else
{
return SendClientMessage(playerid, COLOR_WHITE, "You're not near in your BoomBox");
}
}
else
{
SendClientMessage(playerid, COLOR_WHITE, " You don't have a boombox place on the floor");
}
return 1;
}
CMD:pickupboombox(playerid, params[])
{
if(GetPVarType(playerid, "pDynamicBB"))
{
if(GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK) return SendClientMessage(playerid, COLOR_WHITE, " You must be crouched to pick a the boombox.");
if(!IsPlayerInRangeOfPoint(playerid, 3.0, GetPVarFloat(playerid, "pDynamicBBX"), GetPVarFloat(playerid, "pDynamicBBY"), GetPVarFloat(playerid, "pDynamicBBZ"))) return SendClientMessage(playerid, COLOR_WHITE, "You're not near in your BoomBox");
DestroyDynamicObject(GetPVarInt(playerid, "pDynamicBB"));
DestroyDynamic3DTextLabel(Text3D:GetPVarInt(playerid, "pDynamicBBLabel"));
DeletePVar(playerid, "pDynamicBB"); DeletePVar(playerid, "pDynamicBBStation"); DeletePVar(playerid, "pDynamicBBLabel");
DeletePVar(playerid, "pDynamicBBX"); DeletePVar(playerid, "pDynamicBBY"); DeletePVar(playerid, "pDynamicBBZ");
if(GetPVarType(playerid, "pDynamicBBArea"))
{
new string[128];
format(string, sizeof(string), "* %s has pickup their boombox.", SenderName(playerid));
SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
foreach(Player, i)
{
if(IsPlayerInDynamicArea(i, GetPVarInt(playerid, "pDynamicBBArea")))
{
StopAudioEx(i);
SendClientMessage(i, COLOR_PURPLE, string);
}
}
DeletePVar(playerid, "pDynamicBBArea");
}
SendClientMessage(playerid, COLOR_WHITE, "You've pickup your boombox!");
}
else
{
foreach(Player, i)
{
if(GetPVarType(i, "pDynamicBB"))
{
if(GetPVarInt(i, "pDynamicBBVW") == GetPlayerVirtualWorld(playerid) && GetPVarInt(i, "pDynamicBBInt") == GetPlayerInterior(playerid) && IsPlayerInRangeOfPoint(playerid, 5.0, GetPVarFloat(i, "pDynamicBBX"), GetPVarFloat(i, "pDynamicBBY"), GetPVarFloat(i, "pDynamicBBZ")))
{
if(GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK) return SendClientMessage(playerid, COLOR_WHITE, " You must be crouched to pick a the boombox.");
if(!IsPlayerInRangeOfPoint(playerid, 3.0, GetPVarFloat(playerid, "pDynamicBBX"), GetPVarFloat(playerid, "pDynamicBBY"), GetPVarFloat(playerid, "pDynamicBBZ"))) return SendClientMessage(playerid, COLOR_WHITE, "You're not near in your BoomBox");
DestroyDynamicObject(GetPVarInt(i, "pDynamicBB"));
DestroyDynamic3DTextLabel(Text3D:GetPVarInt(i, "pDynamicBBLabel"));
DeletePVar(i, "pDynamicBB");
DeletePVar(i, "pDynamicBBStation");
DeletePVar(i, "pDynamicBBLabel");
DeletePVar(i, "pDynamicBBX");
DeletePVar(i, "pDynamicBBY");
DeletePVar(i, "pDynamicBBZ");
DeletePVar(i, "pDynamicBBInt");
DeletePVar(i, "pDynamicBBVW");
new string[128];
if(GetPVarType(i, "pDynamicBBArea"))
{
for(new x=0; x<MAX_PLAYERS; x++)
{
if(IsPlayerInDynamicArea(x, GetPVarInt(x, "pDynamicBBArea")))
{
StopAudioEx(x);
SendClientMessage(x, COLOR_PURPLE, string);
}
}
DeletePVar(i, "pDynamicBBArea");
}
return 1;
}
}
}
SendClientMessage(playerid, COLOR_WHITE, "You don't have a boombox or you are not near one to be pickup");
}
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == DIALOG_BOOMBOX)
{
if(!response)
{
SendClientMessage(playerid, COLOR_WHITE, " You cancel the Radio Station");
return 1;
}
switch(listitem)
{
case 0:
{
ShowPlayerDialog(playerid,DIALOG_BOOMBOX1,DIALOG_STYLE_LIST,"Jazz","Classical 102","Select","Cancel");
}
case 1:
{
ShowPlayerDialog(playerid,DIALOG_BOOMBOX2,DIALOG_STYLE_LIST,"Pop","DEFJAY.DE - 100% R&B! (GERMANY)","Select","Cancel");
}
case 2:
{
ShowPlayerDialog(playerid,DIALOG_BOOMBOX3,DIALOG_STYLE_LIST,"Rap","BlackBeats.FM - finest in blackbeats","Select","Cancel");
}
case 3:
{
ShowPlayerDialog(playerid,DIALOG_BOOMBOX4,DIALOG_STYLE_LIST,"R&B and Urban","DEFJAY.COM - 100% R&B! (USA/Europe)","Select","Cancel");
}
case 4:
{
ShowPlayerDialog(playerid,DIALOG_BOOMBOX5,DIALOG_STYLE_LIST,"Rock",".977 The Hitz Channel - 977MUSIC.COM","Select","Cancel");
}
case 5:
{
ShowPlayerDialog(playerid,DIALOG_BOOMBOX6,DIALOG_STYLE_INPUT, "Boombox Input URL", "Please put a Music URL to play the Music", "Okay", "Cancel");
}
case 6:
{
if(GetPVarType(playerid, "pDynamicBBArea"))
{
new string[128];
format(string, sizeof(string), "* %s turn off their boombox.", SenderName(playerid));
SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
foreach(Player, i)
{
if(IsPlayerInDynamicArea(i, GetPVarInt(playerid, "pDynamicBBArea")))
{
StopAudioEx(i);
SendClientMessage(i, COLOR_PURPLE, string);
}
}
DeletePVar(playerid, "pDynamicBBArea");
}
SendClientMessage(playerid, COLOR_WHITE, "You've turn off your boombox");
}
}
return 1;
}
if(dialogid == DIALOG_BOOMBOX1)
{
if(!response)
{
ShowPlayerDialog(playerid,DIALOG_BOOMBOX,DIALOG_STYLE_LIST,"Radio List","Jazz\nPop\nRap\nR&B and Urban\nRock","Select", "Cancel");
}
if(response)
{
if(listitem == 0)
{
if(GetPVarType(playerid, "pDynamicBB"))
{
foreach(Player, i)
{
if(IsPlayerInDynamicArea(i, GetPVarInt(playerid, "pDynamicBBArea")))
{
PlayAudioEx(i, "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1676910", GetPVarFloat(playerid, "pDynamicBBX"), GetPVarFloat(playerid, "pDynamicBBY"), GetPVarFloat(playerid, "pDynamicBBZ"), 30.0, 1);
}
}
SetPVarString(playerid, "pDynamicBBStation", "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1676910");
}
}
}
return 1;
}
if(dialogid == DIALOG_BOOMBOX2)
{
if(!response)
{
ShowPlayerDialog(playerid,DIALOG_BOOMBOX,DIALOG_STYLE_LIST,"Radio List","Jazz\nPop\nRap\nR&B and Urban\nRock","Select", "Cancel");
}
if(response)
{
if(listitem == 0)
{
if(GetPVarType(playerid, "pDynamicBB"))
{
foreach(Player, i)
{
if(IsPlayerInDynamicArea(i, GetPVarInt(playerid, "pDynamicBBArea")))
{
PlayAudioEx(i, "http://yp.shoutcast.com/sbin/tunein-station.pls?id=65456", GetPVarFloat(playerid, "pDynamicBBX"), GetPVarFloat(playerid, "pDynamicBBY"), GetPVarFloat(playerid, "pDynamicBBZ"), 30.0, 1);
}
}
SetPVarString(playerid, "pDynamicBBStation", "http://yp.shoutcast.com/sbin/tunein-station.pls?id=65456");
}
}
}
return 1;
}
if(dialogid == DIALOG_BOOMBOX3)
{
if(!response)
{
ShowPlayerDialog(playerid,DIALOG_BOOMBOX,DIALOG_STYLE_LIST,"Radio List","Jazz\nPop\nRap\nR&B and Urban\nRock","Select", "Cancel");
}
if(response)
{
if(listitem == 0)
{
if(GetPVarType(playerid, "pDynamicBB"))
{
foreach(Player, i)
{
if(IsPlayerInDynamicArea(i, GetPVarInt(playerid, "pDynamicBBArea")))
{
PlayAudioEx(i, "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1543115", GetPVarFloat(playerid, "pDynamicBBX"), GetPVarFloat(playerid, "pDynamicBBY"), GetPVarFloat(playerid, "pDynamicBBZ"), 30.0, 1);
}
}
SetPVarString(playerid, "pDynamicBBStation", "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1543115");
}
}
}
return 1;
}
if(dialogid == DIALOG_BOOMBOX4)
{
if(!response)
{
ShowPlayerDialog(playerid,DIALOG_BOOMBOX,DIALOG_STYLE_LIST,"Radio List","Jazz\nPop\nRap\nR&B and Urban\nRock","Select", "Cancel");
}
if(response)
{
if(listitem == 0)
{
if(GetPVarType(playerid, "pDynamicBB"))
{
foreach(Player, i)
{
if(IsPlayerInDynamicArea(i, GetPVarInt(playerid, "pDynamicBBArea")))
{
PlayAudioEx(i, "http://yp.shoutcast.com/sbin/tunein-station.pls?id=616366", GetPVarFloat(playerid, "pDynamicBBX"), GetPVarFloat(playerid, "pDynamicBBY"), GetPVarFloat(playerid, "pDynamicBBZ"), 30.0, 1);
}
}
SetPVarString(playerid, "pDynamicBBStation", "http://yp.shoutcast.com/sbin/tunein-station.pls?id=616366");
}
}
}
return 1;
}
if(dialogid == DIALOG_BOOMBOX5)
{
if(!response)
{
ShowPlayerDialog(playerid,DIALOG_BOOMBOX,DIALOG_STYLE_LIST,"Radio List","Jazz\nPop\nRap\nR&B and Urban\nRock","Select", "Cancel");
}
if(response)
{
if(listitem == 0)
{
if(GetPVarType(playerid, "pDynamicBB"))
{
foreach(Player, i)
{
if(IsPlayerInDynamicArea(i, GetPVarInt(playerid, "pDynamicBBArea")))
{
PlayAudioEx(i, "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1280356", GetPVarFloat(playerid, "pDynamicBBX"), GetPVarFloat(playerid, "pDynamicBBY"), GetPVarFloat(playerid, "pDynamicBBZ"), 30.0, 1);
}
}
SetPVarString(playerid, "pDynamicBBStation", "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1280356");
}
}
}
return 1;
}
if(dialogid == DIALOG_BOOMBOX6)
{
if(response == 1)
{
if(isnull(inputtext))
{
SendClientMessage(playerid, COLOR_WHITE, "You did not enter anything" );
return 1;
}
if(strlen(inputtext))
{
if(GetPVarType(playerid, "pDynamicBB"))
{
foreach(Player, i)
{
if(IsPlayerInDynamicArea(i, GetPVarInt(playerid, "pDynamicBBArea")))
{
PlayAudioEx(i, inputtext, GetPVarFloat(playerid, "pDynamicBBX"), GetPVarFloat(playerid, "pDynamicBBY"), GetPVarFloat(playerid, "pDynamicBBZ"), 30.0, 1);
}
}
SetPVarString(playerid, "pDynamicBBStation", inputtext);
}
}
}
else
{
return 1;
}
}
return 1;
}
public OnPlayerEnterDynamicArea(playerid, areaid)
{
foreach(Player, i)
{
if(GetPVarType(i, "pDynamicBBArea"))
{
if(areaid == GetPVarInt(i, "pDynamicBBArea"))
{
new station[256];
GetPVarString(i, "pDynamicBBStation", station, sizeof(station));
if(!isnull(station))
{
PlayAudioEx(playerid, station, GetPVarFloat(i, "pDynamicBBX"), GetPVarFloat(i, "pDynamicBBY"), GetPVarFloat(i, "pDynamicBBZ"), 30.0, 1);
}
return 1;
}
}
}
return 1;
}
public OnPlayerLeaveDynamicArea(playerid, areaid)
{
foreach(Player, i)
{
if(GetPVarType(i, "pDynamicBBArea"))
{
if(areaid == GetPVarInt(i, "pDynamicBBArea"))
{
StopAudioEx(playerid);
return 1;
}
}
}
return 1;
}
stock StopAudioEx(playerid)
{
DeletePVar(playerid, "pAudioStream");
StopAudioStreamForPlayer(playerid);
}
stock PlayAudioEx(playerid, url[], Float:posX = 0.0, Float:posY = 0.0, Float:posZ = 0.0, Float:distance = 50.0, usepos = 0)
{
if(GetPVarType(playerid, "pAudioStream")) StopAudioStreamForPlayer(playerid);
else SetPVarInt(playerid, "pAudioStream", 1);
PlayAudioStreamForPlayer(playerid, url, posX, posY, posZ, distance, usepos);
}
stock SenderName(playerid)
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
return name;
}
stock SendNearbyMessage(playerid, Float:radius, string[], col1, col2, col3, col4, col5)
{
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
new Float:ix, Float:iy, Float:iz;
new Float:cx, Float:cy, Float:cz;
foreach(Player, i)
{
if(gPlayerLoggin{i})
{
if(GetPlayerInterior(playerid) == GetPlayerInterior(i) && GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(i))
{
GetPlayerPos(i, ix, iy, iz);
cx = (x - ix);
cy = (y - iy);
cz = (z - iz);
if(((cx < radius/16) && (cx > -radius/16)) && ((cy < radius/16) && (cy > -radius/16)) && ((cz < radius/16) && (cz > -radius/16)))
{
SendClientMessage(i, col1, string);
}
else if(((cx < radius/8) && (cx > -radius/8)) && ((cy < radius/8) && (cy > -radius/8)) && ((cz < radius/8) && (cz > -radius/8)))
{
SendClientMessage(i, col2, string);
}
else if(((cx < radius/4) && (cx > -radius/4)) && ((cy < radius/4) && (cy > -radius/4)) && ((cz < radius/4) && (cz > -radius/4)))
{
SendClientMessage(i, col3, string);
}
else if(((cx < radius/2) && (cx > -radius/2)) && ((cy < radius/2) && (cy > -radius/2)) && ((cz < radius/2) && (cz > -radius/2)))
{
SendClientMessage(i, col4, string);
}
else if(((cx < radius) && (cx > -radius)) && ((cy < radius) && (cy > -radius)) && ((cz < radius) && (cz > -radius)))
{
SendClientMessage(i, col5, string);
}
}
}
}
return 1;
}
You can't post an entire script which is about 1000 lines long, and expect us to write an entire system for you. This isn't a small scripting snippet that you're requesting.
PHP код:
CMD:placeboombox(playerid, params[])
{
if(PlayerInfo[playerid][pBoomBox] == 0) return SendClientMessage(playerid, COLOR_WHITE, "You don't have a BoomBox");
if(GetPVarType(playerid, "pDynamicBB")) return SendClientMessage(playerid, COLOR_WHITE, "You already have a boombox out, use /pickupboombox.");
foreach(Player, i)
{
if(GetPVarType(i, "pDynamicBB"))
{
if(IsPlayerInRangeOfPoint(playerid, 30.0, GetPVarFloat(i, "pDynamicBBX"), GetPVarFloat(i, "pDynamicBBY"), GetPVarFloat(i, "pDynamicBBZ")))
{
SendClientMessage(playerid, COLOR_WHITE, "You cannot put your boombox in this Radius");
return 1;
}
}
new string[128];
format(string, sizeof(string), "%s has placed a boombox on the floor!", SenderName(playerid));
SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
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, "pDynamicBB", CreateDynamicObject(2226, x, y, z, 0.0, 0.0, 0.0, .worldid = GetPlayerVirtualWorld(playerid), .interiorid = GetPlayerInterior(playerid)));
SetPVarFloat(playerid, "pDynamicBBX", x); SetPVarFloat(playerid, "pDynamicBBY", y); SetPVarFloat(playerid, "pDynamicBBZ", z);
format(string, sizeof(string), "{00FF00}Boombox Owner:{FFFFFF}%s\n{FF0000}/turnon{FFFFFF} to set your boombox \n{FFFF00}or\n{FF0000}/pickupboombox", SenderName(playerid));
SetPVarInt(playerid, "pDynamicBBLabel", _:CreateDynamic3DTextLabel(string, COLOR_WHITE, x, y, z+0.6, 5.0, .worldid = GetPlayerVirtualWorld(playerid), .interiorid = GetPlayerInterior(playerid)));
SetPVarInt(playerid, "pDynamicBBArea", CreateDynamicSphere(x, y, z, 30.0, GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid)));
SetPVarInt(playerid, "pDynamicBBInt", GetPlayerInterior(playerid));
SetPVarInt(playerid, "pDynamicBBVW", GetPlayerVirtualWorld(playerid));
}
return 1;
}