SA-MP Forums Archive
ifs doesnt work - 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: ifs doesnt work (/showthread.php?tid=529238)



ifs doesnt work - ShinichiKudou - 01.08.2014

I integrated LuX's Speedometer on my gamemode to use its Locked Unlocked and GPS Inventory System

it checks if the variable is 0 then shows the textdraws i putted a print in the if to check if its called or not and its not printing

it just prints the debug message to check if the timer is running

pawn Код:
Timer:LuX_SMUp[500]()
{
    new Float:LPosX;
    new Float:LPosY;
    new Float:LPosZ;
    new Float:PlayerSpeedDistance;
    new value;
    new Float:L_VehHealth;
    new LVehicleStatus[15];
    foreach(Player, i)
    {
        if(!IsPlayerConnected(i)) continue;
        if(IsPlayerInAnyVehicle(i))
        {
            printf("[DEBUG]Player %s (%d) Entered a car (Speedo Debug)(status %d)", GetPlayerNameEx(i), i, LuX_SpeedoMeter[i]);
            new ownerid = PlayerInfo[i][pVehicleKeysFrom];
            new d = PlayerInfo[i][pVehicleKeys];
            if(PlayerVehicleInfo[ownerid][d][pvLock] > 0)
            {
                if(PlayerVehicleInfo[ownerid][d][pvLocked] == 0)
                {
                    LVehicleStatus = "~g~Unlocked";
                }
                else
                {
                    LVehicleStatus = "~r~Locked";
                }
            }
            else
            {
                LVehicleStatus = "~r~No Lock";
            }
            GetPlayerPos(i, LPosX, LPosY, LPosZ);
            GetPlayerVehicleID(i);
            GetVehicleHealth(GetPlayerVehicleID(i), L_VehHealth);
            PlayerSpeedDistance = floatsqroot(floatpower(floatabs(floatsub(LPosX,LuX_ReadPlayerPosition[i][ReadX])),2)+floatpower(floatabs(floatsub(LPosY,LuX_ReadPlayerPosition[i][ReadY])),2)+floatpower(floatabs(floatsub(LPosZ,LuX_ReadPlayerPosition[i][ReadZ])),2));
            value = floatround(PlayerSpeedDistance * 5000);
            new LuxZone[MAX_ZONE_NAME];
            GetPlayer2DZone1(i, LuxZone, MAX_ZONE_NAME);
            if(LuX_SpeedoMeter[i] == 0)
            {
                printf("[DEBUG]Checks if TextDrawShowForPlayer is called");
                TextDrawShowForPlayer(i, LBox[i]);
                TextDrawShowForPlayer(i, LLine1[i]);
                TextDrawShowForPlayer(i, LLine2[i]);
                TextDrawShowForPlayer(i, LLine3[i]);
                TextDrawShowForPlayer(i, LLine4[i]);
                TextDrawShowForPlayer(i, LCredits[i]);
                TextDrawShowForPlayer(i, Lmph[i]);
                TextDrawShowForPlayer(i, LFunc[i]);
                LuX_SpeedoMeter[i] = 1;
            }
            new LMPH = floatround(value/1600);
            new LKPH = floatround(value/1000);
           
           
           
            format(lstr,sizeof(lstr),"%sMPH: ~w~%d  %sKM/H: ~w~%d",MPH_KPH_Color,LMPH,MPH_KPH_Color,LKPH);
            TextDrawSetString(Lmph[i], lstr);
           
            if(L_VehHealth <= 500){
                if(PlayerInfo[i][pGPS] == 1) { format(lstring,sizeof(lstring),"~b~Vehicle: ~w~%s~n~~b~Health: ~w~%.2f~n~~b~Altitude: ~w~%.1f~n~~b~Gps: ~w~%s~n~~b~Status: %s",LVehiclesName[GetVehicleModel(GetPlayerVehicleID(i))-400],L_VehHealth,LPosZ,LuxZone,LVehicleStatus); }
                else { format(lstring,sizeof(lstring),"~b~Vehicle: ~w~%s~n~~b~Health: ~w~%.2f~n~~b~Altitude: ~r~No GPS!~n~~b~Gps: ~r~No GPS!~n~~b~Status: %s",LVehiclesName[GetVehicleModel(GetPlayerVehicleID(i))-400],L_VehHealth,LVehicleStatus); }
                TextDrawSetString(LFunc[i], lstring);
            }
           
            if(LKPH >= VehicleMaxSpeed)
            {
                TogglePlayerControllable(i,0);
                LUnFreeze = SetTimer("LuX_UnFreezeCar", 250, 1);
                format(lstr,sizeof(lstr),"~g~MPH: ~w~%d  ~g~KM/H: ~r~%d",LMPH,LKPH);
                TextDrawSetString(Lmph[i], lstr);
            }
        }
        LuX_ReadPlayerPosition[i][ReadX] = LPosX, LuX_ReadPlayerPosition[i][ReadY] = LPosY, LuX_ReadPlayerPosition[i][ReadZ] = LPosZ;
    }
    foreach(Player, i) {
        if(!IsPlayerInAnyVehicle(i)){
            TextDrawHideForPlayer(i, LBox[i]);
            TextDrawHideForPlayer(i, LLine1[i]);
            TextDrawHideForPlayer(i, LLine2[i]);
            TextDrawHideForPlayer(i, LLine3[i]);
            TextDrawHideForPlayer(i, LLine4[i]);
            TextDrawHideForPlayer(i, LCredits[i]);
            TextDrawHideForPlayer(i, Lmph[i]);
            TextDrawHideForPlayer(i, LFunc[i]);
            LuX_SpeedoMeter[i] = 0;
            //printf("[DEBUG]Checks is TextDrawHideForPllayer is called");
        }
    }
    return 1;
}



Re: ifs doesnt work - ShinichiKudou - 01.08.2014

BUMP


Re: ifs doesnt work - ShinichiKudou - 01.08.2014

bump


Re: ifs doesnt work - SlimDkhili - 01.08.2014

Quote:
Originally Posted by ShinichiKudou
Посмотреть сообщение
bump
Don't "BUMB" You need at least 24hours to do that "BUMB" again