Sunday, November 14, 2010

SAMP Scripting Tutorial: Dialog Box | Menus | Spawn Vehicles

Here is the code

// OnPlayerCommandText
if(strcmp(cmdtext,"/veh",true)==0)
{
 ShowPlayerDialog(playerid,1,DIALOG_STYLE_LIST,"Vehicles","1.Rhino\n2.Firetruck\n3.Infernus\n4.Turismo\n5.Dumper","Spawn","Exit");
 return 1;
}

// OnDialogResponse
new Float:x,Float:y,Float:z;
if(dialogid==1 && response==1)
{
 switch(listitem)
 {
  case 0:
  {
   GetPlayerPos(playerid,x,y,z);
   CreateVehicle(432,x-3.0,y,z,0.0,1,1,300);
  }
  case 1:
  {
   GetPlayerPos(playerid,x,y,z);
   CreateVehicle(407,x-3.0,y,z,0.0,1,3,300);
  }
  case 2:
  {
   GetPlayerPos(playerid,x,y,z);
   CreateVehicle(411,x-3.0,y,z,0.0,1,0,300);
  }
  case 3:
  {
   GetPlayerPos(playerid,x,y,z);
   CreateVehicle(451,x-3.0,y,z,0.0,0,1,300);
  }
  case 4:
  {
   GetPlayerPos(playerid,x,y,z);
   CreateVehicle(406,x-3.0,y,z,0.0,1,1,300);
  }
 }
}

7 comments:

  1. Great information! I’ve been looking for something like this for a while now. Thanks!

    ReplyDelete
  2. Thanks dude,this helped me alot!

    ReplyDelete
  3. i have error
    error 017: undefined symbol "ReadPlayer"
    error 017: undefined symbol "WritePlayer"

    ReplyDelete