Car dont spawn.

Started by NicusorN5, Jun 20, 2016, 11:47 AM

Previous topic - Next topic

NicusorN5

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]

KAKAN

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);
 }
oh no

NicusorN5


Luis_Labarca

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);
}
}
My server RP
IP: 51.222.28.159:8194

Mötley

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;
    }

NicusorN5

Uhh, yeah , it is actually fixed.... Closed!