SA-MP Forums Archive
Help fast rep+ - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Help fast rep+ (/showthread.php?tid=614657)



Help fast rep+ - Mijata - 10.08.2016

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;
}



Re: Help fast rep+ - J0sh... - 10.08.2016

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

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



Re: Help fast rep+ - Shinja - 10.08.2016

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



Re: Help fast rep+ - Mijata - 10.08.2016

Same problem...


Re: Help fast rep+ - Shinja - 10.08.2016

EDITED


Re: Help fast rep+ - Mijata - 10.08.2016

My is lvl 6


Re: Help fast rep+ - Shinja - 10.08.2016

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;




Re: Help fast rep+ - Mijata - 10.08.2016

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);



Re: Help fast rep+ - Shinja - 10.08.2016

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;




Re: Help fast rep+ - Mijata - 10.08.2016

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