09.03.2009, 16:36
Hello, i have some big problems on a FS about the car ownership system.
Credits to: Xalphox (i really like this system as a start because is very RP and i'm editing it for make it suitable for the server i'm going to make)
The script works good but it don't have the commands /buycar, /park, /sellcar so i was trying to make them and well is really hard for me cause i have problem on use the SaveToFile/ReadFromFile functions and i have try to learn but my head it's like to explode XD really cant understand how to fix some things...so let's try to write the problem on forum and HOPE that some one will reply to my.
Name of the file carmod.ini
What the file contain:
vehOwner = Who own the vehicle
vehPlate = Don't know what is exatcly...
vehModel = Model of the vehicle
vehCol1 = First Color
vehCol2 = Second Color
vehX = X Position
vehY = Y Position
vehZ = Z Position
vehAng = Where the vehicle is pointing
------------------------------------------------------------------------------------------
HERE ARE THE START OF THE COMMANDS I HAVE MADE, I NEED HELP ABOUT COMPLETE THEM
------------------------------------------------------------------------------------------
/buycar
/park
/sellcar
Credits to: Xalphox (i really like this system as a start because is very RP and i'm editing it for make it suitable for the server i'm going to make)
The script works good but it don't have the commands /buycar, /park, /sellcar so i was trying to make them and well is really hard for me cause i have problem on use the SaveToFile/ReadFromFile functions and i have try to learn but my head it's like to explode XD really cant understand how to fix some things...so let's try to write the problem on forum and HOPE that some one will reply to my.
Name of the file carmod.ini
What the file contain:
vehOwner = Who own the vehicle
vehPlate = Don't know what is exatcly...
vehModel = Model of the vehicle
vehCol1 = First Color
vehCol2 = Second Color
vehX = X Position
vehY = Y Position
vehZ = Z Position
vehAng = Where the vehicle is pointing
------------------------------------------------------------------------------------------
HERE ARE THE START OF THE COMMANDS I HAVE MADE, I NEED HELP ABOUT COMPLETE THEM
------------------------------------------------------------------------------------------
/buycar
pawn Код:
if(!strcmp("/buycar", cmdtext, true))
{
new State;
State=GetPlayerState(playerid);
if(State==PLAYER_STATE_DRIVER)
{
new vehicleid = GetPlayerVehicleID(playerid);
if(IsVehicleOwned[vehicleid])
{
if(IsVehicleOwned[vehicleid])
{
if(!strcmp(vehOwnerName[vehicleid],("Concessionario")))
{
SendClientMessage(playerid, COLOR_GREEN, "Hai appena acquistato un veicolo!");
SendClientMessage(playerid, COLOR_GREY, "Aiuto: Il veicolo ti appartiene legalmente, rimarrа per sempre tuo tranne se esplode, perchи sarа distrutto in modo permanente");
//-------------CODE TO INSERT FOR SAVE THE CAR BUYED IN A FILE----------------//
// HERE...
//----------------------------------------------------------------------------//
}
else
{
SendClientMessage(playerid, COLOR_GREY, "Aiuto: Non puoi acquistare veicoli che sono appartenenti ad altri giocatori!");
}
}
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, "Aiuto: Devi stare al posto di guida per comprare un veicolo");
return 1;
}
}
pawn Код:
if(!strcmp("/park", cmdtext, true))
{
if(IsPlayerInAnyVehicle(playerid))
{
new State;
State=GetPlayerState(playerid);
if(State==PLAYER_STATE_DRIVER)
{
new vehicleid = GetPlayerVehicleID(playerid);
new name[200];
if(IsVehicleOwned[vehicleid])
{
GetPlayerName(playerid, name, sizeof(name));
if(!strcmp(vehOwnerName[vehicleid],name))
{
SendClientMessage(playerid, COLOR_GREY, "Aiuto: Hai parcheggiato un tuo veicolo");
//---------CODE TO INSERT FOR SAVE THE "PARK" POSITION IN A FILE----------//
// HERE...
//----------------------------------------------------------------------------//
}
else
{
SendClientMessage(playerid, COLOR_GREY, "Aiuto: Non puoi parcheggiare un veicolo che non ti appartiene!");
}
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, "Aiuto: Non sei al posto di guida!");
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, "Aiuto: Per parcheggiare un veicolo devi essere nel suo interno e al posto di guida!");
}
return 1;
}
pawn Код:
if(!strcmp("/sellcar", cmdtext, true))
{
new vehicleid = GetPlayerVehicleID(playerid);
if(IsPlayerInAnyVehicle(playerid))
{
new State;
State=GetPlayerState(playerid);
if(State==PLAYER_STATE_DRIVER)
{
if(IsVehicleOwned[vehicleid])
{
new name[200];
GetPlayerName(playerid, name, sizeof(name));
if(!strcmp(vehOwnerName[vehicleid], name))
{
SendClientMessage(playerid, COLOR_GREEN, "Hai appena venduto un veicolo di tua proprietа!");
//-------------CODE TO INSERT FOR SAVE THE CAR SOLD IN A FILE-----------------//
// HERE... vehOwnerName MUST CHANGE IN "CONCESSIONARIO"
//----------------------------------------------------------------------------//
}
else
{
SendClientMessage(playerid, COLOR_GREY, "Aiuto: Non puoi vendere veicoli che non ti appartengono!");
}
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, "Aiuto: Non puoi vendere il veicolo se non sei nel suo interno al posto di guida!");
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, "Aiuto: Devi stare al posto di guida per vendere un veicolo");
return 1;
}
}