Car system... - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Car system... (
/showthread.php?tid=90064)
Car system... -
coole210 - 05.08.2009
I've posted twice about my car system and nobody gave a straight answer!
Don't say "Stop posting about the same topic" or something useless like that.
Give me a straight answer. How the fuck do i fix this car system?
pawn Код:
if(strcmp(cmd, "/buy", true) == 0)
{
if(IsPlayerConnected(playerid))
{
new playername[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername, sizeof(playername));
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])
{
new c;
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]);
format(string,sizeof(string),"[ ! ] You have successfully purchased this %s!",Cars[GetPlayerVehicleID(playerid)][cDescription]);
SendClientMessage(playerid, COLOR_GREEN, string);
SaveCars();
OnPlayerDataSave(playerid);
return 1;
}
else
{
SendClientMessage(playerid, c_r, "[ ! ] You don't have enough Money!");
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 %s for %i Rcash!",Cars[car][cDescription],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;
}
It always says when i buy a car its a turismo ( ID 0 ) when i need to make it for the other cars. ( Cheetah and Infernus )
So what do i do to make this work?
Re: Car system... -
coole210 - 06.08.2009
ffs another post like this...
Re: Car system... -
Correlli - 06.08.2009
Stop spaming, it's not surprising that no one helps you.
Read the rule about bumping.
Re: Car system... -
yezizhu - 06.08.2009
Haven't you noticed I sent pm to you days ago?
Re: Car system... -
coole210 - 06.08.2009
Yeah i noticed your Pm it just fucked up my GM completely i couldnt load it ...
Re: Car system... -
kaisersouse - 06.08.2009
Youve created 5 separate topics on this issue.
This code comes from and existing FS located here:
http://forum.sa-mp.com/index.php?topic=78765.0
Ask your questions in there. Don't make another thread here about it.