SA-MP Forums Archive
Loose indentation HELP - 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: Loose indentation HELP (/showthread.php?tid=550424)



Loose indentation HELP - robibacsii - 12.12.2014

It Says Loose Indentation
Where is the problem?

Code:
PHP код:
CMD:v(playerid,params[])
{
new 
car;
new 
string[128];
new 
Float:XFloat:YFloat:Z;
GetPlayerPos(playeridFloat:XFloat:YFloat:Z);
if(
sscanf(params,"i"car)) return SendClientMessage(playerid,0xff0000ff,"USAGE: /Veh <Vehicle ID 400 - 611>");
else if(
car 400 || car >611) return SendClientMessage(playerid0xff0000ff"ERROR: Cannot go under 400 or above 611.");
{
if(
Vehicle[playerid] != 0)
    {
        
DestroyVehicle(Vehicle[playerid]);
    }
    
Vehicle[playerid] = CreateVehicle(carXY2.00, -1, -11);
    
format(string,sizeof(string),"You Have Spawned Vehicle ID %i",car);
    
SendClientMessage(playerid0xffffffffstring);
    
PutPlayerInVehicle(playeridVehicle[playerid], 0);
}
return 
1;




Re: Loose indentation HELP - bogushas - 12.12.2014

PHP код:
CMD:v(playerid,params[]) 

    new 
car
    new 
string[128]; 
    new 
Float:XFloat:YFloat:Z
    
GetPlayerPos(playeridFloat:XFloat:YFloat:Z); 
    if(
sscanf(params,"i"car)) return SendClientMessage(playerid,0xff0000ff,"USAGE: /Veh <Vehicle ID 400 - 611>"); 
    else if(
car 400 || car >611) return SendClientMessage(playerid0xff0000ff"ERROR: Cannot go under 400 or above 611."); 
    { 
        if(
Vehicle[playerid] != 0
        { 
            
DestroyVehicle(Vehicle[playerid]); 
        } 
        
        
Vehicle[playerid] = CreateVehicle(carXY2.00, -1, -11); 
        
format(string,sizeof(string),"You Have Spawned Vehicle ID %i",car); 
        
SendClientMessage(playerid0xffffffffstring); 
        
PutPlayerInVehicle(playeridVehicle[playerid], 0); 
    } 
    return 
1




Re: Loose indentation HELP - robibacsii - 12.12.2014

Thanks Reped+


Re: Loose indentation HELP - ilepopivanov - 12.12.2014

#pragma tabsize 0
at the top of script


Re: Loose indentation HELP - Dizzle - 12.12.2014

Better add:

#pragma tabsize 0

on top of your script under the includes x)

EDIT: Sorry, ilepopivanov, didnt saw your post, we did it almost in the same time lol xd


Re: Loose indentation HELP - Pottus - 12.12.2014

#pragma tabsize 0
Worst advice possible fix your scripts properly.


Re: Loose indentation HELP - JuanStone - 12.12.2014

I think that this is not good.(↓)..
pawn Код:
#pragma tabsize 0
This better.. I recommend you use the sscanf slots in your commands, create variables that are not necessary in your script.

pawn Код:
CMD:v(playerid, params[])
{
    new Float:pos[3];         //x     //y   // z
    GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
    if(sscanf(params, "d", params[0])) return SendClientMessage(playerid,0xff0000ff,"USAGE: /Veh <Vehicle ID 400 - 611>");
    if(params[0] < 400 || params[0] > 611) return SendClientMessage(playerid, 0xff0000ff, "ERROR: Cannot go under 400 or above 611.");
   
    if(Vehicle[playerid] != 0)
    {
        DestroyVehicle(Vehicle[playerid]);
    }
    Vehicle[playerid] = CreateVehicle(params[0], pos[0], pos[1], pos[2]+ 2.0, 0, -1, -1, 1);
    format(string,sizeof(string),"You Have Spawned Vehicle ID %i", params[0]);
    SendClientMessage(playerid, 0xffffffff, string);
    PutPlayerInVehicle(playerid, Vehicle[playerid], 0);
    return true;
}