PDA

View Full Version : Boombox Help


San1
11/11/2012, 08:07 AM
The 3d label sometimes looks like this it has that bracket {
Do not complain about the sobiet also btw
http://i.imgur.com/iDwIW.png

CODE
CMD:placeboombox(playerid, params[])
{
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, "pDynamicBB")) return SendClientMessageEx(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 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!", GetPlayerNameEx(playerid));
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPL E,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}/setboombox{FFFFFF} to set your boombox \n{FFFF00}or\n{FF0000}/pickupboombox{FFFFFF}", GetPlayerNameEx(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;
}



Another problem im having is the Proxdetector sayin the message twice
Screen: http://i.imgur.com/ogCNY.png

it shows Have turned off their boombox - twice when it suppose to be once
CODE
case 6:
{
if(GetPVarType(playerid, "pDynamicBBArea"))
{
new string2[128];
format(string2, sizeof(string2), "* %s turned off their boombox.", GetPlayerNameEx(playerid));
ProxDetector(30.0, playerid, string2, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPL E,COLOR_PURPLE);
DeletePVar(playerid, "pDynamicBBStation");
foreach(Player, i)
{
if(IsPlayerInDynamicArea(i, GetPVarInt(playerid, "pDynamicBBArea")))
{
StopAudioEx(i);
SendClientMessage(i, COLOR_PURPLE, string2);
}
}
}
SendClientMessage(playerid, COLOR_WHITE, "You've turn off your boombox");
}
}
return 1;
}

So somebody please give me a fixed code

Yamakei
11/11/2012, 08:11 AM
Adrian,

CMD:placeboombox(playerid, params[])
{
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, "pDynamicBB")) return SendClientMessageEx(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 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!", GetPlayerNameEx(playerid));
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPL E,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}/setboombox{FFFFFF} to set your boombox \n{FFFF00}or\n{FF0000}/pickupboombox", GetPlayerNameEx(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;
}

JaKe Elite
11/11/2012, 08:12 AM
if(IsPlayerInDynamicArea(i, GetPVarInt(playerid, "pDynamicBBArea")))
{
StopAudioEx(i);
SendClientMessage(i, COLOR_PURPLE, string2);
}


This is the problem causing sending the message twice.

Anyway nice m0d ****** you got there, Don't use it in any servers, If i caught you i will call the 911 SA-MP Rescue Team.

San1
11/11/2012, 08:15 AM
Tnx help me with the top thing bro- lol about calling 911