vehicle choose
#1

how can i do that every time when i use the command it will spawn me an another type of vehicle??
PHP код:
if(!strcmp(cmdtext"/car"true))
{
if(
IsPlayerAdmin(playerid))
{
new 
Float:x,Float:y,Float:z,Float:angle;
GetPlayerPos(playeridx,y,z);
car CreateVehicle(522,x,y,z,angle0160);
PutPlayerInVehicle(playeridcar0);
}
return 
1;

Reply
#2

Which type of vehicle you want to spawn for you?
Reply
#3

Try this one, it will randomize between every available vehicle, including (baggage/luggage) trailers and RC vehicles.

pawn Код:
if(!strcmp(cmdtext, "/car", true))
{
    if(IsPlayerAdmin(playerid))
    {
        new Float:x,Float:y,Float:z,Float:angle, thiscar, model;
        model = 400+random(611-400) //randomize between two integers: minimum + random(maximum - minimum)
        GetPlayerPos(playerid, x,y,z);
        thiscar = CreateVehicle(model,x,y,z,angle, 0, 1, 60);
        PutPlayerInVehicle(playerid, thiscar, 0);
    }
    return 1;
}
Reply
#4

pawn Код:
stock randvehcile()
{
   new veh = random(3);
   new model;
   switch(veh)
   {
       case 0: { model = 560; } //sultan
       case 1:  { model = 562; } // elegy
       case 2:  { model = 522; } // fcr 900 i guess
   }
   return model;
}
Use that stock instead of your model id on CreateVehicle

- Edit: Rename the stock it was supposed to be randvehicle
Reply
#5

i have error
Quote:

D:\Marik\LV server\LV server\gamemodes\RaceSystem.pwn(51) : error 076: syntax error in the expression, or invalid function call
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Error.

Quote:

car = CreateVehicle(randvehicle,x,y,z,angle, 0, 1, 60);

Reply
#6

pawn Код:
car = CreateVehicle(randvehicle(),x,y,z,angle, 0, 1, 60);
Reply
#7

tnx man you pro!!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)