[Filterscript] I need help with a trailer script.
#1

I really want a script for my server that will spawn a trailer after a command (/trailer) end then it attaches to my truck.

ive had a lot of help but i still cant get it working.

This is the code so far:
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp("/trailer",cmdtext,true))//the command
    {
        new vid = GetPlayerVehicleID(playerid);//get the id of the vehicle where you are
        if(GetVehicleModel(vid)==403||514||515)//check if the model corresponds to one of the models you want
        {
            if(IsTrailerAttachedToVehicle(vid)) DestroyVehicle(GetVehicleTrailer(vid));//if you already have a trailer it will destroy to create another
            new newcar;//create a new variable to store the id in order to store the trailer to his tipper
            switch(random(4))//random from 0 to 4 while seeking the number corresponding to the random
            {
                case 0:newcar=CreateVehicle(584,0.0,0.0,0.0,0.0,-1,-1,-1);
                case 1:newcar=CreateVehicle(435,0.0,0.0,0.0,0.0,-1,-1,-1);
                case 2:newcar=CreateVehicle(450,0.0,0.0,0.0,0.0,-1,-1,-1);
                case 3:newcar=CreateVehicle(591,0.0,0.0,0.0,0.0,-1,-1,-1);
            }
            AttachTrailerToVehicle(newcar,vid);//attach the trailer to your chosen vehicle
            return 1;
        }
        return 1;
    }
    return 0;
}
I tried to paste it into my gamemode and no errors showed up, but when i tested it, no trailers were spawning!
so i tried making a filterscript of it but ive got alack of skills to do that.. too many errors..

Could anyone Edit this code to get it working in a gamemode, or copy paste the WHOLE code for in a filterscript?

Thanks in advance!!!
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)