06-15-2017, 08:25 PM
(This post was last modified: 06-15-2017, 08:28 PM by Starboy Edited 1 time in total.)
(06-15-2017, 02:33 PM)Yassine Wrote:(06-15-2017, 09:45 AM)Winnie Wrote:(06-15-2017, 12:58 AM)Yassine Wrote: 1: its still useless, rarely when someone want to check PL, players always check FPS not on PL, i do recommand /my playerinfo
and i did get your code already i didnt want to speak advanced on it :d
Go to LVP and ask players or admins if they want to talk to you, do they want a command to check their own PL or not. 95% percent will say yes even admins wants it. nobody wants to go to his/her frnd to tell him whats his PL. have some brain.... "people always check FPS not on PL'Welcome To SAMP... are you new or something? who told you that
/my playerinfo tells you other players info by giving you a bubble text on each player body. we are talking about our PL via single command.
Please try to elaborate, we are here for opinions and suggestions after all... and be "advanced" so we can understand.
1- PL command:
first of all there some bugs and mistakes that i didn't talked about it and code is need of optimizations
AmmaRz Code:
Code:lvp_pl(playerId, params[]) {
if (Command->parameterCount(params) == 0) {
// Show the packet loss to player who just wrote the command either wrongfully, or willingly.
format(g_message, sizeof(g_message), "{E6B800}Your Packet Loss is: {FF9900}%.2f{FFFFFF}. To check other's, Use: /PL [player]",
NetStats_PacketLossPercent(playerId));
SendClientMessage(playerId, Color::Information, g_message);
return 1;
}
new subjectId = Command->playerParameter(params, 0, playerId);
if (subjectId == Player::InvalidId)
return 1;
// Show the Packet loss per percent of specified player.
format(g_message, sizeof(g_message), "{E6B800}Packet Loss of %s (Id:%d) is: {FF9900}%.2f.",
Player(subjectId)->nicknameString(), subjectId, NetStats_PacketLossPercent(subjectId));
SendClientMessage(playerId, Color::Success, g_message);
return 1;
}
instand of using this params check and adding more lines (cpu usage even if its small) isnt needed, you can directly check if he inserted an id else you can replace subjectId by his Id
like this
Quote:if (Command->parameterCount(params) == 0) subjectId = playerId
else subjectId = Command->playerParameter(params, 0, playerId);
and like that its more optimized and better about some mistakes you did
Code:SendClientMessage(playerId, Color::Success, g_message);
SendClientMessage(playerId, Color::Information, g_message);
Seems like you used colors while format so using Color:uccess/Information isn't needed anymore, you can replace it by -1
and i see that you did put it on AdministratorCommands.pwn, you should move it to General.pwn
![[Image: 117tdnn.jpg]](http://i67.tinypic.com/117tdnn.jpg)
(06-15-2017, 02:33 PM)Yassine Wrote: and a little thingIsPlayerConnected : Why would i use it?
Quote: if (subjectId == Player::InvalidId)
return 1;
(06-15-2017, 02:33 PM)Yassine Wrote: Player will never insert an invalid id, because of It's just checking if a variable is equal to INVALID_PLAYER_ID (a number), which is never connected because a player can never have that ID.
You can simply use IsPlayerConnected instand.
Can you explain this?
![[Image: 29mx8g1.jpg]](http://i66.tinypic.com/29mx8g1.jpg)
(06-15-2017, 02:33 PM)Yassine Wrote: @Winnie: You should check codes and things before trying to give an opinion ;>
2- Anit fake car entry
About your second code its uncomptabilite with LVP, but lets make it do
Code:#include <a_samp>
#define HIT_TIME 10 //Seconds: Can be increased as dev's wish.
new
MadeWeaponShot[MAX_PLAYERS],
TookDamage[MAX_PLAYERS];
main(){}
public OnGameModeInit()
{
SetTimer("OnScriptUpdate",1000,true);
}
forward OnScriptUpdate();
public OnScriptUpdate()
{
for(new i = 0, j = GetPlayerPoolSize(); i <= j; i++)
{
if(IsInFight(i))
{
if(GetPlayerSpecialAction(i) == SPECIAL_ACTION_ENTER_VEHICLE)
{
ClearAnimations(i); // clear the animations
new Float:pos[3];
GetPlayerPos(i, pos[0], pos[1], pos[2]);
SetPlayerPos(i, pos[0], pos[1], pos[2] + 3); // Just making sure that player is stunned.
SendClientMessage(i, 0xff9900FF, "** You can't enter in a car while you are in a fight or fired a weapon!");
}
}
}
return 1;
}
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
MadeWeaponShot[playerid] = gettime(); // Saving it in a variable
return 1;
}
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)
{
if(issuerid != INVALID_PLAYER_ID)
{
TookDamage[playerid] = gettime(); // Saving it in a variable
}
return 1;
}
stock IsInFight(playerid) // to check as if player is in fight or not
{
if(gettime() - MadeWeaponShot[playerid] < HIT_TIME) return 1;
if(gettime() - TookDamage[playerid] < HIT_TIME) return 1;
return 0;
}
(06-15-2017, 02:33 PM)Yassine Wrote: i f you did a look that means the variables of Fighting isnt needed, you can use directly the lvp variable or function DamageManager(playerid)->isPlayerFighting() that's return two values true or false, so 95 % of code will be removed, because of there a callback OnPlayerEnterVehicle(playerid, vehicleid, ispassenger) so we don't need timer anymore, and simply remove player from vehicle instand of setting pos again
and seems like lvp moved it to java script, but try it on pawno on your local server before open a PR, so code will looks like this
Code:public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
if (DamageManager(playerid)->isPlayerFighting())
{
ClearAnimations(playerid);
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, Color::Error, "** You can't enter in a car while you are in a fight or fired a weapon!");
}
return 1;
}
If ever you had read the title of my thread you would have never said 'Incompatible'. because it was an idea based script and compatible with all other 99.99% of samp servers. I am not obsessed with lvp script.
The same thing can also be done in OnPlayerKeyStateChange aswell..
What i did, is i get the vehicle entering animation, i already told that..
Btw by obsessed i meant.
Yaa, AKA LVP YAssine Releasing the LVP script under his name.
Welcome To SAMP... are you new or something? who told you that
/my playerinfo tells you other players info by giving you a bubble text on each player body. we are talking about our PL via single command. 
uccess/Information isn't needed anymore, you can replace it by