[FilterScript] roundabout creator
#1

roundabout creator
by kubak01

This project actually started as a thing connected with
our server`s lore, where the previous scripter
would just add shitload of useless roundabouts
basically almost everywhere, this is probably
a bit slow but I really wanted to get it done quickly

Also I wanted to try some streamer functions i didn't
get to use before

The whole thing is a little bit tricky, I'll explain that later
this post

Saving is done using dini2

Commands

Command syntax
/ar(oundabout) [Create/Delete/Edit]

Create
Params: size [Small/Medium/Big]

Delete
Params: id

Edit
Params: id


Increase MAX_ROUNDABOUTS if you need to
add more roundabouts



The roundabouts are made of a Core Object, and the other
objects are set corresponding to position and rotation of the core object

like this

PHP Code:
CreateDynamicObject(14467coreXcoreYcoreZcoreRXcoreRYcoreRZ); // Core
obj CreateDynamicObject(970coreX+2.839970coreY+0.300050coreZ-2.202200coreRX+0.000000coreRX+0.000000coreRX+90.000000); 
You can add your own roundabouts, you can simplify this using this php script
If you cannot figure on how to use this
I'll help

PHP Code:
<?php
$file 
file_get_contents("code.txt");
$lines explode(PHP_EOL$file);
$coreX 633.57617;
$coreY = -1398.31873;
$coreZ 13.74630;
$coreRX 0.00000;
$coreRY 0.00000;
$coreRZ 0.00000;
foreach (
$lines as $line) {
    
$line str_replace("CreateDynamicObject("""$line);
    
$line str_replace("CreateObject("""$line);
    
$line str_replace(");"""$line);
    
$exploded explode(","$line);
    
$model $exploded[0];
    
$x $exploded[1];
    
$y $exploded[2];
    
$z $exploded[3];
    
$rx $exploded[4];
    
$ry $exploded[5];
    
$rz $exploded[6];
    
//echo sprintf("X: %f", $x);
    //echo sprintf("coreX: %f", $coreX);
    //echo sprintf("coreX-x: %f", $coreX-$x);
    
$line sprintf("obj = CreateDynamicObject(%d,"$model);    
    
    if(
$x<$coreX)
    {
        
$line sprintf("%s coreX-%f,"$line$coreX-$x);
    }
    if(
$x>=$coreX)
    {
        
$line sprintf("%s coreX+%f,"$line$x-$coreX);
    }
    if(
$y<$coreY)
    {
        
$line sprintf("%s coreY-%f,"$line$coreY-$y);
    }
    if(
$y>=$coreY)
    {
        
$line sprintf("%s coreY+%f,"$line$y-$coreY);
    }
    if(
$z<$coreZ)
    {
        
$line sprintf("%s coreZ-%f,"$line$coreZ-$z);
    }
    if(
$z>=$coreZ)
    {
        
$line sprintf("%s coreZ+%f,"$line$z-$coreZ);
    }
    if(
$rx<$coreRX)
    {
        
$line sprintf("%s coreRX-%f,"$line$coreRX-$rx);
    }
    if(
$rx>=$coreRX)
    {
        
$line sprintf("%s coreRX+%f,"$line$rx-$coreRX);
    }
    if(
$ry<$coreRY)
    {
        
$line sprintf("%s coreRX-%f,"$line$coreRY-$ry);
    }
    if(
$ry>=$coreRY)
    {
        
$line sprintf("%s coreRX+%f,"$line$ry-$coreRY);
    }
    if(
$rz<$coreRZ)
    {
        
$line sprintf("%s coreRX-%f,"$line$coreRZ-$rz);
    }
    if(
$rz>=$coreRZ)
    {
        
$line sprintf("%s coreRX+%f,"$line$rz-$coreRZ);
    }
    
$line rtrim($line',');
    
$line sprintf("%s);"$line);
    echo 
$line;
    echo 
'<br />';    
    echo 
"Streamer_SetIntData(STREAMER_TYPE_OBJECT, obj, E_STREAMER_EXTRA_ID, roundAboutCache[id][raCoreObject]);";
    echo 
"<br />";
}
?>
Pastebin

Let me know if i fucked up something big time,
i will fix it

Reply


Messages In This Thread
roundabout creator - by kubak01 - 24.07.2017, 15:44
Re: roundabout creator - by Pottus - 24.07.2017, 22:47
Re: roundabout creator - by Chaprnks - 26.07.2017, 22:49
Re: roundabout creator - by RahimBashovski - 27.07.2017, 20:54
Re: roundabout creator - by NaS - 28.07.2017, 16:47

Forum Jump:


Users browsing this thread: 1 Guest(s)