cmd for .
#1

Is there any way or create a command to see how many people are in a vehicle, in general? , I mean, a command to know how many people connected to the server are uploaded to a car
Reply
#2

PHP код:

//Includes 
#include <a_samp>// samp team
#include <zcmd> //Zeex
#include <foreach> // Kar
#undef MAX_PLAYERS
#define MAX_PLAYERS 500
new incar[MAX_PLAYERS];
public 
OnPlayerEnterVehicle(playerid)
{
    
incar[playerid] = 1;
    return 
1;
}
public 
OnPlayerStateChange(playeridnewstateoldstate)
{
    if(
oldstate == PLAYER_STATE_DRIVER)
    {
        
incar[playerid] = 0;
    }
    return 
1;
}
public 
OnPlayerConnect(playerid)
{
    
incar[playerid] = 0;
    return 
1;
}
public 
OnPlayerDisconnect(playerid)
{
    
incar[playerid] = 0;
    return 
1;
}
CMD:findplayerincar(playeridparams[])
{
    foreach(new 
Player)
    {
        if(
IsPlayerInAnyVehicle(i))
        {
            
incar[i] = 1;
        }
    }
    new 
string[64];
    
format(stringsizeof(string), "%d players are in vehicle"incar);
    
SendClientMessage(playerid, -1string);
    return 
1;

Reply
#3

There is, if you make one...

A simple command, with a loop, with the check IsPlayerInAnyVehicle, counting up on a variable which is then posted via SendClientMessage to whoever...

Quote:
Originally Posted by AlexMSK
Посмотреть сообщение
PHP код:
//Note
/*This is a [NPC]Filterscript  made by Adil.
  This Filter script allows you to travel through LS with two [NPC]'s who drive the Bus.
  I basically made this for RP servers.
  If you are facing some problems then read the tutorial or post your problem on the release page.
  Please you are requested to not to remove the credits, thankyou.
  For further support, this is my forums profile http://forum.sa-mp.com/member.php?u=3524...5.02404562
  Enjoy.*/
//Includes
#include <a_samp>
#include <zcmd>
#include <foreach>
#undef MAX_PLAYERS
#define MAX_PLAYERS 500
new incar[MAX_PLAYERS];
public 
OnPlayerEnterVehicle(playerid)
{
    
incar[playerid] = 1;
    return 
1;
}
public 
OnPlayerStateChange(playeridnewstateoldstate)
{
    if(
oldstate == PLAYER_STATE_DRIVER)
    {
        
incar[playerid] = 0;
    }
    return 
1;
}
public 
OnPlayerConnect(playerid)
{
    
incar[playerid] = 0;
    return 
1;
}
public 
OnPlayerDisconnect(playerid)
{
    
incar[playerid] = 0;
    return 
1;
}
CMD:findplayerincar(playeridparams[])
{
    foreach(new 
Player)
    {
        if(
IsPlayerInAnyVehicle(i))
        {
            
incar[i] = 1;
        }
    }
    new 
string[64];
    
format(stringsizeof(string), "%d players are in vehicle"incar);
    
SendClientMessage(playerid, -1string);
    return 
1;

This is a reason not to follow copy-pasters advice. This whole page of code, even with the screwup in the credits from the script he ripped it from, can be done in probably 6 lines of code...

We don't need zcmd, we don't need foreach, we don't need to reassign MAX_PLAYERS.

Why assign InCar, if you're going to check via IsPlayerInAnyVehicle, invoked via a command that displays it anyway, yet every time someone jumps in or out of a vehicle it's counted.


All of this, terrible.
Reply
#4

Quote:
Originally Posted by Sew_Sumi
Посмотреть сообщение
There is, if you make one...

A simple command, with a loop, with the check IsPlayerInAnyVehicle, counting up on a variable which is then posted via SendClientMessage to whoever...




This is a reason not to follow copy-pasters advice. This whole page of code, even with the screwup in the credits from the script he ripped it from, can be done in probably 6 lines of code...
However it's just an example. He can do it however he want to.


Код:
//Note 
/*This is a [NPC]Filterscript  made by Adil. 
  This Filter script allows you to travel through LS with two [NPC]'s who drive the Bus. 
  I basically made this for RP servers. 
  If you are facing some problems then read the tutorial or post your problem on the release page. 
  Please you are requested to not to remove the credits, thankyou. 
  For further support, this is my forums profile http://forum.sa-mp.com/member.php?u=35249 
  Enjoy.*/
sorry bout this lol!
Reply
#5

Quote:
Originally Posted by AlexMSK
Посмотреть сообщение
However it's just an example. He can do it however he want to.
It's an example of how not to do it.

Pretty sure that your counting variable still has a problem too.
Reply
#6

Alright, show me the problem when you'll find it.
Reply
#7

Don't need to, but seriously, this isn't the place to copy paste code which is terrible, and hope to get repped from it.

You didn't explain shit, you didn't do anything other than rip someone elses script, of EVERYTHING ELSE THAT it does, FOR ONE PORTION...




Which, MOST OF THE SCRIPT THAT YOU'VE SHOWN ISN'T EVEN USED...


After all, you check upon entering and exiting vehicles, changing the values, yet when it comes time to display that information you go through a loop of the players anyway, making the tracking of what player is in a car, obsolete.


You didn't say anything, explain or anything, you simply threw up code in the hopes of a quick +rep. That's what's wrong with the system.
Reply
#8

Quote:
Originally Posted by Sew_Sumi
Посмотреть сообщение
Don't need to, but seriously, this isn't the place to copy paste code which is terrible, and hope to get repped from it.

You didn't explain shit, you didn't do anything other than rip someone elses script, of EVERYTHING ELSE THAT it does, FOR ONE PORTION...




Which, MOST OF THE SCRIPT THAT YOU'VE SHOWN ISN'T EVEN USED...


After all, you check upon entering and exiting vehicles, changing the values, yet when it comes time to display that information you go through a loop of the players anyway, making the tracking of what player is where, isn't even needed.


You didn't say anything, explain or anything, you simply threw up code in the hopes of a quick +rep. That's what's wrong with the system.
Who gives a fuck about a rep?
Sorry copypasted? where have you seen this? Only because i used a NPC filterscript to do all this which took me 10 fucking seconds you saying that i copypasted?
Reply
#9

Quote:
Originally Posted by AlexMSK
Посмотреть сообщение
Who gives a fuck about a rep?
Sorry copypasted? where have you seen this? Only because i used a NPC filterscript to do all this which took me 10 fucking seconds you saying that i copypasted?
I do...

Yes, copy pasted... Why else did you have credits on the top of the page when it would be even faster to open up a new.pwn file in the first instance.


With that, I'm out...


OP: Learn to actually use the language, rather than copy-pasting as a vast majority do here, and don't fall into repping people early, as many simply rep someone for helping, yet the help, is misguided, and incorrect.
Reply
#10

Alright, when you come back check this out, https://sampforum.blast.hk/showthread.php?tid=275695
And stop being trash professor
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)