Help fast rep+
#1

Why i can't see anything when i enter cmd?

Code:
public OnPlayerCommandPerformed( playerid, cmdtext[], success)
{
if(!success)
{
SendClientMessage(playerid,red,"ERROR: Unknown command, use /cmds for the list of available commands.");
}
for(new i=0; i <MAX_PLAYERS; i++)
{
if(pInfo[playerid][pLevel] > 1)
{
new string[200];
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
format(string,sizeof(string),"%s[%d] has used command %s",name,playerid,cmdtext);
SendClientMessage(i,COLOR_GREY,string);
}
}
return 1;
}
Reply
#2

PHP Code:
if(pInfo[playerid][pLevel] > 1
You're checking the player's own level.

PHP Code:
if(pInfo[i][pLevel] > 1
Reply
#3

PHP Code:
if(pInfo[i][pLevel] > 1
Reply
#4

Same problem...
Reply
#5

EDITED
Reply
#6

My is lvl 6
Reply
#7

I tested it for myself, its working and i even optimized the code a bit, Don't declare variables inside a loop and format string in each loop
Well here is the code that worked for me fine, show's for +5

PHP Code:
public OnPlayerCommandPerformed(playeridcmdtext[], success)
{
    if(!
success) return SendClientMessage(playerid0xCD0000FF"Invalid command. Please use {FFF8CF}/cmds {CD0000}to list all available commands.");
    new 
string[100];
    
format(string,sizeof(string),"%s[%d] has used command %s",pName[playerid],playerid,cmdtext);
    for(new 
i=0;i<MAX_PLAYERS;i++) { if(pInfo[i][pLevel] > 4SendClientMessage(i,-1,string); }
    return 
1;

Reply
#8

Quote:

pwn(2669) : error 028: invalid subscript (not an array or too many subscripts): "PlayerName"
(2669) : warning 215: expression has no effect
(2669) : error 001: expected token: ";", but found "]"
(2669) : error 029: invalid expression, assumed zero
(2669) : fatal error 107: too many error messages on one line

This line :
Code:
format(string,sizeof(string),"%s[%d] has used command %s",PlayerName[playerid],playerid,cmdtext);
Reply
#9

PHP Code:
public OnPlayerCommandPerformed(playeridcmdtext[], success)
{
    if(!
success) return SendClientMessage(playerid0xCD0000FF"Invalid command. Please use {FFF8CF}/cmds {CD0000}to list all available commands.");
    new 
string[100], name[25];
    
GetPlayerName(playeridname25);
    
format(string,sizeof(string),"%s[%d] has used command %s",name,playerid,cmdtext);
    for(new 
i=0;i<MAX_PLAYERS;i++) { if(pInfo[i][pLevel] > 4SendClientMessage(i,-1,string); }
    return 
1;

Reply
#10

Again same problem can't see anything from this public...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)