SA-MP Forums Archive
A car problem - 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)
+--- Thread: A car problem (/showthread.php?tid=393648)



A car problem - IuLyAnBoSs - 19.11.2012

Hey.
So I have a problem in their cars.
When I do not get in the show owner's name.
We changed the way you buy with dialogue and everything goes not only shows me the name of the owner.



Look here the system you "v buy":
Quote:

if(newstate == PLAYER_STATE_DRIVER) //buggy dont finnish
{// 38 / 49 / 56 = SS
new newcar = GetPlayerVehicleID(playerid);
TelePos[playerid][0] = 0.0;
TelePos[playerid][1] = 0.0;
if(IsAnOwnableCar(newcar))
{
if(CarInfo[newcar][cOwned]==0)
{
new str[650];
format(str,650,""color_red"\t\t\t\tPersonal Car:\n\n");
format(str,650,"%s"wh"• Aceasta aste o masina personala.\n",str);
format(str,650,"%s"wh"• Nu o puteti coduce deoarece nu aveti chei la ea.\n",str);
format(str,650,"%s"wh"• Daca doriti sa o achizitionati nu trebuie decat sa apasati pe butonul buy.\n",str);
format(str,650,"%s"wh"• Daca nu doriti sa o cumparati va rugam sa apasati pe butonul close.\n\n",str);
format(str,650,"%s"color_red"\t\t\t\tInfo Car:\n",str);
format(str,650,"%s"wh"• Pret: "color_green"%d$\n",str,CarInfo[newcar][cValue]);
format(str,650,"%s"wh"• Marca: "color_green"%s\n",str,CarInfo[newcar][cDescription]);
format(str,650,"%s"wh"• Propietar: "color_green"%s\n",str,CarInfo[newcar][cOwner]);
ShowPlayerDialog( playerid, 674, DIALOG_STYLE_MSGBOX, " ", str, "Buy", "Close" );
}
if(CarInfo[newcar][cOwned]>=1)
{
format(string,sizeof(string),"This car is owned by %s",CarInfo[newcar][cOwner]);
SCM(playerid, COLOR_BLUE, string);
/*if(keycar != vehicle)
{
RemovePlayerFromVehicle(playerid);
SCM(playerid, COLOR_GREY, "You don't have a key of this vehicle");
}*/
if(PlayerInfo[playerid][pPcarkey] == vehicle) { }
else if(PlayerInfo[playerid][pPcarkey2] == vehicle) { }
else if(PlayerInfo[playerid][pPcarkey3] == vehicle) { }
else
{
if(PlayerInfo[playerid][pAdmin] >= 5 && AdminDuty[playerid] == 1)
{
SendClientMessage(playerid, COLOR_GREY, " You can drive this car because you are admin on duty !");
}
else
{
//RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, COLOR_GREY, "You don't have a key of this vehicle");
}
}
}
}


And dialogue should be checked if:

Quote:

if(dialogid == 674)
{
if(response)
{
if(IsAnOwnableCar(idcar))
{
if(PlayerInfo[playerid][pLevel] < 2)
{
RemovePlayerFromVehicle(playerid);
SCM(playerid, COLOR_GREY, "Pentru a iti cumpara o masina personala ai nevoie de level 2 !");
return 1;
}
if(PlayerInfo[playerid][pPcarkey] == 999) { }
else if(PlayerInfo[playerid][pPcarkey2] == 999) { }
else
{
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, COLOR_GREY, " Ai deja 2 masini");
return 1;
}
if(CarInfo[idcar][cOwned]==1)
{
RemovePlayerFromVehicle(playerid);
SCM(playerid, COLOR_GREY, "Someone already owns this car");
return 1;
}
if(GetPlayerMoney(playerid) >= CarInfo[idcar][cValue])
{
if(PlayerInfo[playerid][pPcarkey] == 999) { PlayerInfo[playerid][pPcarkey] = idcar; }
else if(PlayerInfo[playerid][pPcarkey2] == 999) { PlayerInfo[playerid][pPcarkey2] = idcar; }
else if(PlayerInfo[playerid][pPcarkey3] == 999) { PlayerInfo[playerid][pPcarkey3] = idcar; }
else { return 1; }
CarInfo[idcar][cOwned] = 1;
strmid(CarInfo[idcar][cOwner], sendername, 0, strlen(sendername), 999);
GivePlayerMoney(playerid,-CarInfo[idcar][cValue]);
PlayerPlayMusic(playerid);
new str[300];
format(str,300,""color_red"\t\t\t\tInformatii:\n\n \n");
format(str,300,"%s"wh"Ati achizitionat o masina marca "color_yellow"%s "wh"la un pret de "color_green"%d$.\n",str,CarInfo[idcar][cDescription],CarInfo[idcar][cValue]);
format(str,300,"%s"wh"Pentru mai multe comenzii de utilizare a masinii folositi /v help.\n",str);
ShowPlayerDialog( playerid, 675, DIALOG_STYLE_MSGBOX, " ", str, "Close", "" );
OnPropUpdate();
OnPlayerUpdateEx(playerid);
TogglePlayerControllable(playerid, 1);
return 1;
}
else
{
RemovePlayerFromVehicle(playerid);
SCM(playerid, COLOR_GREY, " You don't have enough cash with you ! ");
return 1;
}
}
}
else
{
RemovePlayerFromVehicle(playerid);
SCM(playerid, COLOR_WHITE, "O zi buna in continuare.");
return true ;
}
}

So everything works correctly only shows me not the car owners name.


Re: A car problem - Konstantinos - 19.11.2012

Replace
pawn Код:
strmid(CarInfo[idcar][cOwner], sendername, 0, strlen(sendername), 999);
with
pawn Код:
format(CarInfo[idcar][cOwner], MAX_PLAYER_NAME, sendername );
// I hope 'sendername' stores the name. So, let's debug it to be sure
printf("cOwner = %s", CarInfo[idcar][cOwner]);



Re: A car problem - IuLyAnBoSs - 19.11.2012

Still does not work, look the same as before


Re: A car problem - Konstantinos - 19.11.2012

The problem is that it doesn't store the name. The part I posted , it should be on the owned a new car.
So, if it didn't store your name, and you're trying on the already existed owned car, it won't work. Try to own a new car and tell me if it shows the name in a message on the chat or in the server window (printf).


Re: A car problem - [Dejo] - 19.11.2012

Got same problem at my server... D:
If i fix it ill tell you