SA-MP Forums Archive
Show VehicleID - 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: Show VehicleID (/showthread.php?tid=452445)



Show VehicleID - Levtu - 21.07.2013

Hello.
How to add VehicleID line there?:


Код:
{

	for(new x=0;x<MAX_GRACZY;x++){
	if(IsPlayerConnected(x) && GetPlayerState(x) == PLAYER_STATE_DRIVER){

		new veh = GetPlayerVehicleID(x);
		CanNitro[x] = false;
		if(HaveNitro[veh]) CanNitro[x] = true;

		if(!CarInfoChce[x]) continue;

		if(RaceMen[x]){

			new bla = RaceCheck[x]-1;
			if(bla < 0) bla = 0;
			new model = GetVehicleModel(veh);

			new Float:fX,Float:fY,Float:fZ,Float:heal;
			GetVehicleVelocity(veh,fX,fY,fZ);
			new speed = floatround(floatmul(floatmul(fX, fX) + floatmul(fY, fY) + floatmul(fZ, fZ), 190));
			GetVehicleHealth(veh,heal);
			heal = ((heal-250)/750)*100;
			new dmg = floatround(heal);
			if(dmg < 0) dmg = 0;
			if(dmg > 100) dmg = 100;

			new str[128];
			format(str,sizeof(str),"%s~n~~w~Szybkosc: ~g~%d km/h~n~~w~Stan HP: ~g~%d/100~n~~w~Checkpoint: ~y~%d/%d~n~~w~Miejsce: ~r~%d/%d",CarList[model-400],speed,dmg,RaceCheck[x],CPliczba,ActualPos[x],RaceMenLiczba);
			TextDrawSetString(CarInfo[x],str);

		}else{

			new model = GetVehicleModel(veh);

			new Float:fX,Float:fY,Float:fZ,Float:heal;
			GetVehicleVelocity(veh,fX,fY,fZ);
			new speed = floatround(floatmul(floatmul(fX, fX) + floatmul(fY, fY) + floatmul(fZ, fZ), 190));
			GetVehicleHealth(veh,heal);
			heal = ((heal-250)/750)*100;
			new dmg = floatround(heal);
			if(dmg < 0) dmg = 0;
			if(dmg > 100) dmg = 100;

			new str[128];

			if(VehicleLocked[veh] >= 0 && HaveNitro[veh]){
				format(str,sizeof(str),"%s~n~~w~Szybkosc: ~g~%d km/h~n~~w~Stan HP: ~g~%d/100~n~~w~Zamkniety: ~r~tak~n~~w~Nitro: ~r~tak",CarList[model-400],speed,dmg);
			}else if(VehicleLocked[veh] >= 0 && !HaveNitro[veh]){
				format(str,sizeof(str),"%s~n~~w~Szybkosc: ~g~%d km/h~n~~w~Stan HP: ~g~%d/100~n~~w~Zamkniety: ~r~tak~n~~w~Nitro: ~g~nie",CarList[model-400],speed,dmg);
			}else if(VehicleLocked[veh] < 0 && HaveNitro[veh]){
       	 		format(str,sizeof(str),"%s~n~~w~Szybkosc: ~g~%d km/h~n~~w~Stan HP: ~g~%d/100~n~~w~Zamkniety: ~g~nie~n~~w~Nitro: ~r~tak",CarList[model-400],speed,dmg);
			}else if(VehicleLocked[veh] < 0 && !HaveNitro[veh]){
      		  format(str,sizeof(str),"%s~n~~w~Szybkosc: ~g~%d km/h~n~~w~Stan HP: ~g~%d/100~n~~w~Zamkniety: ~g~nie~n~~w~Nitro: ~g~nie",CarList[model-400],speed,dmg);
			}
			TextDrawSetString(CarInfo[x],str);

		}

	}else{
	   	CanNitro[x] = false;
	}
	}

	return 1;
}



Re: Show VehicleID - DobbysGamertag - 21.07.2013

pawn Код:
format(str,sizeof(str),"%d",GetPlayerVehicleID(playerid);
Stick that where you need it. I'd love to do it, but that looks messy to me, and i'm too tired to route through the code to add placements and stuff. Add it after the nitro part, see what happens.


Re: Show VehicleID - Levtu - 21.07.2013

I tried that:
pawn Код:
new str[128];

            if(VehicleLocked[veh] >= 0 && HaveNitro[veh]){
                format(str,sizeof(str),"%s~n~~w~ID: %d~n~~w~Szybkosc: ~g~%d km/h~n~~w~Stan HP: ~g~%d/100~n~~w~Zamkniety: ~r~tak~n~~w~Nitro: ~r~tak",CarList[model-400],GetPlayerVehicleID(playerid),speed,dmg);
            }else if(VehicleLocked[veh] >= 0 && !HaveNitro[veh]){
                format(str,sizeof(str),"%s~n~~w~ID: %d~n~~w~Szybkosc: ~g~%d km/h~n~~w~Stan HP: ~g~%d/100~n~~w~Zamkniety: ~r~tak~n~~w~Nitro: ~g~nie",CarList[model-400],GetPlayerVehicleID(playerid),speed,dmg);
            }else if(VehicleLocked[veh] < 0 && HaveNitro[veh]){
                format(str,sizeof(str),"%s~n~~w~ID: %d~n~~w~Szybkosc: ~g~%d km/h~n~~w~Stan HP: ~g~%d/100~n~~w~Zamkniety: ~g~nie~n~~w~Nitro: ~r~tak",CarList[model-400],GetPlayerVehicleID(playerid),speed,dmg);
            }else if(VehicleLocked[veh] < 0 && !HaveNitro[veh]){
                format(str,sizeof(str),"%s~n~~w~ID: %d~n~~w~Szybkosc: ~g~%d km/h~n~~w~Stan HP: ~g~%d/100~n~~w~Zamkniety: ~g~nie~n~~w~Nitro: ~g~nie",CarList[model-400],GetPlayerVehicleID(playerid),speed,dmg);
   }
            TextDrawSetString(CarInfo[x],str);

        }
compile error: error 017: undefined symbol "playerid".

Any suggestions?


Re: Show VehicleID - Twizted - 21.07.2013

Which callback is that code under?


Re: Show VehicleID - Levtu - 21.07.2013

pawn Код:
format(str,sizeof(str),"%s~n~~w~Szybkosc: ~g~%d km/h~n~~w~ID: %d~n~~w~Stan HP: ~g~%d/100~n~~w~Zamkniety: ~g~nie~n~~w~Nitro: ~g~nie",CarList[model-400],speed,dmg,id);
Last word (id) corresponds to this:
pawn Код:
new id;
            id = GetPlayerVehicleID(playerid);
also i tried this:
pawn Код:
new model = GetVehicleModel(veh);

            new Float:fX,Float:fY,Float:fZ,Float:heal;
            GetVehicleVelocity(veh,fX,fY,fZ);
            new speed = floatround(floatmul(floatmul(fX, fX) + floatmul(fY, fY) + floatmul(fZ, fZ), 190));
            GetVehicleHealth(veh,heal);
            heal = ((heal-250)/750)*100;
            new dmg = floatround(heal);
            if(dmg < 0) dmg = 0;
            if(dmg > 100) dmg = 100;
new id;
            id = GetPlayerVehicleID(veh);

            new str[128];

            if(VehicleLocked[veh] >= 0 && HaveNitro[veh]){
                format(str,sizeof(str),"%s~n~~w~Szybkosc: ~g~%d km/h~n~~w~Stan HP: ~g~%d/100~n~~w~Zamkniety: ~r~tak~n~~w~Nitro: ~r~tak~n~~w~ID: %d",CarList[model-400],speed,dmg,id);
            }else if(VehicleLocked[veh] >= 0 && !HaveNitro[veh]){
                format(str,sizeof(str),"%s~n~~w~Szybkosc: ~g~%d km/h~n~~w~Stan HP: ~g~%d/100~n~~w~Zamkniety: ~r~tak~n~~w~Nitro: ~g~nie~n~~w~ID: %d",CarList[model-400],speed,dmg,id);
            }else if(VehicleLocked[veh] < 0 && HaveNitro[veh]){
                format(str,sizeof(str),"%s~n~~w~Szybkosc: ~g~%d km/h~n~~w~Stan HP: ~g~%d/100~n~~w~Zamkniety: ~g~nie~n~~w~Nitro: ~r~tak~n~~w~ID: %d",CarList[model-400],speed,dmg,id);
            }else if(VehicleLocked[veh] < 0 && !HaveNitro[veh]){
              format(str,sizeof(str),"%s~n~~w~Szybkosc: ~g~%d km/h~n~~w~Stan HP: ~g~%d/100~n~~w~Zamkniety: ~g~nie~n~~w~Nitro: ~g~nie~n~~w~ID: %d",CarList[model-400],speed,dmg,id);
   }
            TextDrawSetString(CarInfo[x],str);

        }
then works, but always shows ID: 0.

Please, help ;(


Re: Show VehicleID - Levtu - 23.07.2013

Refresh


AW: Show VehicleID - Macronix - 23.07.2013

Is "CarInfo[x]" a player textdraw? If so, use:
pawn Код:
id = GetPlayerVehicleID(x);



Re: Show VehicleID - Levtu - 23.07.2013

Yay, works! Thank you.
One more question: how to enlarge upright these black transparent "window"?

There is it, i think:
pawn Код:
posX = 320.0,posY = 350.0;
    for(new x=0;x<10;x++){
        CarBack[x] = Text:TextDrawCreate(posX,posY, "~n~~n~~n~~n~~n~");
        TextDrawUseBox(CarBack[x],1);
        TextDrawBoxColor(CarBack[x],0x00000010);
        TextDrawTextSize(CarBack[x],160.000000,140.000000);
        TextDrawAlignment(CarBack[x],2);
        posX += 1.5;
        posY += 1.5;
    }

    for(new x=0;x<MAX_GRACZY;x++){
        CarInfo[x] = Text:TextDrawCreate(275.000000,347.000000, "_");
        TextDrawTextSize(CarInfo[x],800.0,600.0);
        TextDrawAlignment(CarInfo[x],1);
        TextDrawBackgroundColor(CarInfo[x],0x000000ff);
        TextDrawFont(CarInfo[x],1);
        TextDrawLetterSize(CarInfo[x],0.30000,1.2000);
        TextDrawSetProportional(CarInfo[x],1);
        TextDrawSetOutline(CarInfo[x],1);
        TextDrawColor(CarInfo[x],0x0080FFFF);
    }
   
    }