Raised This Month: $ Target: $400
 0% 

Timer/effects problems


Post New Thread Reply   
 
Thread Tools Display Modes
KMFrog
Senior Member
Join Date: Oct 2007
Old 01-05-2008 , 08:48   Re: Timer/effects problems
Reply With Quote #11

if your getting weird chars in your console output your probably telling it to print the wrong data types.

I just looked at your code above... and..
Code:
PrintToServer("Fireworks at: xy[0]: %s ,xy[1]: %s ,xy[2]: %s .", xy[0], xy[1], xy[2])
xy is not a string, so you cant use %s

You will have to use %d or probably %f (for float?)
i cant remember if its %f, so you best look them up in the docs ;]
__________________
Was I helpful or not? Rate Me!
KMFrog is offline
Greyscale
SourceMod Plugin Approver
Join Date: Dec 2007
Location: strYoMommasHouse[you];
Old 01-05-2008 , 13:20   Re: Timer/effects problems
Reply With Quote #12

I would be glad to help
Greyscale is offline
Greyscale
SourceMod Plugin Approver
Join Date: Dec 2007
Location: strYoMommasHouse[you];
Old 01-05-2008 , 14:24   Re: Timer/effects problems
Reply With Quote #13

Here is my contribution, if you need any help, just PM me or ask here

This is the whole skybox coordinate generator portion. Build your code from this.

bFireworks is a global bool that you can use to see if coordinates were given for the current map, so before any of the fireworks happen make sure you do this some time.

Code:
if (bFireworks)
{
  yourstuff
}
There are six coordinates to tell you the 6 center outer points of the skybox. You can access those through gCoords. To get the points you want use my defines at the top. You shouldn't need to though because I also made a function to generate a random point within the skybox.

Code:
/**
 * ====================
 *        Fireworks
 *   Author: V0gelz
 *   Assistant: Greyscale 
 * ==================== 
 */
 
#pragma semicolon 1
#include <sourcemod>

#define VERSION "1.0"

#define WIDTH1 0
#define WIDTH2 1
#define DEPTH1 2
#define DEPTH2 3
#define HEIGHT1 4
#define HEIGHT2 5

#define X 0
#define Y 1
#define Z 2

new bool:bFireworks;
new gCoords[6][3];

public Plugin:myinfo =
{
    name = "Fireworks",
    author = "V0gelz",
    description = "Creates awesome fireworks on the map",
    version = VERSION,
    url = ""
};

public OnMapStart()
{
    bFireworks = true;
    
    decl String:map[32];
    GetCurrentMap(map, sizeof(map));
    
    decl String:path[PLATFORM_MAX_PATH];
    BuildPath(Path_SM, path, sizeof(path), "configs/fireworks/%s.txt", map);
    
    new Handle:fileMap = OpenFile(path, "r");
    if (fileMap == INVALID_HANDLE)
    {
        PrintToServer("[Fireworks] No firework config made for this map (%s), disabling",  map);
        bFireworks = false;
        return;
    }
    PrintToServer("[Fireworks] Loading firework config for %s",  map);
    
    FileToArray(fileMap, gCoords);
    
    new Float:loc[3];
    for (new x = 0; x < 10; x++)
    {
        GetRandomPoint(loc);
        PrintToServer("random point %f %f %f", loc[0], loc[1], loc[2]);
    }
}
    
FileToArray(Handle:file, array[6][3])
{
    new count = 0;
    new stringindex1;
    new stringindex2;
    decl String:line[64];
    decl String:fX[16];
    decl String:fY[16];
    decl String:fZ[16];
    
    while(!IsEndOfFile(file) && ReadFileLine(file, line, sizeof(line)) && count < 6)
    {
        if (StrContains(line, "//") > -1)
        {
            SplitString(line, "//", line, sizeof(line));
        }
        
        TrimString(line);
        
        if (!StrEqual(line, "", false))
        {
            if (StrContains(line, ";") == -1)
            {
                stringindex1 = BreakString(line, fX, sizeof(fX));
                stringindex2 = BreakString(line[stringindex1], fY, sizeof(fY));
                BreakString(line[stringindex1 + stringindex2], fZ, sizeof(fZ));
                
                array[count][0] = RoundToNearest(StringToFloat(fX));
                array[count][1] = RoundToNearest(StringToFloat(fY));
                array[count][2] = RoundToNearest(StringToFloat(fZ));
                
                count++;
            }
        }
    }
    
    if (count < 6)
    {
        PrintToServer("[Fireworks] Only partial data was loaded, disabling for map");
        bFireworks = false;
    }
}

GetRandomPoint(Float:loc[3])
{
    loc[X] = float(GetRandomInt(gCoords[WIDTH1][X], gCoords[WIDTH2][X]));
    loc[Y] = float(GetRandomInt(gCoords[DEPTH1][Y], gCoords[DEPTH2][Y]));
    loc[Z] = float(GetRandomInt(gCoords[HEIGHT1][Z], gCoords[HEIGHT2][Z]));
}
Take what you need, you don't have to use all of that.

