Spawn In Random Car!
#1

Hey!
I have 1 question!
How can i do something like when someone uses a command like /derby ,puts that player into a random car?

Thanks!
Reply
#2

TOP:
pawn Код:
new Derby[5]; // don't know how much derby cars you got, but if you got 4 put in here 5
OnGameModeInit
pawn Код:
Derby[1] = AddStaticVehicle(...); // put in here your vehicles
Derby[2] = AddStaticVehicle(...);
Derby[3] = AddStaticVehicle(...);
Derby[4] = AddStaticVehicle(...);
/* if they are in a Interior your need to: LinkVehicleToInterior(Derby[1], Interior); for all vehicles */
OnPlayerCommandText
pawn Код:
new cmd[256], idx;
if(!strcmp(cmd, "/derby"))
{
   for(new i; i<MAX_PLAYERS; i++)
   {
      new rand=random(5); // or 4 don't know anymore :P
      if(!IsPlayerInVehicle(i, Derby[rand])) return PutPlayerInVehicle(playerid, Derby[rand], 0);
      else return SendClientMessage(playerid, 0xFF0000, "Retry the command, please!"); // don't know something else
   }
}
Reply
#3

pawn Код:
new Derby[5];

Derby[0] = AddStaticVehicle(...);
Derby[1] = AddStaticVehicle(...);
Derby[2] = AddStaticVehicle(...);
Derby[3] = AddStaticVehicle(...);
Derby[4] = AddStaticVehicle(...);
Reply
#4

Thanks!
I was thinking at something like this but wasnt really sure how to do it !

Once again thanks!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)