NEW QUESTION, FORGET THE CAMOFLAUGE i wanna spawn a vehicle in a command.
#1

I want to make it so u can type /nrg and you appear in an NRG (it will cost you money of course) but i got that handled


i just want to know howto make it so you are in the vehicle you buy when you type the command.


~~[Drift]~~



Quote:

Sometimes i dont know the simplest stuff. XD! lolz.

Reply
#2

Код:
if (strcmp(command. .........))
{
  new vehid = CreateVehicle(.............);
  PutPlayerInVehicle(playerid, vehid, 0);
  return 1;
}
?
Reply
#3

alright thanks a lot man lolz, i know a lot of the more advanced stuff, and forget about the simple stuff lol.
Reply
#4

ok so i tried it and i got this error
Код:
C:\Users\rac\Desktop\gtasa and samp\filterscripts\pchs.pwn(164) : warning 202: number of arguments does not match definition
C:\Users\rac\Desktop\gtasa and samp\filterscripts\pchs.pwn(164) : warning 202: number of arguments does not match definition
C:\Users\rac\Desktop\gtasa and samp\filterscripts\pchs.pwn(164) : warning 202: number of arguments does not match definition
C:\Users\rac\Desktop\gtasa and samp\filterscripts\pchs.pwn(164) : warning 202: number of arguments does not match definition
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Warnings.
and this is how i did it, can you correct it for me? thanks a lot. =)

Код:
if (strcmp("/nrg", cmdtext, true, 10) == 0)
	{
		if(GetPlayerMoney(playerid) <= 17750) return SendClientMessage(playerid,red, "You need $17,750");
		new vehid = CreateVehicle(522,3220.9900,-2424.9033,2.5561);
  	      PutPlayerInVehicle(playerid, vehid, 522);
		SendClientMessage(playerid,yellow,"you have succesfully purchased an nrg motorcycle.");
		return 1;
	}
eccept the part that says PutPlayerInVehicle(playerid, vehid, 522); os in line its not off like it is n the code
Reply
#5

Drift, READ THE DAMN WIKI!!


Jesus chrsit it was created for a reason!!

https://sampwiki.blast.hk/wiki/CreateVehicle
Reply
#6

ok dude ok, i just used that link u gave me, before u gave me it, but when i use the command, it takes me to the vehicle, i need it to bring the vehicle to me, and for me to appear in it.
Reply
#7

seriously, buy a book on any scripting language, and learn it from the bottom up... let's go through what you want..

Код:
command: /nrg
 - check if the player has enough money
  > no? close command
  > yes? continue command

 - creates a vehicle at playerids location
 - put playerid on the vehicle
 - charge money
 - make a nice message
this is the mental bit about creating this command.. so next is: how do you transfer your idea to code? Well, we need several things: a check if the command is /nrg, a check if the player has enough money, we need the players location and a few commands to make a vehicle and charge money.

pawn Код:
if (strcmp("/nrg", cmdtext, true) == 0) // check command
{
  if(GetPlayerMoney(playerid) <= 17750) // check money
    return SendClientMessage(playerid,red, "You need $17,750"); // if not enough money, stop the command, else continue

  // now we need the player position
  new Float:x, Float:y, Float:z, Float:a;
  GetPlayerPos(playerid,x,y,z);
  a = GetPlayerFacingAngle(playerid);

  // now create the vehicle and put the player on it
  new vehid = CreateVehicle(model, x, y, z, a, color1, color2, respawn_delay);
  PutPlayerOnVehicle(playerid, vehid, 0);

  // charge money
  GivePlayerMoney(playerid, -17750);

  // message
  SendClientMessage(playerid, COLOR_SOMETHING, "Here's your NRG-500!");

  // end command
  return 1;
}
that's all there is to it.
Reply
#8

really? when i use that i get these errores, i think u gotta define a code or something,

Код:
C:\Users\rac\Desktop\gtasa and samp\filterscripts\pchs.pwn(176) : warning 202: number of arguments does not match definition
C:\Users\rac\Desktop\gtasa and samp\filterscripts\pchs.pwn(179) : error 017: undefined symbol "model"
C:\Users\rac\Desktop\gtasa and samp\filterscripts\pchs.pwn(180) : error 017: undefined symbol "PutPlayerOnVehicle"
C:\Users\rac\Desktop\gtasa and samp\filterscripts\pchs.pwn(179) : warning 204: symbol is assigned a value that is never used: "vehid"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.
Reply
#9

He forgot a bracket
Use this
pawn Код:
if (strcmp("/nrg", cmdtext, true) == 0) // check command
{
  if(GetPlayerMoney(playerid) <= 17750) // check money
  {
    return SendClientMessage(playerid,red, "You need $17,750"); // if not enough money, stop the command, else continue
  }

  // now we need the player position
  new Float:x, Float:y, Float:z, Float:a;
  GetPlayerPos(playerid,x,y,z);
  a = GetPlayerFacingAngle(playerid);

  // now create the vehicle and put the player on it
  new vehid = CreateVehicle(model, x, y, z, a, color1, color2, respawn_delay);
  PutPlayerOnVehicle(playerid, vehid, 0);

  // charge money
  GivePlayerMoney(playerid, -17750);

  // message
  SendClientMessage(playerid, COLOR_SOMETHING, "Here's your NRG-500!");

  // end command
  return 1;
}
Reply
#10

yeah i just fixed that, but i got 2 errors.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)