27.07.2009, 20:30
Here's my OnPlayerEnterVehicle
When i enter a vehicle it just says Turismo Price: 100
This happens for ALL vehicles including the Cheetah and Infernus in my scriptfiles..
And when i buy a vehicle i buy the infernus inside the turismo, then i try to sell the infernus it says i dont even own a vehicle? heres my /buy and /sell command:
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
new string[128];
if(Cars[GetPlayerVehicleID(playerid)][cOwned] == 0)
{
format(string,sizeof(string),"[ ! ] ID : %d ' %s ' Price : %d RCASH",GetPlayerVehicleID(playerid),Cars[GetPlayerVehicleID(playerid)][cDescription],Cars[GetPlayerVehicleID(playerid)][cPrice]);
SendClientMessage(playerid,COLOR_GREY,string);
return 0;
}
if(Cars[GetPlayerVehicleID(playerid)][cOwned] == 1)
{
format(string,sizeof(string),"[ ! ] ID : %d ' %s ' Bought by : %s",GetPlayerVehicleID(playerid),Cars[GetPlayerVehicleID(playerid)][cDescription],Cars[GetPlayerVehicleID(playerid)][cOwner]);
SendClientMessage(playerid,COLOR_GREY,string);
return 0;
}
return 1;
}
This happens for ALL vehicles including the Cheetah and Infernus in my scriptfiles..
And when i buy a vehicle i buy the infernus inside the turismo, then i try to sell the infernus it says i dont even own a vehicle? heres my /buy and /sell command:
pawn Код:
if(strcmp(cmd, "/buy", true) == 0)
{
if(IsPlayerConnected(playerid))
{
new playername[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername, sizeof(playername));
for(new c=0;c<sizeof(Cars);c++)
{
if(IsPlayerInAnyVehicle(playerid))
{
if(Cars[GetPlayerVehicleID(playerid)][cOwned] == 1)
{
SendClientMessage(playerid,c_r,"[ ! ] This car is bought !");
return 1;
}
if(Cars[GetPlayerVehicleID(playerid)][cPrice] == 0)
{
SendClientMessage(playerid, c_r, "[ ! ] A price isn't set for this car, it is not meant to be bought!");
return 1;
}
if(PlayerInfo[playerid][pCarKey] != 255 && strcmp(playername, Cars[GetPlayerVehicleID(playerid)][cOwner], true) == 0)
{
SendClientMessage(playerid, c_r, "[ ! ] You can only own one car, sell your original car first before buying this one!");
return 1;
}
if(GetPlayerRcash(playerid) >= Cars[GetPlayerVehicleID(playerid)][cPrice])
{
PlayerInfo[playerid][pCarKey] = c;
Cars[GetPlayerVehicleID(playerid)][cOwned] = 1;
strmid(Cars[GetPlayerVehicleID(playerid)][cOwner], playername, 0, strlen(playername), 255);
GivePlayerRcash(playerid,-Cars[GetPlayerVehicleID(playerid)][cPrice]);
SendClientMessage(playerid, COLOR_GREEN, "[ ! ] You have successfully purchased this car!");
SaveCars();
OnPlayerDataSave(playerid);
return 1;
}
else
{
SendClientMessage(playerid, c_r, "[ ! ] You don't have enough rcash!");
return 1;
}
}
}
}
return 1;
}
if(strcmp(cmd, "/sell", true) == 0)
{
if(IsPlayerConnected(playerid))
{
new playername[MAX_PLAYER_NAME];
new car = PlayerInfo[playerid][pCarKey];
GetPlayerName(playerid, playername, sizeof(playername));
if(PlayerInfo[playerid][pCarKey] != 255 && strcmp(playername, Cars[PlayerInfo[playerid][pCarKey]][cOwner], true) == 0)
{
if(IsPlayerInAnyVehicle(playerid))
{
if(Cars[car][cOwned] == 0)
{
SendClientMessage(playerid,c_r,"[ ! ] This car is not owned by you !");
return 1;
}
Cars[car][cOwned] = 0;
strmid(Cars[car][cOwner], "None", 0, strlen("None"), 255);
GivePlayerRcash(playerid,Cars[car][cPrice]);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
format(string, sizeof(string), "[ ! ] You have sold your Car for %i rcash!",Cars[car][cPrice]);
SendClientMessage(playerid, COLOR_GREEN, string);
PlayerInfo[playerid][pCarKey] = 255;
OnPlayerDataSave(playerid);
SaveCars();
return 1;
}
else
{
SendClientMessage(playerid,c_r,"[ ! ] You must be inside your car to sell it!");
}
}
else
{
SendClientMessage(playerid,c_r,"[ ! ] You don't even own a car!");
}
}
return 1;
}