[pawn]// NOT FORGET DOWNLOAD THE FOLDER OF VEHICLES AND PUT IN YOU FOLDER SCRIPTFILES
// SYSTEM TESTED IN SCRIPT FROM 0 (FALCON), AND IN GUPS "DELETED THE SYSTEM OF CAR IN GUPS AND PUT THIS"
/*if you have the public assigned only copy the text inside*/
//==============================================================================
public OnPlayerEnterVehicle(playerid,vehicleid,ispassenger)
{
new id, Float:hp;
id = GetPlayerVehicleID( playerid );
GetVehicleHealth( GetPlayerVehicleID( playerid ), hp );
hp = ( hp / 1000.00 ) * 1000;
new string[256];
format( string, sizeof( string ), "ID:[ %d ] Health:[ %.0f% ] Owner:[ %s ] Price:[ $%d ]", id, hp, VehicleInfo[ id ][ Propietario ], VehicleInfo[ id ][ Precio ] );
SendClientMessage( playerid, COLOR_GREEN, string );
if(InfoAutoCerrado(playerid,vehicleid)) return 0;
return 1;
}
//==============================================================================
/* IN public OnGameModeInit PUT THIS*/
CargarAutos();
//==============================================================================
/*Put this in public OnPlayerText*/
else if (strcmp(cmd, "!close", true) == 0) {
tmp = strtok(cmdtext, idx);
if ( !IsLoggedIn( playerid ) ) SendClientMessage( playerid, COLOR_RED, "Logueate primero." );
if (!strlen(tmp)) Mensaje(playerid, GREEN,"[Sistema] - USAGE: !cerrar <ID> .");
else if (!SiExiste(strval(tmp))) Mensaje(playerid, GREEN,"[Error] -This vehicle not exist.");
else if ( !IsVehiclePropietario( strval( tmp ), playerid ) ) Mensaje( playerid, COLOR_GREEN, "Error: Este vehiculo no te pertenece." );
else {
AutoCerrado(playerid,strval(tmp));
}
return 1;
}
else if (strcmp(cmd, "!open", true) == 0) {
tmp = strtok(cmdtext, idx);
if ( !IsLoggedIn( playerid ) ) SendClientMessage( playerid, COLOR_RED, "Logueate en tu cuenta." );
if (!strlen(tmp)) Mensaje(playerid, GREEN,"[Sistema] - USAGE: !open <ID>.");
else if (!SiExiste(strval(tmp))) Mensaje(playerid, GREEN,"[Error] - this vehicle not exist.");
else if ( !IsVehiclePropietario( strval( tmp ), playerid ) ) Mensaje( playerid, COLOR_GREEN, "Error: Este vehiculo no te pertenece." );
else {
AutoAbierto(playerid,strval(tmp));
}
return 1;
}
else if ( strcmp( cmd, "!buycar", true ) == 0 )
{
tmp = strtok( cmdtext, idx );
if ( !IsLoggedIn( playerid ) ) SendClientMessage( playerid, ROJO, "Please log-in to your account." );
else if ( !strlen( tmp ) ) Mensaje( playerid, AMARILLO, "USAGE: !open [VehicleID]" );
else if ( !SiEstaEnVenta( strval( tmp ) ) ) Mensaje( playerid, ROJO, "Error: That vehicle is not for sale." );
else
{
new cost = GetCostoAuto( strval( tmp ) );
if ( GetPlayerHandCash( gPlayers[ playerid ] ) < cost )
{
SendClientMessage( playerid, COLOR_GREEN, "Error: Not have money to buy a car!" );
return 1;
}
format( file, sizeof( file ), "/Autos/propietario.ini", "propietario" );
dini_Set( file, tmp, gPlayers[ playerid ] );
new propietario[256]; propietario = gPlayers[ playerid ];
VehicleInfo[ strval( tmp ) ][ Propietario ] = propietario;
DecPlayerHandCash( playerid, cost );
format( szMsg, sizeof( szMsg ), "Vehicle bought for:[ $%d ]", cost );
SendClientMessage( playerid, COLOR_GREEN, szMsg );
}
return 1;
}
else if ( strcmp( cmd, "!sellcar", true ) == 0 )
{
tmp = strtok( cmdtext, idx );
if ( !IsLoggedIn( playerid ) ) Mensaje( playerid, COLOR_RED, "Please log-in to your account." );
else if ( !strlen( tmp ) ) Mensaje( playerid, COLOR_GREEN, "USAGE: !sellcar [VehicleID]" );
else if ( !IsVehiclePropietario( strval( tmp ), playerid ) ) SendClientMessage( playerid, COLOR_GREEN, "Error: That vehicle is not yours." );
else
{
new cost = GetCostoAuto( strval( tmp ) ), npropietario[256]; npropietario = "Automotora Sunshine Ltda.";
format( file, sizeof( file ), "/Autos/propietario.ini", "propietario" );
dini_Set( file, tmp, "Automotora Sunshine Ltda." );
VehicleInfo[ strval( tmp ) ][Propietario] = npropietario;
IncPlayerHandCash( playerid, cost );
format( szMsg, sizeof( szMsg ), "Vehicle sold for:[ $%d ]", cost );
SendClientMessage( playerid, COLOR_GREEN, szMsg );
}
return 1;
}
else if ( strcmp( cmd, "!car", true ) == 0 )
{
tmp = strtok( cmdtext, idx );
new plr = FindPlayerIDFromString( tmp );
if ( !strlen( tmp ) )
{
if ( IsPlayerInAnyVehicle( playerid ) )
{
new id, Float:hp;
id = GetPlayerVehicleID( playerid );
GetVehicleHealth( GetPlayerVehicleID( playerid ), hp );
hp = ( hp / 1000.00 ) * 1000;
format( szMsg, sizeof( szMsg ), "ID:[ %d ] Health:[ %.0f% ] Propietario:[ %s ] Precio:[ $%d ]", id, hp, VehicleInfo[ id ][ Propietario ], VehicleInfo[ id ][ Precio ] );
SendClientMessage( playerid, COLOR_GREEN, szMsg );
}
else SendClientMessage( playerid, COLOR_GREEN, "You are currently on foot or passenger." );
}
else if ( plr == INACTIVE_PLAYER_ID ) SendClientMessage( playerid, ROJO, "Error: Unknown player" );
else if ( IsPlayerInAnyVehicle( plr ) )
{
new id, Float:hp;
id = GetPlayerVehicleID( plr );
GetVehicleHealth( GetPlayerVehicleID( plr ), hp );
hp = ( hp / 1000.00 ) * 1000;
format( szMsg, sizeof( szMsg ), "ID:[ %d ] Health:[ %.0f% ] Owner:[ %s ] Price:[ $%d ]", id, hp, VehicleInfo[ id ][ Propietario ], VehicleInfo[ id ][ Precio ] );
SendClientMessage( playerid, COLOR_GREEN, szMsg );
}
else
{
format( szMsg, sizeof( szMsg ), "%s is currently on foot.", gPlayers[ plr ] );
SendClientMessage( playerid, COLOR_GREEN, szMsg );
}
return 1;
}
else if ( strcmp( cmd, "!gotov", true ) == 0 )
{
tmp = strtok( cmdtext, idx );
if ( !IsLoggedIn( playerid ) ) Mensaje( playerid, COLOR_RED, "Login first." );
else if ( !strlen( tmp ) ) Mensaje( playerid, COLOR_YELLOW, "write: !gotov [VehicleID]" );
else if ( !IsVehiclePropietario( strval( tmp ), playerid ) ) Mensaje( playerid, COLOR_RED, "Error: Not is you vehicle." );
else
{
PutDirectlyInVehicle(playerid, strval( tmp ) );
Mensaje(playerid,COLOR_RED,"You are travel inside of you vehicle");
}
return 1;
}
//==========================================================================================
/* Add this publics */
public InfoAutoCerrado(playerid,vehicleid)
{
if (strcmp(GetAutoCerrado(vehicleid), "on", true) == 0) {
Mensaje(playerid, GREEN,"This vehicle is closed whit keys.");
RemovePlayerFromVehicle(playerid);
SetVehicleToRespawn(vehicleid);
}
return 1;
}
//==============================================================================
public AutoCerrado(playerid,vehicleid)
{
Mensaje(playerid, GREEN,"The vehicle now is closed.");
SetAutoCerrado(vehicleid,"on");
}
//==============================================================================
public AutoAbierto(playerid,vehicleid)
{
Mensaje(playerid, GREEN,"The vehicle now is open.");
SetAutoCerrado(vehicleid,"off");
}
//==============================================================================
public GetAutoCerrado(vehicleid)
{
new lock[256]; lock = dini_Get("/Autos/cerrado.ini",IntToStr(vehicleid));
return lock;
}
//==============================================================================
public SetAutoCerrado(vehicleid,lock[])
{
dini_Set("/Autos/cerrado.ini",IntToStr(vehicleid),lock);
}
//==============================================================================
public GetVehiclePropietario( vehicleid )
{
return VehicleInfo[ vehicleid ][ Propietario ];
}
//==============================================================================
public GetCostoAuto( vehicleid )
{
return VehicleInfo[ vehicleid ][ Precio ];
}
//==============================================================================
public SiEstaEnVenta( vehid )
{
return ( strcmp( VehicleInfo[ vehid ][ Propietario ], "Automotora Sunshine Ltda.", true ) == 0 ) ? true : false;
}
//==============================================================================
public IsVehiclePropietario( vehid, plr )
{
return ( strcmp( VehicleInfo[ vehid ][ Propietario ], gPlayers[ plr ], true ) == 0 ) ? true : false;
}
//==============================================================================
public SiExiste( vehid )
{
return ( vehid > ServerInfo[ 0 ][ MaxVehicles ] ) ? false : true;
}
//==============================================================================
public CargarAutos()
{
new XU, i;
if ( !dini_Exists( "/Autos/autos.ini" ) ) return -1;
new data[ 7 ][ 256 ];
for ( XU = 1; XU <= 250; XU++ )
{
new pos[ 256 ], fm[ 6 ];
format( fm, sizeof( fm ), "%d", XU );
pos = dini_Get( "/Autos/autos.ini", fm );
if ( strlen( pos ) )
{
i++;
split( pos, data, ' ' );
AddStaticVehicle( strval( data[ 0 ] ), floatstr( data[ 1 ] ), floatstr( data[ 2 ] ), floatstr( data[ 3 ] ), floatstr( data[ 4 ] ), strval( data[ 5 ] ), strval( data[ 6 ] ) );
new nombre[32], propietario[256], precio;
nombre = "";
VehicleInfo[ i ][ Id ] = i;
VehicleInfo[ i ][ Nombre ] = nombre;
format( file, sizeof( file ), "/Autos/propietario.ini", "propietario" );
propietario = dini_Get( file, IntToStr( i ) );
VehicleInfo[ i ][ Propietario ] = propietario;
format( file, sizeof( file ), "/Autos/precio.ini", "propietario" );
precio = dini_Int( file, IntToStr( i ) );
VehicleInfo[ i ][ Precio ] = precio;
}
}
ServerInfo[ 0 ][ MaxVehicles ] = i;
printf( " >> Cars added to server (%d)", i );
return asp;
}
public Mensaje(playerid, color, text[])
{
new Msn[256];
format(Msn, 256, "Private Message >> %s", text);
SendClientMessage(playerid, color, Msn);
return 1;
}
//==============================================================================
//==============================================================================
/*added and define this*/
new VehicleInfo[ 200 ][ vInfo ];
new ServerInfo[ 1 ][ sInfo ] ;
new asp = 0;
#define AUTOSPROPIETARIO_FILE "/Autos/propietario.ini"
#define ROJO 0xAA3333AA
#define AMARILLO 0xFFFF00AA
enum vInfo
{
Id,
Nombre[32],
Propietario[256],
Precio
}
// DO YOU LIKE MY SYSTEM AND COMMANDS?? COMMENT NOW!!
[/pawn]
Download and put this in you folder scriptfileshttp://depositfiles.com/files/5xwdt1s3wPM TO SUPPORT