[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
#2

Quote:
Originally Posted by kubak01
View Post
The roundabouts are made of a Core Object, and the other
objects are set corresponding to position and rotation of the core object

Let me know if i fucked up something big time,
i will fix it
Yes you fucked up something big time you didn't even explain what this does at all. That is not really an explanation it does not answer the following questions.

1.) Can we see some screenshots?
2.) What do we even use this for?
Reply
#3

Quote:
Originally Posted by Pottus
View Post
Yes you fucked up something big time you didn't even explain what this does at all. That is not really an explanation it does not answer the following questions.

1.) Can we see some screenshots?
2.) What do we even use this for?
I believe he's talking about the traffic intersection circle, sometimes referred to as a 'traffic circle', or 'roundabout'.. but I could be wrong.

Reply
#4

You use isnull and sscanf in same command for pretty much same purpose? 0-star keep trying.
Reply
#5

All it does is create a bunch of objects that you previously mapped.

Small - two Gangster Statues with fence.

Medium - Fountain surrounded by some trees and fences.

Big - Big fountain with more trees, fences and a huge road.

The PHP Script is used to create your own mappings, I guess. Could in fact be useful but the way it is explained is awful!


In short - places previously mapped stuff anywhere with a command. With the edit command you can then place it, rotate it etc. But the rotations are wrong - in fact they aren't even considered.

I like the idea, but you should add an easier way of adding maps.
For example loading MTA Map Files/CreateObject code and then being able to place it anywhere. That would be nice.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)