Wysłany: 2012-06-15, 19:04
niree
Wiek: 28 Na forum: 5312 dni Posty: 22
Nick w MP: nireee_niree
Witam mam taki sobie kod na licznik pojazdu itp, mo?na ?atwo go zobaczy? na tej stronie.
O to kod :
Pawn #include <a_samp>
#include <colors>
#if defined FILTERSCRIPT
#endif
new Text : pojazd [ 200 ];
new BrakPaliwa [ MAX_PLAYERS ];
forward Stacjepaliw ( playerid );
#define auta 1000
#define benzine 150
#define MinusGas 15000
#define FUELCOST 3
#define COLOR_RED 0xFF0000FF
#define COLOR_GREY 0xAFAFAFAA
#define kolorek 0xFFFF00AA
new Gas [ auta ];
new string [ 256 ];
enum SavePlayerPosEnum {
Float : LastX ,
Float : LastY ,
Float : LastZ }
new Float : Przebieg [ MAX_VEHICLES ];
new SavePlayerPos [ MAX_PLAYERS ][ SavePlayerPosEnum ];
new carname [ 212 ][ 32 ] =
{
"Landstalker" ,
"Bravura" ,
"Buffalo" ,
"Linerunner" ,
"Perennial" ,
"Sentinel" ,
"Dumper" ,
"Firetruck" ,
"Trashmaster" ,
"Stretch" ,
"Manana" ,
"Infernus" ,
"Voodoo" ,
"Pony" ,
"Mule" ,
"Cheetah" ,
"Ambulance" ,
"Leviathan" ,
"Moonbeam" ,
"Esperanto" ,
"Taxi" ,
"Washington" ,
"Bobcat" ,
"Mr Whoopee" ,
"BF Injection" ,
"Hunter" ,
"Premier" ,
"Enforcer" ,
"Securicar" ,
"Banshee" ,
"Predator" ,
"Bus" ,
"Rhino" ,
"Barracks" ,
"Hotknife" ,
"Trailer" ,
"Previon" ,
"Coach" ,
"Cabbie" ,
"Stallion" ,
"Rumpo" ,
"RC Bandit" ,
"Romero" ,
"Packer" ,
"Monster Truck" ,
"Admiral" ,
"Squalo" ,
"Seasparrow" ,
"Pizzaboy" ,
"Tram" ,
"Trailer" ,
"Turismo" ,
"Speeder" ,
"Reefer" ,
"Tropic" ,
"Flatbed" ,
"Yankee" ,
"Caddy" ,
"Solair" ,
"Berkley's RC Van" ,
"Skimmer" ,
"PCJ-600" ,
"Faggio" ,
"Freeway" ,
"RC Baron" ,
"RC Raider" ,
"Glendale" ,
"Oceanic" ,
"Sanchez" ,
"Sparrow" ,
"Patriot" ,
"Quad" ,
"Coastguard" ,
"Dinghy" ,
"Hermes" ,
"Sabre" ,
"Rustler" ,
"ZR-350" ,
"Walton" ,
"Regina" ,
"Comet" ,
"BMX" ,
"Burrito" ,
"Camper" ,
"Marquis" ,
"Baggage" ,
"Dozer" ,
"Maverick" ,
"News Chopper" ,
"Rancher" ,
"FBI Rancher" ,
"Virgo" ,
"Greenwood" ,
"Jetmax" ,
"Hotring" ,
"Sandking" ,
"Blista Compact" ,
"Police Maverick" ,
"Boxville" ,
"Benson" ,
"Mesa" ,
"RC Goblin" ,
"Hotring Racer" ,
"Hotring Racer" ,
"Bloodring Banger" ,
"Rancher" ,
"Super GT" ,
"Elegant" ,
"Journey" ,
"Bike" ,
"Mountain Bike" ,
"Beagle" ,
"Cropdust" ,
"Stunt" ,
"Tanker" ,
"RoadTrain" ,
"Nebula" ,
"Majestic" ,
"Buccaneer" ,
"Shamal" ,
"Hydra" ,
"FCR-900" ,
"NRG-500" ,
"HPV1000" ,
"Cement Truck" ,
"Tow Truck" ,
"Fortune" ,
"Cadrona" ,
"FBI Truck" ,
"Willard" ,
"Forklift" ,
"Tractor" ,
"Combine" ,
"Feltzer" ,
"Remington" ,
"Slamvan" ,
"Blade" ,
"Freight" ,
"Streak" ,
"Vortex" ,
"Vincent" ,
"Bullet" ,
"Clover" ,
"Sadler" ,
"Firetruck" ,
"Hustler" ,
"Intruder" ,
"Primo" ,
"Cargobob" ,
"Tampa" ,
"Sunrise" ,
"Merit" ,
"Utility" ,
"Nevada" ,
"Yosemite" ,
"Windsor" ,
"Monster Truck" ,
"Monster Truck" ,
"Uranus" ,
"Jester" ,
"Sultan" ,
"Stratum" ,
"Elegy" ,
"Raindance" ,
"RC Tiger" ,
"Flash" ,
"Tahoma" ,
"Savanna" ,
"Bandito" ,
"Freight" ,
"Trailer" ,
"Kart" ,
"Mower" ,
"Duneride" ,
"Sweeper" ,
"Broadway" ,
"Tornado" ,
"AT-400" ,
"DFT-30" ,
"Huntley" ,
"Stafford" ,
"BF-400" ,
"Newsvan" ,
"Tug" ,
"Trailer" ,
"Emperor" ,
"Wayfarer" ,
"Euros" ,
"Hotdog" ,
"Club" ,
"Trailer" ,
"Trailer" ,
"Andromada" ,
"Dodo" ,
"RC Cam" ,
"Launch" ,
"Police Car (LSPD)" ,
"Police Car (SFPD)" ,
"Police Car (LVPD)" ,
"Police Ranger" ,
"Picador" ,
"S.W.A.T. Van" ,
"Alpha" ,
"Phoenix" ,
"Glendale" ,
"Sadler" ,
"Luggage Trailer" ,
"Luggage Trailer" ,
"Stair Trailer" ,
"Boxville" ,
"Farm Plow" ,
"Utility Trailer"
};
public OnFilterScriptInit ()
{
print( "##########################################" );
print( "Licznik by lukasz_lol.LBLv1.2Za?adowany poprawnie" );
print( "##########################################" );
SetTimer ( "odpojazdu" , 450 , true );
SetTimer ( "OdejmnijPaliwo" , MinusGas , 1 );
for(new g = 0 ; g < 200 ; g ++)
{
pojazd [ g ] = TextDrawCreate ( 455.000000 , 355.000000 , " " );
TextDrawUseBox ( pojazd [ g ], 1 );
TextDrawLetterSize ( pojazd [ g ], 0.399999 , 1.000000 );
TextDrawBoxColor ( pojazd [ g ], 0x00000066 );
TextDrawTextSize ( pojazd [ g ], 659.000000 , 7.000000 );
TextDrawSetOutline ( pojazd [ g ], 0 );
TextDrawSetShadow ( pojazd [ g ], 1 );
TextDrawColor ( pojazd [ g ], 0xffffffff );
TextDrawFont ( pojazd [ g ], 1 );
TextDrawAlignment ( pojazd [ g ], 0 );
TextDrawBackgroundColor ( pojazd [ g ], 0x000000ff );
TextDrawSetProportional ( pojazd [ g ], 1 );
}
for(new c = 0 ; c < auta ; c ++){
Gas [ c ] = benzine ;
}
return 1 ;
}
public OnPlayerEnterVehicle ( playerid , vehicleid , ispassenger )
{
TextDrawShowForPlayer ( playerid , pojazd [ playerid ]);
return 1 ;
}
public OnPlayerExitVehicle ( playerid , vehicleid ){
TextDrawHideForPlayer ( playerid , pojazd [ playerid ]);
return 1 ;
}
forward OdejmnijPaliwo ();
public OdejmnijPaliwo (){
for(new g = 0 ; g < 200 ; g ++){
new id = GetPlayerVehicleID ( g );
Gas [ id ]--;
}
return true ;
}
public Stacjepaliw ( playerid )
{
if( IsPlayerConnected ( playerid ))
{
if( PlayerToPoint ( 5.0 , playerid , 1547.065185 , 23.461799 , 23.817667 )){
return 1 ;
}
else if( PlayerToPoint ( 6.0 , playerid , 1004.0070 ,- 939.3102 , 42.1797 ) || PlayerToPoint ( 6.0 , playerid , 1944.3260 ,- 1772.9254 , 13.3906 )){
return 1 ;
}
else if( PlayerToPoint ( 6.0 , playerid ,- 90.5515 ,- 1169.4578 , 2.4079 ) || PlayerToPoint ( 6.0 , playerid ,- 1609.7958 ,- 2718.2048 , 48.5391 )){
return 1 ;
}
else if( PlayerToPoint ( 6.0 , playerid ,- 2029.4968 , 156.4366 , 28.9498 ) || PlayerToPoint ( 8.0 , playerid ,- 2408.7590 , 976.0934 , 45.4175 )){
return 1 ;
}
else if( PlayerToPoint ( 5.0 , playerid ,- 2243.9629 ,- 2560.6477 , 31.8841 ) || PlayerToPoint ( 8.0 , playerid ,- 1676.6323 , 414.0262 , 6.9484 )){
return 1 ;
}
else if( PlayerToPoint ( 6.0 , playerid , 2202.2349 , 2474.3494 , 10.5258 ) || PlayerToPoint ( 10.0 , playerid , 614.9333 , 1689.7418 , 6.6968 )){
return 1 ;
}
else if( PlayerToPoint ( 8.0 , playerid ,- 1328.8250 , 2677.2173 , 49.7665 ) || PlayerToPoint ( 6.0 , playerid , 70.3882 , 1218.6783 , 18.5165 )){
return 1 ;
}
else if( PlayerToPoint ( 8.0 , playerid , 2113.7390 , 920.1079 , 10.5255 ) || PlayerToPoint ( 6.0 , playerid ,- 1327.7218 , 2678.8723 , 50.0625 )){
return 1 ;
}
}
return 0 ;
}
public OnPlayerCommandText ( playerid , cmdtext [])
{
if( strcmp ( cmdtext , "/tankuj" , true ) == 0 )
{
if( GetPlayerMoney ( playerid ) < FUELCOST )
{
new fuel [ 38 ];
format ( fuel , 38 , "Potrzebujesz $%i, aby nala? benzyne." , FUELCOST );
SendClientMessage ( playerid , COLOR_RED , fuel );
return 1 ;
}
if( IsPlayerConnected ( playerid ))
{
if( Stacjepaliw ( playerid ))
{
new kasaben ;
new lol ;
lol = GetPlayerVehicleID ( playerid );
kasaben = benzine - Gas [ lol ];
if( GetPlayerMoney ( playerid ) >= kasaben + 4 )
{
Gas [ lol ] += kasaben ;
kasaben = kasaben * 1 ;
format ( string , sizeof (string), "Zatankowa?e? do pe?nego baku (%d Litry) za %d $ " , kasaben , kasaben * 6 );
SendClientMessage ( playerid , COLOR_RED , string );
GivePlayerMoney ( playerid ,- kasaben * 6 );
}
}
else
{
SendClientMessage ( playerid , COLOR_GREY , "!Tylko na stacji paliw mo?esz tankowa? benzyne!" );
}
}
return 1 ;
}
if( strcmp ( cmdtext , "/tankujall" , true )== 0 && IsPlayerAdmin ( playerid ))
{
if( IsPlayerConnected ( playerid )){
for(new i = 0 ; i < 200 ; i ++){
new lol ;
new kasaben ;
lol = GetPlayerVehicleID ( i );
kasaben = benzine - Gas [ lol ];
Gas [ lol ] += kasaben ;
kasaben = kasaben * 1 ;
new name [ MAX_PLAYER_NAME ];
GetPlayerName ( playerid , name , sizeof ( name ));
format ( string , sizeof (string), "%s zatankowa? wszystkim pojazdy!Dzi?kujcie mu." , name , playerid );
SendClientMessage ( i , kolorek , string );
}
}
return 1 ;
}
return 0 ;
}
forward odpojazdu ();
public odpojazdu (){
new Float : HPcar ;
new Float : x , Float : y , Float : z ;
new Float : distance , value , id ;
static licznik [ MAX_VEHICLES ];
for(new i = 0 ; i < MAX_PLAYERS ; i ++){
if( IsPlayerConnected ( i ) && IsPlayerInAnyVehicle ( i )){
GetPlayerPos ( i , x , y , z );
distance = floatsqroot ( floatpower ( floatabs ( floatsub ( x , SavePlayerPos [ i ][ LastX ])), 2 )+ floatpower ( floatabs ( floatsub ( y , SavePlayerPos [ i ][ LastY ])), 2 )+ floatpower ( floatabs ( floatsub ( z , SavePlayerPos [ i ][ LastZ ])), 2 ));
value = floatround ( distance * 11000 );
id = GetPlayerVehicleID ( i );
licznik [ id ]+= floatround ( distance );
if( licznik [ id ]>= 100 ){
licznik [ id ]= false ;
Przebieg [ id ]+= 0.1 ;
}
GetVehicleHealth ( id , HPcar );
format ( string , sizeof (string), "~r~Pojazd:~w~ %s ~n~~r~HP Pojazdu:~w~ %.0f~n~~r~Predkosc:~w~ %d Km/h ~n~~r~Paliwo:~w~ %d% ~g~litrow ~n~~r~Max Paliwa:~w~ 150 ~g~Litrow~n~~r~Przebieg:~w~ %.01f km" , GetVehicleName ( id ), HPcar - 250 , floatround ( value / 1400 ), Gas [ id ], Przebieg [ id ]);
TextDrawSetString ( pojazd [ i ], string );
SavePlayerPos [ i ][ LastX ] = x ;
SavePlayerPos [ i ][ LastY ] = y ;
SavePlayerPos [ i ][ LastZ ] = z ;
if( Gas [ id ] < 1 )
{
BrakPaliwa [ i ] = 1 ;
GameTextForPlayer ( i , "~w~~n~~n~~n~Koniec Paliwa~n~Wpisz /wysiadz ,aby wyjsc z pojazdu" , 3000 , 3 );
}
}
}
return true ;
}
stock PlayerToPoint ( Float : radi , playerid , Float : x , Float : y , Float : z )
{
new Float : oldposx , Float : oldposy , Float : oldposz ;
new Float : tempposx , Float : tempposy , Float : tempposz ;
GetPlayerPos ( playerid , oldposx , oldposy , oldposz );
tempposx = ( oldposx - x );
tempposy = ( oldposy - y );
tempposz = ( oldposz - z );
if ((( tempposx < radi ) && ( tempposx > - radi )) && (( tempposy < radi ) && ( tempposy > - radi )) && (( tempposz < radi ) && ( tempposz > - radi )))
{
return 1 ;
}
return 0 ;
}
GetVehicleName ( vehicleid ){
new tmp = GetVehicleModel ( vehicleid ) - 400 ;
return carname [ tmp ];}
Teraz k?opot w tym, ?e po wej?ciu na serwer tworzy si? textdraw wygl?da to nast?puj?co :
Tak samo jest, ?e jak sie wejdzie do pojazdu, i wyjdzie sie z serwera to wida? ca?y texdraw z nazw? pojazdu, z hp pojazdu itp itp.
Mog? prosi? o poprawienie kodu?
By nie pokazywa?o textdrawu po tym jak sie wejdzie na serwer, oraz aby po wyj?ciu z srwera, nie by? on r?wnie? pokazywany?
Wysłany: 2012-06-15, 20:35
Lukasbank
Wiek: 30 Na forum: 5329 dni Posty: 249
Nick w MP: [USD]LuXoR[X]
Piwa : 404
hahahahhaha , no co ty , radz se sam za to ze tak zrobi?e? , to niejest tw?j licznik tylko Destroyer'a , niepomoge ci poniewarz przyw?aszczy?es sobie skrypt a ty go wcale nienapisa?es
Wysłany: 2012-06-15, 20:42
niree
Wiek: 28 Na forum: 5312 dni Posty: 22
Nick w MP: nireee_niree
Cytat: mo?na ?atwo go zobaczy? na tej stronie.
Ch?opaku, czytaj ze zrozumieniem, racja poda?em ca?y kod ze skryptu destroyera...nic nie zmieni?em w nim...to chyba dobrze, ?e chc?, by lepiej ten skrypt funkcjonowa??
Czy napisa?em, ?e ten kod jest m?j?
Czy zmieni?em w kodzie, co? na 'by/edited' ?
B?agam cie...
Prosz? was o pomoc, a ty mnie wy?miewasz z byle powodu.
?ci?gnij orginalny plik tego licznika...masz taki sam kod...
Co za...
Tagi: pojawiający :: się :: textdraw.
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: