is this a Right Code?
#1

I want to Count the players that online and Print the Number when any Player Joines!

Код:
new players 
public onplayerconnect
{    
 	players+=1;
 	printf("there are Currently %d online",players);
        public OnPlayerDisconnect(playerid, reason)
}    return 1;


{

 	players--;
    printf("there are currently %d players online ",players);

	return 1;
}
Reply
#2

It Compiles and everything is good but Nothing happen IG
Reply
#3

pawn Код:
new players = 0;

public OnPlayerConnect(playerid)
{
     players++;
     printf("There are currently %d players online.", players);
     return 1;
}
public OnPlayerDisconnect(playerid)
{
     players--;
     printf("There are currently %d players online.", players);
     return 1;
}
This is a right example.
Reply
#4

Why it Doesn't Print IG that there is ** players ?

Another thing:

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/welcome", cmdtext, true, 10) == 0)
    SendClientMessageToAll(RED,"Welcome");
     

	return 0;
}
The CMD works Perfectly but it says Unknown COmmande but it works! what is this Means?
Reply
#5

Have you got
pawn Код:
#if defined FILTERSCRIPT
anywhere? If so, delete that and your code might work. The code that you have in your first post would have given errors unless you had an if defined that made the compiler skip the errors.

EDIT: I also just saw that you want it to show ingame. Use format + SendClientMessageToAll to do this rather than print.
Reply
#6

No In Both Codes 0 Errors but In the FIrst Nothing Happen! and in the Second The CMD works Perfectly but it tells me Unknown Command what is this Means?
Reply
#7

pawn Код:
if (strcmp("/welcome", cmdtext, true) == 0) return SendClientMessageToAll(RED,"Welcome");
or
pawn Код:
if (strcmp("/welcome", cmdtext, true) == 0)
{
    SendClientMessageToAll(RED,"Welcome");
    return 1;
}
You must return 1, or it will return 0 which is unknown command.
Reply
#8

Maybe this Helpes you to Find the Problem?:



[Code]#include <a_samp>
#include <a_http>
#include <a_Npc>
#include <a_objects>
#include <a_players>
#include <a_sampdb>
#include <a_vehicles>
#include <core>
#include <Datagram>
#include <file>
#include <float>
#include <String>
#include <time>



#define RED 0xff000ff
#define GREY 0xAFAFAFAA
#define WHITE 0xFFFFFFAA
#define YELLOW 0xFFFF00AA
#define LIGHTBLUE 0x33CCFFAA
#define LIGHTGREEN 0x9ACD32AA
#define BLUE 0x5A8CA5AA
#define GREEN 0x33AA33AA
#define PURPLE 0xC2A2DAAA
#define COLOR_OTHER 0xFF6347AA
#define ORANGE 0xFF8C00AA
#define COLOR_DMV 0xFF0000F
#define COLOR_DMV2 0xaa3333AA
new players = 0;
new cars= 0;[/QUOTE]
Reply
#9

why in the First Code Nothing Happened IG and in the Script 0 Error

@specialKiller Thank you very Much for helping me!!!
Reply
#10

Anyone please help me
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)