I need /v command
#1

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
Reply
#2

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

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

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

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
Reply
#6

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..
Reply
#7

error:

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

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

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
Reply
#9

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

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)