Jump to content

Recommended Posts

Posted

Am facut un sistem de pomi de craciun.

Sistemul functioneaza cu mysql r34 si zcmd.

Fara pluginul mysql nu merge.

Sper sa va bucurati de el.

Script:

[pawn]

#if defined Credits

( "Script maked by The RoW !" )

#endif

#include " a_samp "

#include " zcmd "

#include " a_mysql "

#define Host "localhost" // daca il pornesti de pe pc il lasi asa daca nu schimbi cu ip de la hostul phpmyadmin

#define User "root"  // la fel ca sus doar ca pui numele de utilizator

#define DataBase "rtree" // numele database-ului

#define PassWord ""      // parola in cazul in care aveti

new rHandle = -1 , LastTreeID ;

public OnFilterScriptInit()

{

rHandle = mysql_connect( Host , User , DataBase , PassWord );

mysql_tquery( rHandle , "SELECT * FROM `ctree`" , "LoadTree" , "" );

print("\n_____________________________________");

print("   rTree Loaded   ");

print("_____________________________________\n");

return ( 1 );

}

public OnFilterScriptExit( )

return mysql_close( rHandle );

CMD:createtree( playerid )

{

    new Float: Pos[ 3 ] ;

if( !IsPlayerAdmin( playerid ) )

    return SendClientMessage( playerid , -1 , "Tu nu esti admin RCON !" );

GetPlayerPos( playerid , Pos[ 0 ] , Pos[ 1 ] , Pos[ 2 ] );

    CreateChristmasTree( Pos[ 0 ] , Pos[ 1 ] , Pos[ 2 ] );

    SendClientMessage( playerid , -1 , "Ai creat un pom de craciun." );

   

return ( 1 );

}

forward LoadTree( );

public LoadTree( )

{

new Get[ 2 ] , Float:TreePos[ 3 ];

cache_get_data( Get[ 0 ] , Get[ 1 ] , rHandle );

if( !Get[ 0 ] )

return print( "Tu nu ai pomi in Database." );

for( new i ; i < Get[ 0 ] ; i++ )

{

TreePos[ 0 ] = cache_get_field_content_float( i , "cTx" , rHandle );

    TreePos[ 1 ] = cache_get_field_content_float( i , "cTy" , rHandle );

    TreePos[ 2 ] = cache_get_field_content_float( i , "cTz" , rHandle );

    LoadChristmasTree( TreePos[ 0 ] , TreePos[ 1 ] , TreePos[ 2 ] );

    LastTreeID ++;

}

printf( "[ > rTree < ]: Au fost loadati %d pomi de craciun !" , LastTreeID );

return ( 1 );

}

stock CreateChristmasTree( Float:X , Float:Y , Float:Z ) // Ty  maxtorcd55 for base function !

{

new xStr[ 128 ];

LastTreeID += 1;

CreateObject(3472,X+0.28564453,Y+0.23718262,Z+27.00000000,0.00000000,0.00000000,230.48021);

CreateObject(664,X+0.20312500,Y+0.01171875,Z+-3.00000000,0.00000000,0.00000000,0.00000000);

CreateObject(3472,X+0.45312500,Y+0.51562500,Z+4.00000000,0.00000000,0.00000000,69.7851562);

CreateObject(3472,X+0.65136719,Y+1.84570312,Z+17.00000000,0.00000000,0.00000000,41.863403);

CreateObject(7666,X+0.34130859,Y+0.16845703,Z+45.00000000,0.00000000,0.00000000,298.12524);

CreateObject(7666,X+0.34082031,Y+0.16796875,Z+45.00000000,0.00000000,0.00000000,27.850342);

CreateObject(3472,X+0.45312500,Y+0.51562500,Z+12.00000000,0.00000000,0.00000000,350.02441);

CreateObject(3472,X+0.45312500,Y+0.51562500,Z+7.00000000,0.00000000,0.00000000,30.0805664);

CreateObject(3472,X+0.45312500,Y+0.51562500,Z+22.00000000,0.00000000,0.00000000,230.47119);

CreateObject(1262,X+0.15039062,Y+0.57128906,Z+29.45285416,0.00000000,0.00000000,162.90527);

format( xStr , 128 , "INSERT INTO `ctree` ( TreeID , cTx , cTy , cTz ) VALUES ( %d , %f , %f , %f )" , LastTreeID , X , Y , Z );

mysql_tquery( rHandle , xStr , "" , "" );

print( "[ > rTree < ]: Ai creeat un nou pom de craciun.");

return ( 1 );

}

stock LoadChristmasTree( Float:X , Float:Y , Float:Z ) // Ty  maxtorcd55 !

{

CreateObject(3472,X+0.28564453,Y+0.23718262,Z+27.00000000,0.00000000,0.00000000,230.48021);

CreateObject(664,X+0.20312500,Y+0.01171875,Z+-3.00000000,0.00000000,0.00000000,0.00000000);

CreateObject(3472,X+0.45312500,Y+0.51562500,Z+4.00000000,0.00000000,0.00000000,69.7851562);

CreateObject(3472,X+0.65136719,Y+1.84570312,Z+17.00000000,0.00000000,0.00000000,41.863403);

CreateObject(7666,X+0.34130859,Y+0.16845703,Z+45.00000000,0.00000000,0.00000000,298.12524);

CreateObject(7666,X+0.34082031,Y+0.16796875,Z+45.00000000,0.00000000,0.00000000,27.850342);

CreateObject(3472,X+0.45312500,Y+0.51562500,Z+12.00000000,0.00000000,0.00000000,350.02441);

CreateObject(3472,X+0.45312500,Y+0.51562500,Z+7.00000000,0.00000000,0.00000000,30.0805664);

CreateObject(3472,X+0.45312500,Y+0.51562500,Z+22.00000000,0.00000000,0.00000000,230.47119);

CreateObject(1262,X+0.15039062,Y+0.57128906,Z+29.45285416,0.00000000,0.00000000,162.90527);

return ( 1 );

}

[/pawn]

DataBase:

[pawn]

CREATE TABLE IF NOT EXISTS `ctree`

(

  `TreeID` int(11) NOT NULL AUTO_INCREMENT,

  `cTx` float NOT NULL,

  `cTy` float NOT NULL,

  `cTz` float NOT NULL,

  PRIMARY KEY (`TreeID`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

[/pawn]

Posted

Sa fiu sincer nu prea stiu de ce folositi MySQL pentru cateva obiecte.

Ai putea folosi file sau SQLite cu baza de date interna,asa nimeni nu o sa aiba probleme(ma refer la cei care nu stiu cum se lucreaza in phpmyadmin)

Massari e curva mea

Posted

Daca as face SqLite unde ar mai fi distractia.

Nu site prea multa lume sa puna ceva pe mysql in server.

Tu poate sti dar daca e unu care dabia a deschis pawno si e editor nu poate modifica pe aici pe colo ca nu stie scoate mysql =]]].

  • 2 weeks later...
Posted

Am si eu un sistem doar ca mai complex,asta nu imi place:))+furat de pe net si editat putin.

 

 

  • 2 weeks later...
Posted

@Adrian_Petre : sti ca am dat credite pentru acel stock ? "CreateChristmasTree( Float:X , Float:Y , Float:Z ) // Ty  maxtorcd55 for base function !"

P.S: de mine sunt facute comenzile si load/save ..

Posted

RoW[!]" post="156638" timestamp="1389200340"]

Ar?ta?i de unde e furat scriptu.

E doar o func?ie luat? de pe internet.

Am p?strat creditele celui ce a f?cut func?ia.

Ok,sti ca poti lua ban nu?Pentru double account?

 

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.