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:
#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 );
}
DataBase:
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;