Get Players Speed (+rep) -
Dripac - 25.03.2012
I have this at a timer which updates every 1 second
pawn Код:
for(new i=0;i<MAX_PLAYERS;i++)
{
if(IsPlayerConnected(i))
{
if(GetPlayerState(i) == PLAYER_STATE_DRIVER)
{
new speed = GetSpeed(i);
if(speed > 200 && PlayerInfo[i][pAdmin] < 1)
{
new string[256];
new sendername[MAX_PLAYER_NAME];
GetPlayerName(i, sendername, sizeof(sendername));
format(string, sizeof(string), "[ACHTUNG] Folgender Spieler hat mцglicherweise Speedhack: [%d]%s - %d km/h",i,sendername,speed);
ABroadCast(COLOR_YELLOW,string,1);
}
}
}
}
And this is the stock to get players speed
pawn Код:
public GetSpeed(id)
{
new Float:s[4];
GetVehicleVelocity(GetPlayerVehicleID(id),s[0],s[1],s[2]);
return floatround(1.61*floatsqroot(floatabs(floatpower(s[0]+s[1]+s[2],2)))*100);
}
The problem is, it won't send a message to admins even if the player is driving 500 km/h, it should send a message to admins if the players reaches over 200 km/h
It compiles without errors and warnings, but it doesn't work
Can anyone help? I'll give +rep
Re: Get Players Speed (+rep) -
Face9000 - 25.03.2012
Код:
if(speed > 200 && PlayerInfo[i][pAdmin] < 1)
Admin Level < (means minus) 1? So it's for players level,should be > 1..?
Re: Get Players Speed (+rep) -
sjvt - 25.03.2012
Quote:
Originally Posted by Logitech90
Код:
if(speed > 200 && PlayerInfo[i][pAdmin] < 1)
Admin Level < (means minus) 1? So it's for players level,should be > 1..?
|
No, he means with that
If player drives over 200km and is NO admin, admins want get a warning message with 'Blabla is driving over 200km+'
Why you dont do?:
pawn Код:
if(speed > 200 && PlayerInfo[i][pAdmin] == 0)
Re: Get Players Speed (+rep) -
Kyle - 25.03.2012
Change the operator to > as that will then send the message to admins higher than 1.
Re: Get Players Speed (+rep) -
Face9000 - 25.03.2012
Is what im saying. [pAdmin] == 0,like you done,is admin level equal to 0,so i assume it's player level.Starting from 1 it's admin level,0 is players level...
Re: Get Players Speed (+rep) -
sjvt - 25.03.2012
Quote:
Originally Posted by Logitech90
Is what im saying. [pAdmin] == 0,like you done,is admin level equal to 0,so i assume it's player level.Starting from 1 it's admin level,0 is players level...
|
No i think he use an edit and all rp scripts on forum.sa-mp use much pLevel. I use always == 0) and not < 1) but everybody has his own style.
Код:
<= : is lower then and that number
< : is lower then
AW: Get Players Speed (+rep) -
Dripac - 25.03.2012
Oh thanks guys, i didn't understand the pAdmin line, now i get it, it didn't show because i was an admin
It works now
Thank you, +rep
AW: Get Players Speed (+rep) -
'Pawno. - 25.03.2012
Pls be sure that "GetSpeed" has no maximum, so print every second a message in the console like this:
printf("%d is driving more than 200km/h. (%fkm/h)", playerid, speed);
or for you:
printf(%d fдhrt mehr als 200 km/h. (%fkm/h)", playerid, speed);
i hope i have helped you, and im from germany if you want to answer me.
but my english is not so good, thats the reason i dont type much in this forum ^^
(forum.sa-mp.de is better For me <.<)
Re: Get Players Speed (+rep) -
Face9000 - 25.03.2012
Quote:
Originally Posted by sjvt
No i think he use an edit and all rp scripts on forum.sa-mp use much pLevel. I use always == 0) and not < 1) but everybody has his own style.
Код:
<= : is lower then and that number
< : is lower then
|
I know the signals about < and > or <=,i was just explaining.Like all admin systems (i think),level 0 is for players,then 1-2-3-4-5-6 is for admins,so i assumed he use this type of levels,i made that post.
Quote:
Originally Posted by Dripac
Oh thanks guys, i didn't understand the pAdmin line, now i get it, it didn't show because i was an admin
It works now
Thank you, +rep
|
No problem.