adding 1 to variable to stop re-spawn = fail
#1

ok so i create:

PHP код:
new vcarcheck 0
then

PHP код:
 new color1;
 new 
color2;
 new 
car;
 if(
IsPlayerConnected(playerid))
 {
if(
gPlayerData[playerid][VIP] >= || IsPlayerAdmin(playerid))
            {
                if ( 
sscanfparams"iii"carcolor1color2 ) ) return SendClientMessageplayeridCOLOR_RED"USAGE: {FFFF00}/vspawn [carID] [color1] [color2]" );
                if(
car 400 || car 611)
                {
                    
SendClientMessage(playeridCOLOR_RED"   Vehicle Number can't be below 400 or above 611 !"); return 1;
                }
                if(
color1 || color1 160)
                {
                    
SendClientMessage(playeridCOLOR_RED"   Color Number can't be below 0 or above 160 !"); return 1;
                }
                if(
color2 || color2 126)
                {
                    
SendClientMessage(playeridCOLOR_RED"   Color Number can't be below 0 or above 160 !"); return 1;
                }
                if (
vcarcheck >= 1)
                {
                    
SendClientMessage(playeridCOLOR_RED" Only One vspawn Car May Be Spawned At Any One Time "); return 1;
                }
                new 
Float:X,Float:Y,Float:Z;
                
GetPlayerPos(playeridX,Y,Z);
                
CreateVehicle(carX,Y+2,Z0.0color1color260000);
                
SendClientMessage(playeridCOLOR_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 ?
Reply
#2

Try changing (vcarcheck +=1); to vcarcheck = 1;
Reply
#3

Quote:
Originally Posted by Azzeto
Посмотреть сообщение
Try changing (vcarcheck +=1); to vcarcheck = 1;
nope, didnt work =[
Reply
#4

Where do you want the other car to stop spawning?
Reply
#5

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

PHP код:
 new color1;
 new 
color2;
 new 
car;
 if(
IsPlayerConnected(playerid))
 {
 if(
gPlayerData[playerid][VIP] >= || IsPlayerAdmin(playerid))
            {
                if ( 
sscanfparams"iii"carcolor1color2 ) ) return SendClientMessageplayeridCOLOR_RED"USAGE: {FFFF00}/vspawn [carID] [color1] [color2]" );
                if(
car 400 || car 611)
                {
                    
SendClientMessage(playeridCOLOR_RED"   Vehicle Number can't be below 400 or above 611 !"); return 1;
                }
                if(
color1 || color1 160)
                {
                    
SendClientMessage(playeridCOLOR_RED"   Color Number can't be below 0 or above 160 !"); return 1;
                }
                if(
color2 || color2 126)
                {
                    
SendClientMessage(playeridCOLOR_RED"   Color Number can't be below 0 or above 160 !"); return 1;
                }
                if (
vcarcheck == 1)
                {
                    
SendClientMessage(playeridCOLOR_RED" Only One vspawn Car May Be Spawned At Any One Time "); return 1;
                }
                new 
Float:X,Float:Y,Float:Z;
                
GetPlayerPos(playeridX,Y,Z);
                
CreateVehicle(carX,Y+2,Z0.0color1color260000);
                
SendClientMessage(playeridCOLOR_RED" Vehicle created.");
                
vcarcheck 1;
            }
            else if (
vcarcheck == 1)
             {
                  
SendClientMessage(playeridCOLOR_RED" Only One vspawn Car May Be Spawned At Any One Time "); return 1;
             } 
Try that.
Reply
#7

how I understand you:
vcarcheck++
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)