SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 16/07/2013, 03:45 PM   #11
ngumcutoi1999
Big Clucker
 
Join Date: Dec 2012
Location: Viet Nam
Posts: 69
Reputation: -3
Default Re: How to make BoomBox system !

Quote:
Originally Posted by RALL0 View Post
Define the colors,
pawn Code:
#define COLOR_WHITE 0xFFFFFFFF
#define COLOR_LIGHTBLUE 0x33CCFFFF
#define COLOR_GREY 0xAFAFAFFF

new Boombox[MAX_PLAYERS];
What are you talking about
ngumcutoi1999 is offline   Reply With Quote
Old 16/07/2013, 03:48 PM   #12
RALL0
Huge Clucker
 
Join Date: May 2013
Posts: 246
Reputation: -2
Default Re: How to make BoomBox system !

Quote:
Originally Posted by ngumcutoi1999 View Post
10 errors
Code:
(85) : error 017: undefined symbol "COLOR_GREY"
(267) : error 017: undefined symbol "COLOR_WHITE"
(274) : error 017: undefined symbol "COLOR_GREY"
(286) : error 017: undefined symbol "COLOR_LIGHTBLUE"
(308) : error 017: undefined symbol "COLOR_GREY"
(313) : error 017: undefined symbol "COLOR_LIGHTBLUE"
(321) : error 017: undefined symbol "Boombox"
(321) : warning 215: expression has no effect
(321) : error 001: expected token: ";", but found "]"
(321) : error 029: invalid expression, assumed zero
(321) : fatal error 107: too many error messages on one line
code
Code:
// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT

// Includes
#include <a_samp>
#include <zcmd>
#include <sscanf2>
#include <streamer>
#include <foreach>

#if defined FILTERSCRIPT
// Defines
#define COLOR_WHITE 0xFFFFFFFF
#define COLOR_LIGHTBLUE 0x33CCFFFF
#define COLOR_GREY 0xAFAFAFFF



public OnFilterScriptInit()
{
	print("\n--------------------------------------");
	print(" Blank Filterscript by your name here");
	print("--------------------------------------\n");
	return 1;
}

public OnFilterScriptExit()
{
	return 1;
}

#else

main()
{
	print("\n----------------------------------");
	print(" Blank Gamemode by your name here");
	print("----------------------------------\n");
}

#endif

public OnGameModeInit()
{
	// Don't use these lines if it's a filterscript
	SetGameModeText("Blank Script");
	AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
	return 1;
}

public OnGameModeExit()
{
	return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
	SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
	SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
	SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
	return 1;
}

public OnPlayerConnect(playerid)
{
    DeletePVar(playerid, "BoomboxObject"); DeletePVar(playerid, "BoomboxURL");
    DeletePVar(playerid, "bposX"); DeletePVar(playerid, "bposY"); DeletePVar(playerid, "bposZ"); DeletePVar(playerid, "bboxareaid");
    if(IsValidDynamicObject(GetPVarInt(playerid, "BoomboxObject"))) DestroyDynamicObject(GetPVarInt(playerid, "BoomboxObject"));
	return 1;
}

public OnPlayerDisconnect(playerid)
{
    if(GetPVarType(playerid, "BoomboxObject"))
    {
        DestroyDynamicObject(GetPVarInt(playerid, "BoomboxObject"));
        if(GetPVarType(playerid, "bboxareaid"))
        {
            foreach(Player,i)
            {
                if(IsPlayerInDynamicArea(i, GetPVarInt(playerid, "bboxareaid")))
                {
                    StopAudioStreamForPlayer(i);
                    SendClientMessage(i, COLOR_GREY, " The boombox creator has disconnected from the server.");
                }
            }
        }
    }
    return 1;
}

public OnPlayerSpawn(playerid)
{
	return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
	return 1;
}

public OnVehicleSpawn(vehicleid)
{
	return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
	return 1;
}

public OnPlayerText(playerid, text[])
{
	return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/mycommand", cmdtext, true, 10) == 0)
	{
		// Do something here
		return 1;
	}
	return 0;
}

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
	return 1;
}

