Car Units - 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 Units (
/showthread.php?tid=177633)
Car Units -
Callit - 18.09.2010
Hey there,
I'm fairly new to scripting. I know a bit but not a huge deal.
was wondering if its possible some hoe to have it so I can use a command to set a name for a car.
Eg: I get in Vehicle A: a Police Ranger and type /setplate <What I want it to be>
It Saves, Then when Someone gets in that car it says what I put. I know it would require something under
OnPlayerEnterVehicle.
Re: Car Units -
FireCat - 18.09.2010
i think thats impossible
i know there is roleplay server's with car plates but it isnt with a command
This forum requires that you wait 120 seconds between posts. Please try again in 51 seconds.
OH CUMON!!!!
Re: Car Units -
Mike_Peterson - 18.09.2010
Car Plates are deleted since 0.3 and what do u mean with /setplate lol
Re: Car Units -
Callit - 19.09.2010
Like, It writes the carid to a .txt file or something idk use dini and then when you eneter the vehicle it displays the defined car number. Eg if I defined a police ranger as unit 581. When I get in it will say Unit: 581.
The /setplate was an example of a command that would be used to do this.
Re: Car Units -
Claude - 19.09.2010
Impossible
Re: Car Units -
Leeroy. - 19.09.2010
https://sampwiki.blast.hk/wiki/Attach3DTextLabelToVehicle
you can use 3d labels for car plate no in 0.3
Re: Car Units -
Mauzen - 19.09.2010
Guys, this is
absolutely possible, he just wants to show the name on enter, not change the number plate.
Create a big array like this:
new CarNames[MAX_VEHICLES][24];
Ok, this eats a lot of ram, ~200kb, but this should be no big problem.
Then add a command like this (untested):
pawn Код:
//Usage: /setplate <new_name>
if(strcmp("/setplate", cmdtext, true, 9) == 0)
{
if(!IsPlayerInAnyVehicle(playerid)) return 1;
strmid(CarNames[GetPlayerVehicleID(playerid)], cmdtext, 10, strlen(cmdtext));
new text[64];
format(text, 64, "You changed the vehicle's name to %s.", CarNames[GetPlayerVehicleID(playerid)]);
SendClientMessage(playerid, 0xAAAA33AA, text);
return 1;
}
//To show it on vehicle enter add this to your OnPlayerEnterVehicle, as you already mentioned
if(strlen(CarNames[vehicleid])
{
new text[64];
format(text, 64, "You entered the vehicle: %s.", CarNames[vehicleid]);
SendClientMessage(playerid, 0xAAAA33AA, text);
}
//Change all strings to whatever you want
Saving that all would be harder, because most ini includes do not support 2000 entries in a file. You would need a car saver system that creates a file for each car and spawns them from that file, so that there are no problems with changing vehicle ids.
Re: Car Units -
playbox12 - 19.09.2010
Fwrite supports 2000 entries or?, otherwise use mysql
Re: Car Units -
Callit - 21.09.2010
Is it possible to save it so you dont have to do it every time the server restarts??
Re: Car Units -
Callit - 23.09.2010
Bump. Been over 24 Hours