adding 1 to variable to stop re-spawn = fail -
English-Conceptz - 02.12.2011
ok so i create:
PHP код:
new vcarcheck = 0;
then
PHP код:
new color1;
new color2;
new car;
if(IsPlayerConnected(playerid))
{
if(gPlayerData[playerid][VIP] >= 1 || IsPlayerAdmin(playerid))
{
if ( sscanf( params, "iii", car, color1, color2 ) ) return SendClientMessage( playerid, COLOR_RED, "USAGE: {FFFF00}/vspawn [carID] [color1] [color2]" );
if(car < 400 || car > 611)
{
SendClientMessage(playerid, COLOR_RED, " Vehicle Number can't be below 400 or above 611 !"); return 1;
}
if(color1 < 0 || color1 > 160)
{
SendClientMessage(playerid, COLOR_RED, " Color Number can't be below 0 or above 160 !"); return 1;
}
if(color2 < 0 || color2 > 126)
{
SendClientMessage(playerid, COLOR_RED, " Color Number can't be below 0 or above 160 !"); return 1;
}
if (vcarcheck >= 1)
{
SendClientMessage(playerid, COLOR_RED, " Only One vspawn Car May Be Spawned At Any One Time "); return 1;
}
new Float:X,Float:Y,Float:Z;
GetPlayerPos(playerid, X,Y,Z);
CreateVehicle(car, X,Y+2,Z, 0.0, color1, color2, 60000);
SendClientMessage(playerid, COLOR_RED, " Vehicle created.");
(vcarcheck += 1);
}
in theory in my head

when a new car is created, 1 is added to the variable 'vcarcheck'
so then if another one is created the variable will be already 1 and it wont be created.
doesnt work though -.-
and im going to make another command to destroy the car, and to destroy it on log out, time out etc.
help ?
Re: adding 1 to variable to stop re-spawn = fail -
Azzeto - 02.12.2011
Try changing (vcarcheck +=1); to vcarcheck = 1;
Re: adding 1 to variable to stop re-spawn = fail -
English-Conceptz - 02.12.2011
Quote:
Originally Posted by Azzeto
Try changing (vcarcheck +=1); to vcarcheck = 1;
|
nope, didnt work =[
Re: adding 1 to variable to stop re-spawn = fail -
Azzeto - 02.12.2011
Where do you want the other car to stop spawning?
Re: adding 1 to variable to stop re-spawn = fail -
English-Conceptz - 02.12.2011
Quote:
Originally Posted by Azzeto
Where do you want the other car to stop spawning?
|
that doesnt really matter but seens you asked, it stops spawning at the players position when the command is called more than once before the first car has been removed or destroyed:
new Float:X,Float:Y,Float:Z;
GetPlayerPos(playerid, X,Y,Z);
CreateVehicle(car, X,Y+2,Z, 0.0, color1, color2, 60000);
Re: adding 1 to variable to stop re-spawn = fail -
Azzeto - 02.12.2011
PHP код:
new color1;
new color2;
new car;
if(IsPlayerConnected(playerid))
{
if(gPlayerData[playerid][VIP] >= 1 || IsPlayerAdmin(playerid))
{
if ( sscanf( params, "iii", car, color1, color2 ) ) return SendClientMessage( playerid, COLOR_RED, "USAGE: {FFFF00}/vspawn [carID] [color1] [color2]" );
if(car < 400 || car > 611)
{
SendClientMessage(playerid, COLOR_RED, " Vehicle Number can't be below 400 or above 611 !"); return 1;
}
if(color1 < 0 || color1 > 160)
{
SendClientMessage(playerid, COLOR_RED, " Color Number can't be below 0 or above 160 !"); return 1;
}
if(color2 < 0 || color2 > 126)
{
SendClientMessage(playerid, COLOR_RED, " Color Number can't be below 0 or above 160 !"); return 1;
}
if (vcarcheck == 1)
{
SendClientMessage(playerid, COLOR_RED, " Only One vspawn Car May Be Spawned At Any One Time "); return 1;
}
new Float:X,Float:Y,Float:Z;
GetPlayerPos(playerid, X,Y,Z);
CreateVehicle(car, X,Y+2,Z, 0.0, color1, color2, 60000);
SendClientMessage(playerid, COLOR_RED, " Vehicle created.");
vcarcheck = 1;
}
else if (vcarcheck == 1)
{
SendClientMessage(playerid, COLOR_RED, " Only One vspawn Car May Be Spawned At Any One Time "); return 1;
}
Try that.
Re: adding 1 to variable to stop re-spawn = fail -
System64 - 02.12.2011
how I understand you:
vcarcheck++