Car owner on Enter vehicle. - 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: Car owner on Enter vehicle. (
/showthread.php?tid=321782)
Car owner on Enter vehicle. -
ricardo178 - 28.02.2012
Hello. I am trying to make it says the owner of the vehicle when player enter it, but it's not working. All it says is: [SERVER]: This is Vehicle. instead of [SERVER]: This is OwnerName Vehicle.
My code of OnPlayerEnterVehicle is:
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid)
{
format(file, sizeof(file), "RRP/vehicles/%d.ini", vehicleid);
if(fexist(file))
{
new string[128];
format(string, sizeof(string), "[SERVER]: This is %s vehicle.", dini_Int(file, "Owner"));
SendClientMessage(playerid, COLOR_LIGHTRED, string);
}
}
The file of one of the vehicles i am trying to enter is:
Код:
X=1965.977661
Y=1289.736816
Z=10.525081
A=355.682922
Model=560
Color1=1
Color2=1
Price=10000
Owner=Ricardo_Rodrigues
Ownable=2
Lock=0
Weapon1=0
Weapon2=0
Weapon3=0
Weapon4=0
Weapon5=0
Materials=0
This is all self made codes.
Thank you.
Re: Car owner on Enter vehicle. -
milanosie - 28.02.2012
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid)
{
format(file, sizeof(file), "RRP/vehicles/%d.ini", vehicleid);
if(fexist(file))
{
new string[128];
format(string, sizeof(string), "[SERVER]: This is %s vehicle.", dini_Get(file, "Owner"));
SendClientMessage(playerid, COLOR_LIGHTRED, string);
}
}
Name is a string, not integer
Re: Car owner on Enter vehicle. -
FuTuяe - 28.02.2012
Use this:
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid)
{
format(file, sizeof(file), "RRP/vehicles/%d.ini", vehicleid);
if(fexist(file))
{
new string[128];
format(string, sizeof(string), "[SERVER]: This is %s vehicle.", dini_Get(file, "Owner"));
SendClientMessage(playerid, COLOR_LIGHTRED, string);
}
}
You can not use 'dini_Int' since it's not an integer thus you'll have to use dini_Get.
Edit: person above has beaten me to it :P