What's left is the timers and actual fireworks, good luck

BTW, everything has been tested and worked fine from the looks of it.
Greyscale is offline
Greyscale
SourceMod Plugin Approver
Join Date: Dec 2007
Location: strYoMommasHouse[you];
Old 01-07-2008 , 00:10   Re: Timer/effects problems
Reply With Quote #14

Hehe I made a very rough test to see the fireworks in action, and make sure they show up if you put them in the skybox.

Code:
/**
 * ====================
 *        Fireworks
 *   Author: V0gelz
 *   Assistant: Greyscale 
 * ==================== 
 */
 
#pragma semicolon 1
#include <sourcemod>
#include <sdktools>

#define VERSION "1.0"

#define WIDTH1 0
#define WIDTH2 1
#define DEPTH1 2
#define DEPTH2 3
#define HEIGHT1 4
#define HEIGHT2 5

#define X 0
#define Y 1
#define Z 2

new bool:bFireworks;
new gCoords[6];

public Plugin:myinfo =
{
    name = "Fireworks",
    author = "V0gelz",
    description = "Creates awesome fireworks on the map",
    version = VERSION,
    url = ""
};

public OnMapStart()
{
    bFireworks = true;
    
    decl String:map[32];
    GetCurrentMap(map, sizeof(map));
    
    decl String:path[PLATFORM_MAX_PATH];
    BuildPath(Path_SM, path, sizeof(path), "configs/fireworks/%s.txt", map);
    
    new Handle:fileMap = OpenFile(path, "r");
    if (fileMap == INVALID_HANDLE)
    {
        PrintToServer("[Fireworks] No firework config made for this map (%s), disabling",  map);
        bFireworks = false;
        return;
    }
    PrintToServer("[Fireworks] Loading firework config for %s",  map);
    
    FileToArray(fileMap, gCoords);
}
    
FileToArray(Handle:file, array[6])
{
    new count = 0;
    decl String:line[64];
    
    while(!IsEndOfFile(file) && ReadFileLine(file, line, sizeof(line)) && count < 6)
    {
        if (StrContains(line, "//") > -1)
        {
            SplitString(line, "//", line, sizeof(line));
        }
        
        TrimString(line);
        
        if (!StrEqual(line, "", false))
        {
            if (StrContains(line, ";") == -1)
            {
                array[count] = RoundToNearest(StringToFloat(line));
                
                count++;
            }
        }
    }
    
    if (count < 6)
    {
        PrintToServer("[Fireworks] Only partial data was loaded, disabling for map");
        bFireworks = false;
    }
}

GetRandomPoint(Float:loc[3])
{
    loc[X] = float(GetRandomInt(gCoords[WIDTH1], gCoords[WIDTH2]));
    loc[Y] = float(GetRandomInt(gCoords[DEPTH1], gCoords[DEPTH2]));
    loc[Z] = float(GetRandomInt(gCoords[HEIGHT1], gCoords[HEIGHT2]));
}

public OnGameFrame()
{
    for (new x = 0; x < 100; x++)
    {
        new Float:vec[3];
        new Float:dir[3] = {0.0, 0.0, 0.0};
        
        GetRandomPoint(vec);
        
        TE_SetupMetalSparks(vec, dir);
        TE_SendToAll();
        
        TE_SetupDust(vec, dir, 10.0, 1.0);
        TE_SendToAll();
    }
}
configs/fireworks/de_dust.txt

Code:
-8920.0
-3984.0
-1305.0
3691.0
-1728.0
-1309.0
I will also attach some screens, but if you want to see it for yourself, compile the code above and make the de_dust config file.

I'm sure there are better effects, bigger, that we can use too
Attached Files
File Type: zip screens.zip (739.6 KB, 110 views)
Greyscale is offline
KMFrog
Senior Member
Join Date: Oct 2007
Old 01-07-2008 , 14:43   Re: Timer/effects problems
Reply With Quote #15

nice work, looks pretty good
__________________
Was I helpful or not? Rate Me!
KMFrog is offline
Greyscale
SourceMod Plugin Approver
Join Date: Dec 2007
Location: strYoMommasHouse[you];
Old 01-13-2008 , 17:21   Re: Timer/effects problems
Reply With Quote #16

Video of the most recent version
Greyscale is offline
V0gelz
Senior Member
Join Date: Jun 2004
Old 01-14-2008 , 15:54   Re: Timer/effects problems
Reply With Quote #17

Wow great! Sorry that i have delay of working on this .. i have some work for school at the moment that keeps me busy >_<.

Anyway ill work on this also ( i guess ill add some features of my own )
V0gelz is offline
Reply



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

Forum Jump


All times are GMT -4. The time now is 20:47.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode