Jump to content

Radar + tachometr


FreeWall

Recommended Posts

tak máte to tu so jsem sliboval ;) ,tento script jsem vytvořil do RZ 5.1 a dam ho sem i jako TUT, asi 2 nebo 3 řádky jsou ze SA MP fora,

 

Info: Radar - celkem jich je po mapě 12, můžete si změnit na jiné nebo na více, pokud projede hráč s autem kolem objektu (radaru) rychlostí vyšší než 65 Km/h ( můžete změnit na své ) dá mu to pokutu -2500 $, dal jsem k tomu i tachometr aby jste věděli kolik jedete, pokud pojedete rychleji než 65 Km/h, zobrazí se číslo v Km/h ze zelené na červenou

 

Tachometr je umístěn uprostřed obrazovky dole :

tachometr.PNG

 

nahoru do módu

 

enum SPS
{
   Float:X_r,
   Float:Y_r,
   Float:Z_r
}
new PlayerPos[200][sPS];
new Text:KPH[MAX_PLAYERS];
new Text:KPHR[MAX_PLAYERS];
new Radarovany[MAX_PLAYERS];
forward radarCH();
forward radarEX(playerid);

 

kamkoli do módu

 

public radarCH(){
for(new i=0;iif(IsPlayerInAnyVehicle(i) && IsPlayerConnected(i)){
new string[128],Float:value_r,Float:distance_r,Float:x_r,Float:y_r,Float:z_r;
GetPlayerPos(i,x_r,y_r,z_r);
distance_r = floatsqroot(floatpower(floatabs(floatsub(x_r,PlayerPos[i][X_r])),2)+floatpower(floatabs(floatsub(y_r,PlayerPos[i][Y_r])),2)+floatpower(floatabs(floatsub(z_r,PlayerPos[i][Z_r])),2));
value_r = floatround(distance_r * 11000);
if(floatround(value_r/1400)>65){
format(string, 128, "~r~~h~%d",floatround(value_r/1400));
}else{
format(string, 128, "~g~~h~%d",floatround(value_r/1400));}
TextDrawSetString(KPHR[i],string);
PlayerPos[i][X_r] = x_r;
PlayerPos[i][Y_r] = y_r;
PlayerPos[i][Z_r] = z_r;
if(IsPlayerInSphere(i,2048.4158,1173.2195,10.6719,15) ||
IsPlayerInSphere(i,2066.5464,1623.2606,10.6719,15) ||
IsPlayerInSphere(i,2347.6807,2413.1965,10.6719,15) ||
IsPlayerInSphere(i,2507.3359,1880.9712,10.6719,15) ||
IsPlayerInSphere(i,2260.2791,1373.3129,10.6719,15) ||
IsPlayerInSphere(i,2281.9739,1193.3406,10.6719,15) ||
IsPlayerInSphere(i,2427.2900,1257.8555,10.7901,15) ||
IsPlayerInSphere(i,2210.5552,973.2725,10.6719,15) ||
IsPlayerInSphere(i,1536.0039,1133.1715,10.6719,15) ||
IsPlayerInSphere(i,1007.3343,1540.1764,10.6719,15) ||
IsPlayerInSphere(i,1448.2607,2589.8904,10.6719,15) ||
IsPlayerInSphere(i,1691.7292,2173.2539,10.6719,15)){
if(Radarovany[i]==0 && floatround(value_r/1400)>65 ){
Radarovany[i]=1;
GivePlayerMoney(i,-2500);
PlayerPlaySound(i, 1147, 0, 0, 0);
SendClientMessage(i,B_BILA," ");
format(string, 128, "[ Radar ] Jel jsi příliš velkou rychlostí ( %d Km/h ). Pokuta: -2500 $",floatround(value_r/1400));
SendClientMessage(i,COLOR_RED,string);
SetTimerEx("radarEX",5000,0,"i",i);
return 1;
}}}}
return 1;
}
//-----------------|
public radarEX(playerid){
Radarovany[playerid]=0;
}

 

