SA-MP Forums Archive
err help location thing - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: err help location thing (/showthread.php?tid=160105)



err help location thing - Kar - 15.07.2010

this is the code when i try to add
pawn Код:
if(!IsPlayerInAnyVehicle(i))
                {
                new LocationZone[MAX_ZONE_NAME],String[128];
                GetPlayer2DZone(i, LocationZone, MAX_ZONE_NAME);
                GetPlayerPos(i, X, Y, Z);
                format(String,sizeof(String),"Gps~g~: ~y~%s", LocationZone);
                }
to
pawn Код:
public CheckStatus()
{
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(IsPlayerInAnyVehicle(i))
            {
                if(Speed_Text_Show_For_CB_Player[i] == false)
                {
                    Speed_Text_Show_For_CB_Player[i] = true;
                }
                new Float:Speed;
                new String[128];
                GetVehicleVelocity(GetPlayerVehicleID(i), X, Y, Z);
                Speed = floatmul(floatsqroot(floatadd(floatadd(floatpower(X, 2), floatpower(Y, 2)),  floatpower(Z, 2))), 200.0); //100.0
                new LocationZone[MAX_ZONE_NAME];
                GetPlayer2DZone(i, LocationZone, MAX_ZONE_NAME);
                GetPlayerPos(i, X, Y, Z);
                new PlayerVehicleModelID = GetVehicleModel(GetPlayerVehicleID(i));
                PlayerVehicleModelID -= 400;
                format(String,sizeof(String),"~n~~R~Vehicle~g~: ~y~%s ~b~- ~r~Gps~g~: ~y~%s ~r~Speed~g~: ~y~%i", PlayerVehicle[PlayerVehicleModelID], LocationZone,floatround(floatdiv(Speed, 1.609344), floatround_floor), floatround(Speed, floatround_floor));
                if(Vehicle_Speed_StringCreated[i] == true)
                {
                    TextDrawDestroy(Vehicle_Speed_String[i]);
                }
                Vehicle_Speed_String[i] = TextDrawCreate(150.000000,420.000000,String);
                TextDrawAlignment(Vehicle_Speed_String[i],0);
                TextDrawTextSize(Vehicle_Speed_String[i],600.000000,0.000000);
                TextDrawBackgroundColor(Vehicle_Speed_String[i],0x000000ff);
                TextDrawFont(Vehicle_Speed_String[i],1);
                TextDrawLetterSize(Vehicle_Speed_String[i],0.299999,1.000000);
                TextDrawColor(Vehicle_Speed_String[i],0xffffffff);
                TextDrawSetOutline(Vehicle_Speed_String[i],1);
                TextDrawSetProportional(Vehicle_Speed_String[i],1);
                TextDrawSetShadow(Vehicle_Speed_String[i],1);
                TextDrawShowForPlayer(i, Vehicle_Speed_String[i]);
                Vehicle_Speed_StringCreated[i] = true;
                }
                else
                {

                if(Speed_Text_Show_For_CB_Player[i] == true)
                {
                Speed_Text_Show_For_CB_Player[i] = false;
                }
                TextDrawHideForPlayer(i, Text:Vehicle_Speed_String[i]);
                if(!IsPlayerInAnyVehicle(i))
                {
                new LocationZone[MAX_ZONE_NAME],String[128];
                GetPlayer2DZone(i, LocationZone, MAX_ZONE_NAME);
                GetPlayerPos(i, X, Y, Z);
                format(String,sizeof(String),"Gps~g~: ~y~%s", LocationZone);
                }
            }
        }
    }
}
it doesnt show onfoot...


Re: err help location thing - [HiC]TheKiller - 15.07.2010

pawn Код:
if(!IsPlayerInAnyVehicle(i))
                {
                new LocationZone[MAX_ZONE_NAME],String[128];
                GetPlayer2DZone(i, LocationZone, MAX_ZONE_NAME);
                GetPlayerPos(i, X, Y, Z);
                format(String,sizeof(String),"Gps~g~: ~y~%s", LocationZone);
                }
to
pawn Код:
public CheckStatus()
{
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(IsPlayerInAnyVehicle(i))
            {
                if(Speed_Text_Show_For_CB_Player[i] == false)
                {
                    Speed_Text_Show_For_CB_Player[i] = true;
                }
                new Float:Speed;
                new String[128];
                GetVehicleVelocity(GetPlayerVehicleID(i), X, Y, Z);
                Speed = floatmul(floatsqroot(floatadd(floatadd(floatpower(X, 2), floatpower(Y, 2)),  floatpower(Z, 2))), 200.0); //100.0
                new LocationZone[MAX_ZONE_NAME];
                GetPlayer2DZone(i, LocationZone, MAX_ZONE_NAME);
                GetPlayerPos(i, X, Y, Z);
                new PlayerVehicleModelID = GetVehicleModel(GetPlayerVehicleID(i));
                PlayerVehicleModelID -= 400;
                format(String,sizeof(String),"~n~~R~Vehicle~g~: ~y~%s ~b~- ~r~Gps~g~: ~y~%s ~r~Speed~g~: ~y~%i", PlayerVehicle[PlayerVehicleModelID], LocationZone,floatround(floatdiv(Speed, 1.609344), floatround_floor), floatround(Speed, floatround_floor));
                if(Vehicle_Speed_StringCreated[i] == true)
                {
                    TextDrawDestroy(Vehicle_Speed_String[i]);
                }
                Vehicle_Speed_String[i] = TextDrawCreate(150.000000,420.000000,String);
                TextDrawAlignment(Vehicle_Speed_String[i],0);
                TextDrawTextSize(Vehicle_Speed_String[i],600.000000,0.000000);
                TextDrawBackgroundColor(Vehicle_Speed_String[i],0x000000ff);
                TextDrawFont(Vehicle_Speed_String[i],1);
                TextDrawLetterSize(Vehicle_Speed_String[i],0.299999,1.000000);
                TextDrawColor(Vehicle_Speed_String[i],0xffffffff);
                TextDrawSetOutline(Vehicle_Speed_String[i],1);
                TextDrawSetProportional(Vehicle_Speed_String[i],1);
                TextDrawSetShadow(Vehicle_Speed_String[i],1);
                TextDrawShowForPlayer(i, Vehicle_Speed_String[i]);
                Vehicle_Speed_StringCreated[i] = true;
                }
                else
                {

                if(Speed_Text_Show_For_CB_Player[i] == true)
                   {
                    Speed_Text_Show_For_CB_Player[i] = false;
                }
                TextDrawHideForPlayer(i, Text:Vehicle_Speed_String[i]);
            }
                        if(!IsPlayerInAnyVehicle(i))
            {
                new LocationZone[MAX_ZONE_NAME],String[128];
                    GetPlayer2DZone(i, LocationZone, MAX_ZONE_NAME);
                GetPlayerPos(i, X, Y, Z);
                format(String,sizeof(String),"Gps~g~: ~y~%s", LocationZone);
            }
        }
    }
}
Before you had it checking if the player was in a vehcile if the player wasn't in a vehicle. Look where the brackets close.


Re: err help location thing - Kar - 15.07.2010

looks same to me

[edit] o i get it