[Filterscript] I need help with a trailer script. -
Ariehh - 06.05.2012
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!!!
Re: [Filterscript] I need help with a trailer script. -
[HiC]TheKiller - 06.05.2012
pawn Код:
if(GetVehicleModel(vid)==403||514||515)//check if the model corresponds to one of the models you want
This should be more like:
pawn Код:
if(GetVehicleModel(vid)==403||GetVehicleModel(vid)==514||GetVehicleModel(vid)==515)//check if the model corresponds to one of the models you want
Re: [Filterscript] I need help with a trailer script. -
Ariehh - 06.05.2012
Quote:
Originally Posted by [HiC]TheKiller
pawn Код:
if(GetVehicleModel(vid)==403||514||515)//check if the model corresponds to one of the models you want
This should be more like:
pawn Код:
if(GetVehicleModel(vid)==403||GetVehicleModel(vid)==514||GetVehicleModel(vid)==515)//check if the model corresponds to one of the models you want
|
It still does not work..
do you know how to make this script?
thanks in advance!
Re: [Filterscript] I need help with a trailer script. -
Ranama - 06.05.2012
I'm not raely that good about this, but ! means "NO"
so change - - -"if(!strcmp("/trailer",cmdtext,true))//the command"
to - - - - - - - "if(strcmp("/trailer",cmdtext,true))//the command"
and it should work?
Re: [Filterscript] I need help with a trailer script. -
Ariehh - 06.05.2012
i tried your suggestion, but then when i go in game, it doesnt recognise the command AND i cant log in to my login system anymore :S
Re: [Filterscript] I need help with a trailer script. -
Ranama - 06.05.2012
Test with - - - -"if (strcmp("/trailer", cmdtext, true, 10) == 0)"
I think that one shoud be the basic cmd line for a gamemode.
Re: [Filterscript] I need help with a trailer script. -
Ariehh - 06.05.2012
okay i think its not possible like how i imagined, altough this server has it: 91.121.181.186:7776
maybe a script to just spawn the trailers is enough..
like: /trailer1 spawns arctict1, /trailer2 spawns arctict2, etc..