SA-MP Forums Archive
I need /v command - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: I need /v command (/showthread.php?tid=258732)



I need /v command - mariomako - 01.06.2011

I need /v command for spawn vehicle, with id inputted in parameters, but if the player create the first two cars disappear and the second to stay


Re: I need /v command - Georgelopez1 - 01.06.2011

B00M! https://sampforum.blast.hk/showthread.php?tid=41488


Re: I need /v command - mariomako - 01.06.2011

Quote:
Originally Posted by Georgelopez1
Посмотреть сообщение
but if the player create the first two cars disappear and the second to stay
__________________


Re: I need /v command - PrawkC - 01.06.2011

So you want them to be able to only spawn 1 vehicle? so if they use the cmd again it deletes the old car?


Re: I need /v command - mariomako - 01.06.2011

Quote:
Originally Posted by PrawkC
Посмотреть сообщение
So you want them to be able to only spawn 1 vehicle? so if they use the cmd again it deletes the old car?
yes


Re: I need /v command - PrawkC - 01.06.2011

This will REQUIRE zcmd and sscanf
Код:
CMD:veh(playerid, params[]) {

	new vehid;

	if(sscanf(params, "i", vehid)) SendClientMessage(playerid, COLOR_GREY, "SYNTAX: /veh <carid>");
	else if (vehid < 400 || vehid > 611) SendClientMessage(playerid, COLOR_GREY, "[ERROR] Invalid car id! [ Car ID's range from 400 - 611 ]");
	else 
	{
		if(vCar[playerid] != -1)
		{
		    DestroyVehicle(vCar[playerid]);
		}
		new Float:x, Float:y, Float:z;
		GetPlayerPos(playerid, x, y, z);
		vCar[playerid] = CreateVehicle(vehid, x + 3, y, z, 0, 0,0, -1);
		SendClientMessage(playerid, COLOR_GREEN, "Car spawned at your location!");
	}

	return 1;
}
Also globally define

new vCar[playerid] = -1;

and add vCar[playerid] = -1;
on player disconnect

and COLOR_GREEN/COLOR_GREY can be changed to any color..


Re: I need /v command - mariomako - 01.06.2011

error:

D:\Infinity DM Stunt\gamemodes\infinitygm.pwn(34) : error 017: undefined symbol "playerid"

line 34: new vCar[playerid]=-1;


Re: I need /v command - LiamM - 01.06.2011

Quote:
Originally Posted by mariomako
Посмотреть сообщение
error:

D:\Infinity DM Stunt\gamemodes\infinitygm.pwn(34) : error 017: undefined symbol "playerid"

line 34: new vCar[playerid]=-1;
Funny enough I was looking for the same command so I changed it and I got this error too.. All you have to do to fix it is

new vCar[MAX_PLAYERS] = -1;

Error free

but one problem.. When someone logs out the car doesnt dissapear... Any idea how to fix this?
Apart from that its all good


Re: I need /v command - Seven_of_Nine - 01.06.2011

I would use PVars instead, but... variables take so much space.


Re: I need /v command - LiamM - 01.06.2011

Quote:
Originally Posted by Seven_of_Nine
Посмотреть сообщение
I would use PVars instead, but... variables take so much space.
Can you mind explaining to me what a pVar is? I'm still learning Pawn