SA-MP Forums Archive
Empty Staement??? - 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)
+--- Thread: Empty Staement??? (/showthread.php?tid=315711)



Empty Staement??? - Shabi RoxX - 04.02.2012

Hy guys.... What's the function to check empty statement ?

Like:
I have a var CreatedVehicles[10];

wanna check if CreatedVehicles[9] is empty

PHP код:
CMD:getcveh(playerid,params[])
{
    if(
P_Var[playerid][p_Adminlevel] > 0)
    {
    new 
id,FloatPos[3];
    if(
sscanf(params,"u",id))
    return 
SendClientMessage(playeridC_GREY"Format: /Getveh [vehicle id]");
    else
    
GetPlayerPos(playerid,Pos[0],Pos[1],Pos[2]);
    
SetVehiclePos(CreatedVehicles[id],Pos[0],Pos[1],Pos[2]);
    }
    else {
    
SendClientMessage(playerid,C_GRAD,"You are not authorized to use this command!");
    }
    return 
1;

Now in above cmd...I wanna CreatedVehicles[id], as its empty I tped to 0,0,0 coords.


Re: Empty Staement??? - BlackSA - 04.02.2012

PHP код:
CMD:getcveh(playerid,params[])
{
    if(
P_Var[playerid][p_Adminlevel] == 0) return SendClientMessage(playerid,C_GRAD,"You are not authorized to use this command!");
    new 
id,FloatPos[3];
    if(
sscanf(params,"u",id)) return SendClientMessage(playeridC_GREY"Format: /Getveh [vehicle id]");
    
GetPlayerPos(playerid,Pos[0],Pos[1],Pos[2]);
    
SetVehiclePos(CreatedVehicles[id],Pos[0],Pos[1],Pos[2]);
    return 
1;

Try this.


Re: Empty Staement??? - Shabi RoxX - 04.02.2012

Oh no.... I wanna check if CreatedVehicles[id] is assigned to a veh or not ?


Re: Empty Staement??? - BlackSA - 04.02.2012

Oh I got you:

PHP код:
CMD:getcveh(playerid,params[])
{
    if(
P_Var[playerid][p_Adminlevel] == 0) return SendClientMessage(playerid,C_GRAD,"You are not authorized to use this command!");
    new 
id,FloatPos[3];
    if(
sscanf(params,"u",id)) return SendClientMessage(playeridC_GREY"Format: /Getveh [vehicle id]");
    if(
GetVehicleModel(CreatedVehicles[id]) < 400 || GetVehicleModel(CreatedVehicles[id]) > 600) return SendClientMEssage(playeridC_GREY"Non exisitig vehicle.");
    
GetPlayerPos(playerid,Pos[0],Pos[1],Pos[2]);
    
SetVehiclePos(CreatedVehicles[id],Pos[0],Pos[1],Pos[2]);
    return 
1;




Re: Empty Staement??? - =WoR=Varth - 04.02.2012

pawn Код:
stock IsVehicleConnected(vehicleid)
{
    new Float:x,Float:y,Float:z;
    GetVehiclePos(vehicleid,x,y,z);
    if(x==0.0 && y==0.0 && z==0.0) return 0;
    return 1;
}
No need to use "CreatedVehicles" variable.