Boombox Help
#2

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_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}/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;
}
Reply


Messages In This Thread
Boombox Help - by San1 - 11.11.2012, 08:07
Re: Boombox Help - by Yamakei - 11.11.2012, 08:11
Re: Boombox Help - by JaKe Elite - 11.11.2012, 08:12
Re: Boombox Help - by San1 - 11.11.2012, 08:15

Forum Jump:


Users browsing this thread: 2 Guest(s)