do OnPlayerExitVehicle(playerid, vehicleid){

 

TextDrawHideForPlayer(playerid,KPH[playerid]);
TextDrawHideForPlayer(playerid,KPHR[playerid]);

 

do OnPlayerStateChange(playerid, newstate, oldstate){

 

if (newstate == 2 || newstate == 3){
//-------|
KPH[playerid] = TextDrawCreate(256,426,"Rychlost:");
TextDrawAlignment(KPH[playerid],0);
TextDrawBackgroundColor(KPH[playerid],0x000000ff);
TextDrawFont(KPH[playerid],1);
TextDrawLetterSize(KPH[playerid],0.7,1.8);
TextDrawColor(KPH[playerid],0xff0000cc);
TextDrawSetOutline(KPH[playerid],1);
TextDrawSetProportional(KPH[playerid],1);
TextDrawSetShadow(KPH[playerid],1);
//-------|
KPHR[playerid] = TextDrawCreate(370,426,"0");
TextDrawAlignment(KPHR[playerid],0);
TextDrawBackgroundColor(KPHR[playerid],0x000000ff);
TextDrawFont(KPHR[playerid],3);
TextDrawLetterSize(KPHR[playerid],0.7,1.8);
TextDrawColor(KPHR[playerid],0x00ff00cc);
TextDrawSetOutline(KPHR[playerid],1);
TextDrawSetProportional(KPHR[playerid],1);
TextDrawSetShadow(KPHR[playerid],1);
//-------|
TextDrawShowForPlayer(playerid,KPHR[playerid]);
TextDrawShowForPlayer(playerid,KPH[playerid]);
}
if(oldstate == PLAYER_STATE_DRIVER){
if(newstate == PLAYER_STATE_ONFOOT){
TextDrawHideForPlayer(playerid,KPH[playerid]);
TextDrawHideForPlayer(playerid,KPHR[playerid]);
}}
if(oldstate == PLAYER_STATE_PASSENGER){
if(newstate == PLAYER_STATE_ONFOOT){
TextDrawHideForPlayer(playerid,KPH[playerid]);
TextDrawHideForPlayer(playerid,KPHR[playerid]);
}}

 

do OnGameModeInit(){

 

SetTimer("radarCH",300,1);

 

___________________________________________________

 

ERRORY

 

undefined symbol "IsPlayerInSphere"

 

IsPlayerInSphere(playerid,Float:x,Float:y,Float:z,radius){
if(GetPlayerDistanceToPointEx(playerid,x,y,z) < radius){
return 1;
}
return 0;
}
GetPlayerDistanceToPointEx(playerid,Float:x,Float:y,Float:z){
new Float:x1,Float:y1,Float:z1;
new Float:tmpdis;
GetPlayerPos(playerid,x1,y1,z1);
tmpdis = floatsqroot(floatpower(floatabs(floatsub(x,x1)),2)+floatpower(floatabs(floatsub(y,y1)),2)+floatpower(floatabs(floatsub(z,z1)),2));
return floatround(tmpdis);
}

Link to comment
Share on other sites

  • Replies 105
  • Created
  • Last Reply

Top Posters In This Topic

Jinak jsem to skousel a mam erurrek :p

C:\DOCUME~1\VLASTN~1.MAM\Plocha\TT04.pwn(1521) : error 025: function heading differs from prototype

Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase

 

 

1 Error.

 

 

radek :

public radarEX(playerid){

 

Tak co stim? chci videt jak to vypada :thumbup:

uz vim neco me napadlo Smazte si z toho playerid takze takto :

public radarEX(){ a pujde vam to,rikam len kdybyste meli erorry ;)

Link to comment
Share on other sites

error 033: array must be indexed (variable "Radarovany")

error 033: array must be indexed (variable "Radarovany")

error 033: array must be indexed (variable "Radarovany"

 

neviem si rady skusal som to opravit ale nejde mi to

Link to comment
Share on other sites

C:\DOCUME~1\Sekerka\Plocha\pawno\chigago.pwn(1488) : warning 215: expression has no effect

C:\DOCUME~1\Sekerka\Plocha\pawno\chigago.pwn(1489) : warning 215: expression has no effect

Link to comment
Share on other sites

Prosim vas kam to mam dat?? pls

IsPlayerInSphere(playerid,Float:x,Float:y,Float:z,radius){
if(GetPlayerDistanceToPointEx(playerid,x,y,z) < radius){
return 1;
}
return 0;
}
GetPlayerDistanceToPointEx(playerid,Float:x,Float:y,Float:z){
new Float:x1,Float:y1,Float:z1;
new Float:tmpdis;
GetPlayerPos(playerid,x1,y1,z1);
tmpdis = floatsqroot(floatpower(floatabs(floatsub(x,x1)),2)+floatpower(floatabs(floatsub(y,y1)),2)+floatpower(floatabs(floatsub(z,z1)),2));
return floatround(tmpdis);
}

Link to comment
Share on other sites

Misto new Radarovany[MAX_PLAYERS]; dej : new Radarovany;

:rap:

Jinak taky ti děkuju. Dělalo mě to taky. Je to supr!!! :rap:

 

máte to blbě, new Radarovany; tam nemá bejt, správně je : new Radarovany[MAX_PLAYERS];

 

EDIT: měl sem to blbě já, ted je to správně i v TUTU ale hlavně tam nedávejte new Radarovany; - to je globální a má tam bejt pro hráče...

Link to comment
Share on other sites

Tak mi to hodilo error!

 

C:\Documents and Settings\Owner\Plocha\xtreamecity.pwn(2172) : error 033: array must be indexed (variable "Radarovany")

Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase

 

 

1 Error.

 

 

A tady jsou řádky:

 

public radarEX(playerid)
{
Radarovany=0;
}
IsPlayerInSphere(playerid,Float:x,Float:y,Float:z,radius){
if(GetPlayerDistanceToPointEx(playerid,x,y,z) < radius){
return 1;
}
return 0;
}
GetPlayerDistanceToPointEx(playerid,Float:x,Float:y,Float:z){
new Float:x1,Float:y1,Float:z1;
new Float:tmpdis;

Link to comment
Share on other sites

FreeWall":2cq9q9jw]říkal sem že sem to opravil takže kdyby si to udělal znova podle toho TUT tak ti to půjde,

 

misto Radarovany=0; dej Radarovany[playerid]=0;

Ok už je GUT!!! :rap:

Link to comment
Share on other sites

  • 2 months later...

D:\Nová složka\gamemodes\tcv1.pwn(44) : error 017: undefined symbol "SPS"

D:\Nová složka\gamemodes\tcv1.pwn(44) : error 009: invalid array size (negative, zero or out of bounds)

D:\Nová složka\gamemodes\tcv1.pwn(435) : warning 213: tag mismatch

D:\Nová složka\gamemodes\tcv1.pwn(435) : warning 213: tag mismatch

D:\Nová složka\gamemodes\tcv1.pwn(435) : warning 213: tag mismatch

D:\Nová složka\gamemodes\tcv1.pwn(442) : warning 213: tag mismatch

D:\Nová složka\gamemodes\tcv1.pwn(443) : warning 213: tag mismatch

D:\Nová složka\gamemodes\tcv1.pwn(444) : warning 213: tag mismatch

 

 

 

 

 

 

 

jak to mam spravit

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...