public OnPlayerExitVehicle(playerid, vehicleid)
{
	return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
	return 1;
}

public OnPlayerEnterCheckpoint(playerid)
{
	return 1;
}

public OnPlayerLeaveCheckpoint(playerid)
{
	return 1;
}

public OnPlayerEnterRaceCheckpoint(playerid)
{
	return 1;
}

public OnPlayerLeaveRaceCheckpoint(playerid)
{
	return 1;
}

public OnRconCommand(cmd[])
{
	return 1;
}

public OnPlayerRequestSpawn(playerid)
{
	return 1;
}

public OnObjectMoved(objectid)
{
	return 1;
}

public OnPlayerObjectMoved(playerid, objectid)
{
	return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
	return 1;
}

public OnVehicleMod(playerid, vehicleid, componentid)
{
	return 1;
}

public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
	return 1;
}

public OnVehicleRespray(playerid, vehicleid, color1, color2)
{
	return 1;
}

public OnPlayerSelectedMenuRow(playerid, row)
{
	return 1;
}

public OnPlayerExitedMenu(playerid)
{
	return 1;
}

public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
	return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
	return 1;
}

public OnRconLoginAttempt(ip[], password[], success)
{
	return 1;
}

public OnPlayerUpdate(playerid)
{
	return 1;
}

public OnPlayerStreamIn(playerid, forplayerid)
{
	return 1;
}

public OnPlayerStreamOut(playerid, forplayerid)
{
	return 1;
}

public OnVehicleStreamIn(vehicleid, forplayerid)
{
	return 1;
}

public OnVehicleStreamOut(vehicleid, forplayerid)
{
	return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
	return 1;
}

public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
	return 1;
}
CMD:boombox(playerid, params[])
{
    new string[128];
    if(!GetPVarType(playerid, "BoomboxObject"))
    {
        if(sscanf(params, "s[256]", params)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /boombox [music url]");
        foreach(Player, i)
        {
            if(GetPVarType(i, "BoomboxObject"))
            {
                if(IsPlayerInRangeOfPoint(playerid, 30.0, GetPVarFloat(i, "bposX"), GetPVarFloat(i, "bposY"), GetPVarFloat(i, "bposZ")))
                {
                    SendClientMessage(playerid, COLOR_GREY, " There is another boombox nearby, place yours somewhere else.");
                    return 1;
                }
            }
        }

        new Float:x, Float:y, Float:z, Float:a;
        GetPlayerPos(playerid, x, y, z); GetPlayerFacingAngle(playerid, a);
        SetPVarInt(playerid, "BoomboxObject", CreateDynamicObject(2103, x, y, z, 0.0, 0.0, 0.0, .worldid = GetPlayerVirtualWorld(playerid), .interiorid = GetPlayerInterior(playerid)));
        SetPVarFloat(playerid, "bposX", x); SetPVarFloat(playerid, "bposY", y); SetPVarFloat(playerid, "bposZ", z);
        SetPVarInt(playerid, "bboxareaid", CreateDynamicSphere(x, y, z, 30.0, GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid)));
        format(string, sizeof(string), " You have placed your boombox at your location.");
        SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
        foreach(Player, i)
        {
            if(IsPlayerInDynamicArea(i, GetPVarInt(playerid, "bboxareaid")))
            {
                PlayAudioStreamForPlayer(i, params, GetPVarFloat(playerid, "bposX"), GetPVarFloat(playerid, "bposY"), GetPVarFloat(playerid, "bposZ"), 30.0, 1);
            }
        }
        SetPVarString(playerid, "BoomboxURL", params);
    }
    else
    {
        DestroyDynamicObject(GetPVarInt(playerid, "BoomboxObject"));
        DeletePVar(playerid, "BoomboxObject"); DeletePVar(playerid, "BoomboxURL");
        DeletePVar(playerid, "bposX"); DeletePVar(playerid, "bposY"); DeletePVar(playerid, "bposZ");
        if(GetPVarType(playerid, "bboxareaid"))
        {
            foreach(Player,i)
            {
                if(IsPlayerInDynamicArea(i, GetPVarInt(playerid, "bboxareaid")))
                {
                    StopAudioStreamForPlayer(i);
                    SendClientMessage(i, COLOR_GREY, " The boombox creator has removed his boombox.");
                }
            }
            DeletePVar(playerid, "bboxareaid");
        }
        SendClientMessage(playerid, COLOR_LIGHTBLUE, " You have removed your boombox.");
    }
    return 1;
}

// Boombox editing - Usage: /boomboxnext [url]
CMD:boomboxnext(playerid, params[])
{
    if(!Boombox[playerid]) return SendClientMessage(playerid, COLOR_GREY, "You don't have a boombox placed.");
    if(sscanf(params, "s[256]", params)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /boomboxnext [music url]");
    SendClientMessage(playerid, COLOR_GREY, " You have changed the music your boombox is playing.");
    foreach(Player, i)
    {
        if(IsPlayerInDynamicArea(i, GetPVarInt(playerid, "bboxareaid")))
        {
            PlayAudioStreamForPlayer(i, params, GetPVarFloat(playerid, "bposX"), GetPVarFloat(playerid, "bposY"), GetPVarFloat(playerid, "bposZ"), 30.0, 1);
        }
    }
    SetPVarString(playerid, "BoomboxURL", params);
    return 1;
}

public OnPlayerEnterDynamicArea(playerid, areaid)
{
    foreach(Player, i)
    {
        if(GetPVarType(i, "bboxareaid"))
        {
            new station[256];
            GetPVarString(i, "BoomboxURL", station, sizeof(station));
            if(areaid == GetPVarInt(i, "bboxareaid"))
            {
                PlayAudioStreamForPlayer(playerid, station, GetPVarFloat(i, "bposX"), GetPVarFloat(i, "bposY"), GetPVarFloat(i, "bposZ"), 30.0, 1);
                SendClientMessage(playerid, COLOR_GREY, " You are listening to music coming out of a nearby boombox.");
                return 1;
            }
        }
    }
    return 1;
}

public OnPlayerLeaveDynamicArea(playerid, areaid)
{
    foreach(Player, i)
    {
        if(GetPVarType(i, "bboxareaid"))
        {
            if(areaid == GetPVarInt(i, "bboxareaid"))
            {
                StopAudioStreamForPlayerEx(playerid);
                SendClientMessage(playerid, COLOR_GREY, " You have went far away from the boombox.");
                return 1;
            }
        }
    }
    return 1;
}
Help !
This is what I am talking about fixing your errors.
RALL0 is offline   Reply With Quote
Old 17/07/2013, 02:37 AM   #13
ngumcutoi1999
Big Clucker
 
Join Date: Dec 2012
Location: Viet Nam
Posts: 69
Reputation: -3
Default Re: How to make BoomBox system !

Quote:
Originally Posted by RALL0 View Post
This is what I am talking about fixing your errors.
Error was fixing correctly , but when I test in game it not working
ngumcutoi1999 is offline   Reply With Quote
Old 17/07/2013, 02:53 AM   #14
Pizzy
Huge Clucker
 
Join Date: May 2012
Posts: 357
Reputation: 115
Default Re: How to make BoomBox system !

Fix your colours and remove the errors.
Pizzy is offline   Reply With Quote
Old 17/07/2013, 02:58 AM   #15
ngumcutoi1999
Big Clucker
 
Join Date: Dec 2012
Location: Viet Nam
Posts: 69
Reputation: -3
Default Re: How to make BoomBox system !

10 errors have been corrected (compile successful ) but when I test in my server it not working
ngumcutoi1999 is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[FilterScript] Unique Boombox system edgargreat Filterscripts 12 15/05/2015 10:34 PM
[FilterScript] Boombox System Alex Valdez Filterscripts 9 16/10/2014 09:38 AM
How To Make A BoomBox! Alex Magaņa Scripting Help 3 21/04/2013 05:02 PM
[Help] Please help on my boombox system! popystone Scripting Help 28 21/08/2012 08:26 AM


All times are GMT. The time now is 07:11 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.