[FilterScript] Vehicle Spawn /V Carname|Carid Color1 Color2
#41

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.
Reply
#42

Very nice.
Reply
#43

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

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;
}
Reply
#45

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.
Reply
#46

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

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

Nice job.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)