Vice City: Multiplayer

Server Development => Scripting and Server Management => Topic started by: NicusorN5 on Jun 20, 2016, 11:47 AM

Title: Car dont spawn.
Post by: NicusorN5 on Jun 20, 2016, 11:47 AM
I'm using this command:
if (cmd == "spawncar")
{
CreateVehicle(text,player.World,player.Pos.x,player.Pos.y+10,player.Pos.z,0,rand() % 94,rand() % 94);
}
But i see no new car on the map.I also don't see it's white square.On this command I use ID's not names.What is wrong?[/s]
Also this command is not working.
if (cmd=="weapon"){
if (!text) MessagePlayer("[#ff0000]Use /weapon <id>",player);
    if (text == 1 && player.Cash >= 100)
    {
player.GiveWeapon(text,500);
Message(player+" bought weapon with id "+text);
     player.Cash -= 100;
}
}
[/s]
Title: Re: Car dont spawn.
Post by: KAKAN on Jun 20, 2016, 12:44 PM
they need integer( 1st one, I mean )
The 2nd one needs an interger too, but you've messed that command up so it won't work.
1st one:-
if (cmd == "spawncar")
 {
 CreateVehicle(text.tointeger(),player.World,player.Pos.x,player.Pos.y+10,player.Pos.z,0,rand() % 94,rand() % 94);
 }
Title: Re: Car dont spawn.
Post by: NicusorN5 on Jun 20, 2016, 09:20 PM
Thanks :)
Title: Re: Car dont spawn.
Post by: Luis_Labarca on Jun 21, 2016, 09:18 PM
else if( cmd == "spawncar" )
{
if ( !text ) MessagePlayer ( "/"+cmd+" ModelID <130/236> Not ModelID 181 and 180" , player );
else if ( !IsNum( text ) ) MessagePlayer ( "/"+cmd+" ModelID <130/236> Not ModelID 181 and 180" , player );
else if ( (text.tointeger() < 130) ) MessagePlayer  ("/"+cmd+" ModelID <130/236> Not ModelID 181 and 180" , player );
else if ( (text.tointeger() > 236) ) MessagePlayer  ("/"+cmd+" ModelID <130/236> Not ModelID 181 and 180" , player );
else if ( (text.tointeger() == 180) ) MessagePlayer ("ModelID Invalid /"+cmd+" ModelID <130/236> Not ModelID 181 and 180" , player );
else if ( (text.tointeger() == 181) ) MessagePlayer ("ModelID Invalid /"+cmd+" ModelID <130/236> Not ModelID 181 and 180" , player );
else
{
local IDVehicle=GetVehicleCount();
IDVehicle++;
MessagePlayer ("Added model Vehicle Model : "+text.tointeger()+" Vehicle ID : "+IDVehicle+" " , player );
CreateVehicle(text.tointeger(),player.World,player.Pos.x,player.Pos.y+10,player.Pos.z,0,rand() % 94,rand() % 94);
}
}
Title: Re: Car dont spawn.
Post by: Mötley on Jun 21, 2016, 10:34 PM
That looks terrible^^^.
This is a incomplete version and just needs some additions
Its a good starter command
    if (cmd == "vehicle" || cmd == "v" || cmd == "car" || cmd == "spawncar") {
      if (!text) {
         MessagePlayer( "Vehicle: /vehicle [90-150]", player );
         return true;
      }
   
      if (!IsNum(text)) {
         MessagePlayer( "Vehicle: /vehicle [90-150]", player);
         return true;
      }
 
      local model = text.tointeger();
   
      if (model < 90 || model > 254) {
         MessagePlayer( "Vehicle: /vehicle [90-150]", player);
         return true;
      }
   
      if (player.Vehicle) {
         MessagePlayer( "You must not be in a vehicle", player );
         return true;
      } 
         
      local vehicle = CreateVehicle(model, player.Pos, player.Angle, rand() % 94, rand() % 94);
      if (vehicle) {
        MessagePlayer( "Vehicle spawned: " + model, player);
        player.Vehicle = vehicle;
      }

      return true;
    }
Title: Re: Car dont spawn.
Post by: NicusorN5 on Jun 22, 2016, 11:13 AM
Uhh, yeah , it is actually fixed.... Closed!