Show Vehicle Name 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Show Vehicle Name Problem (
/showthread.php?tid=73148)
Show Vehicle Name Problem -
Alec24 - 13.04.2009
I have a text draw that shows the current location and vehicle name but I am having some trouble:
Код:
new VehNames[212][] = { // Vehicle Names - Betamaster
{"Landstalker"},
{"Bravura"},
{"Buffalo"},
{"Linerunner"},
{"Perrenial"},
{"Sentinel"},
......more cars
{"Utility Trailer"}
};
Код:
forward UpdateText(vehicleid);
Код:
stock GetVehicleModelIDFromName(vehname[])
{
for(new i = 0; i < 211; i++)
{
if (strfind(VehNames[i], vehname, true) != -1) return i + 400;
}
return -1;
}
Код:
public UpdateText(vehicleid)
{
for(new i=0; i<SLOTS;i++)
if(IsPlayerConnected(i))
{
new NEWTEXT[256];
new curv;
GetVehicleModel(curv);
new car = GetVehicleModelIDFromName(vehicleid); <<<<<<Line 827
format(NEWTEXT,256, "Location: %s Vehicle: %s", GetPlayerArea(i),VehNames[GetVehicleModel(car)-400]);
TextDrawSetString(Location[i], NEWTEXT);
}
return 1;
}
}
Код:
C:\Program Files\Rockstar Games\GTA San Andreas\SAMP\Server\filterscripts\LocDisplays.pwn(827) : error 035: argument type mismatch (argument 1)
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
1 Error.
Re: Show Vehicle Name Problem -
ICECOLDKILLAK8 - 13.04.2009
Just use
pawn Код:
new NEWTEXT[256];
format(NEWTEXT,256, "Location: %s Vehicle: %s", GetPlayerArea(i),VehNames[GetVehicleModel(GetVehicleID(playerid))+400]);
TextDrawSetString(Location[i], NEWTEXT);
Re: Show Vehicle Name Problem -
Alec24 - 13.04.2009
Thanks for the reply. It compiles with no errors but it will not display the vehicle name.
I have also modified it to this:
pawn Код:
public UpdateText(playerid)
{
for(new i=0; i<SLOTS;i++)
if(IsPlayerConnected(i))
{
new NEWTEXT[256];
if(IsPlayerInAnyVehicle(playerid))
{
format(NEWTEXT,256, "Location: %s Vehicle: %s", GetPlayerArea(i),VehNames[GetVehicleModel(GetPlayerVehicleID(playerid))+400]);
TextDrawSetString(Location[i], NEWTEXT);
}else{
format(NEWTEXT,256, "Location: %s", GetPlayerArea(i));
TextDrawSetString(Location[i], NEWTEXT);
}
}
return 1;
}
Anybody have any ideas on how to fix this, Thanks.
Re: Show Vehicle Name Problem -
ICECOLDKILLAK8 - 13.04.2009
What does it show?
Re: Show Vehicle Name Problem -
Alec24 - 13.04.2009
I have now fixed it, I think the problem was the "+400" when it should have been "-400"
This works:
pawn Код:
public UpdateText(playerid)
{
for(new i=0; i<SLOTS;i++)
if(IsPlayerConnected(i))
{
new NEWTEXT[256];
if(IsPlayerInAnyVehicle(playerid))
{
new VID = GetPlayerVehicleID(playerid);
format(NEWTEXT,256, "Location: %s Vehicle: %s", GetPlayerArea(i),VehNames[GetVehicleModel(VID)-400]);
TextDrawSetString(Location[i], NEWTEXT);
}else{
format(NEWTEXT,256, "Location: %s", GetPlayerArea(i));
TextDrawSetString(Location[i], NEWTEXT);
}
}
return 1;
}
Thanks for the help
JeNkStAX