command /towcar - wrong scripted
#1

I have this command on my GM

if i am in the middle of nowhere and no car is near me it says that i have attached the vehicle and i need to go to the checkpoint ...





PHP код:
if(strcmp(cmd,"/towcar",true)==0)
    {
        if(
IsPlayerConnected(playerid))
        {
            if(
PlayerInfo[playerid][pJob] == 7)
            {
                if(
IsPlayerInAnyVehicle(playerid))
                {
                    new 
car GetVehicleModel(GetPlayerVehicleID(playerid));
                    if (
car >= towcar1 || car <= towcar8)
                        {
                            if(
GetPlayerState(playerid)==2)
                            {
                            new 
Float:pX,Float:pY,Float:pZ;
                            
GetPlayerPos(playerid,pX,pY,pZ);
                            new 
Float:vX,Float:vY,Float:vZ;
                            new 
Found=0;
                            new 
vid=0;
                            while((
vid<MAX_VEHICLES)&&(!Found))
                            {
                                   
vid++;
                                   
GetVehiclePos(vid,vX,vY,vZ);
                                   if ((
floatabs(pX-vX)<7.0)&&(floatabs(pY-vY)<7.0)&&(floatabs(pZ-vZ)<7.0)&&(vid!=GetPlayerVehicleID(playerid)))
                                {
                                       
Found=1;
                                    if(
IsTrailerAttachedToVehicle(GetPlayerVehicleID(playerid))) { }
                                       else
                                       {
                                    
                                            if(
PlayerInfo[playerid][pTowedCars] <= 10)
                                            {
                                                
                                                
VSegundosA[playerid] = 0;
                                                
VMinutosA[playerid] = 0;
                                                
GameTextForPlayer(playerid"~y~00~w~:~b~00"15006);
                                                
TContraAutoCarTow[playerid] = SetTimerEx("ContadoAutoCarTow",1000,1,"d",playerid);
                                                
PlayerInfo[playerid][pTowc] = 1;
                                                
AttachTrailerToVehicle(vid,GetPlayerVehicleID(playerid));
                                                
SCM(playeridCOLOR_YELLOW"{00ccff}[CS16]: {ffffff}You have 5 mi to go to the checkpoint!");
                                                
CP[playerid] = 96;
                                                
SetPlayerCheckpoint(playerid1259.7102,-1803.7456,13.29306.5);
                                                
SetTimerEx("towtime"3000000"%d"playerid);
                                            }
                                            else if(
PlayerInfo[playerid][pTowedCars] >= 11)
                                            {
                                                
SCM(playeridCOLOR_LIGHTBLUE"You have towed already 10 cars, wait till next payday!");
                                                
GameTextForPlayer(playerid"~r~Wait the PayDay !"25001);
                                                
DisablePlayerCheckpoint(playerid);
                                            }
                                    
        
                                    }
                                 }
                             }
                            if(!
Found)
                             {
                                   
SCM(playerid,0xFFFF00AA,"No car near you.");
                               }
                        }
                    }
                    else
                    {
                        
SCM(playeridCOLOR_GRAD2"You must be in a tow truck !");
                        return 
1;
                    }
                }
            }
        }
        return 
1;
    } 
Reply
#2

I have repaired this command alone

thx anyway...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)