SA-MP Forums Archive
[FilterScript] Vehicle Spawn /V Carname|Carid Color1 Color2 - 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: Filterscripts (https://sampforum.blast.hk/forumdisplay.php?fid=17)
+--- Thread: [FilterScript] Vehicle Spawn /V Carname|Carid Color1 Color2 (/showthread.php?tid=346727)

Pages: 1 2 3


Re: Vehicle Spawn /V Carname|Carid Color1 Color2 - AiRaLoKa - 05.06.2014

Quote:
Originally Posted by thundercraft
Посмотреть сообщение
Hi guys,
I'am a noob and don't now where I must place that file?
In my plugin map?
just place it you your server directory > filterscripts.


Re: Vehicle Spawn /V Carname|Carid Color1 Color2 - iRaiDeN - 05.06.2014

Very nice.


Re: Vehicle Spawn /V Carname|Carid Color1 Color2 - HeLiOn_PrImE - 05.06.2014

It works fine, but I do have a question. How can I display the name of the car that I just spawned?


Re: Vehicle Spawn /V Carname|Carid Color1 Color2 - AiRaLoKa - 05.06.2014

Quote:
Originally Posted by HeLiOn_PrImE
Посмотреть сообщение
It works fine, but I do have a question. How can I display the name of the car that I just spawned?
maybe this will help you

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER)
    {
        new str[32];
        if (newstate == 2 || newstate == 3)
        {
            format(str, sizeof(str), "~g~~h~%s",VehicleNames[GetVehicleModel(GetPlayerVehicleID(playerid))-400]);
            GameTextForPlayer(playerid, str, 1500, 1);
        }
    }
    return 1;
}



Re: Vehicle Spawn /V Carname|Carid Color1 Color2 - TheBetaFox - 05.06.2014

OP, you could try the custom vehicle specifier built-in the sscanf include as an example: it'll shorten your code a lot. Think something like this:

pawn Код:
new pVeh[MAX_PLAYERS];

CMD:v(playerid, params[]) {
    new modelid, color[2], fPos[4];
    if(sscanf(params, "k<vehicle>D(1)D(1)", modelid, color[0], color[1]))
        return SendClientMessage(playerid, -1, "USAGE: /v <vehicle id/name> <optional: color1> <optional: color2>");
    if(pVeh[playerid]) DestroyVehicle(pVeh[playerid]);
       
    GetPlayerPos(playerid, fPos[0], fPos[1], fPos[2]);
    GetPlayerFacingAngle(playerid, fPos[3]);
   
    pVeh[playerid] = CreateVehicle(playerid, fPos[0], fPos[1], fPos[2], fPos[3], color[0], color[1], 0);
    LinkVehicleToInterior(pVeh[playerid], GetPlayerInterior(playerid));
    PutPlayerInVehicle(playerid, pVeh[playerid], 0);
    return true;
}
See the code of the vehicle specifier in sscanf.inc to see how it works and you'll soon be on... well, not necessarily the right track, but most certainly an easier one.


Re: Vehicle Spawn /V Carname|Carid Color1 Color2 - ItzRbj - 08.11.2014

i placed the file in filterscripts and added cs in the server.cfg but when i enter the server it doesnt work , any help ?


Re: Vehicle Spawn /V Carname|Carid Color1 Color2 - dan40o - 11.12.2014

it's Bugged. Somethimes when i wanna spawn car, it disappear.


Re: Vehicle Spawn /V Carname|Carid Color1 Color2 - SeeD - 12.05.2018

Nice job.