command problem
#1

I use this:
PHP код:
CMD:setadmin(playeridparams[])
{
    new 
pIDvalue;
    if(!
IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1"{FF0000}EROARE: {FFFFFF}Nu ai acces la aceasta comanda.");
    else if(
sscanf(params"ui"pIDvalue)) return SendClientMessage(playeridCOL_GOLD"Foloseste: /setadmin [id] [adminlevel]");
    else if(
value || value 7) return SendClientMessage(playeridCOL_GOLD"Nivele valabile: 0-7.");
    else if(
pID == INVALID_PLAYER_ID) return SendClientMessage(playeridCOL_TOM"Jucatorul nu este conectat.");
    else
    {
        new 
string[128], string1[128], target[MAX_PLAYER_NAME], pName[MAX_PLAYER_NAME];
        
GetPlayerName(playeridpNamesizeof(pName));
        
GetPlayerName(pIDtargetsizeof(target));
        
format(stringsizeof(string), "I-ai setat lui %s admin level %i."targetvalue);
        
SendClientMessage(playeridCOL_GYELLOWstring);
        
format(stringsizeof(string), "Nivelul tau de admin a fost setat la %i de %s."valuepName);
        
SendClientMessage(pIDCOL_GYELLOWstring1);
        
PlayerInfo[pID][pAdmin] = value;
    }
    return 
1;

When i set a player adminlevel, he don't get the message from string. I get the message, he get a blank space in chat.
Reply
#2

try with this
Код:
SendClientMessage(playerid, COLOR, "Your Text Here");
Reply
#3

PHP код:
SendClientMessage(pIDCOL_GYELLOWstring1); 
this should be

PHP код:
SendClientMessage(pIDCOL_GYELLOWstring); 
How the new code will look like:
PHP код:
CMD:setadmin(playeridparams[]) 

    new 
pIDvalue
    if(!
IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1"{FF0000}EROARE: {FFFFFF}Nu ai acces la aceasta comanda."); 
    else if(
sscanf(params"ui"pIDvalue)) return SendClientMessage(playeridCOL_GOLD"Foloseste: /setadmin [id] [adminlevel]"); 
    else if(
value || value 7) return SendClientMessage(playeridCOL_GOLD"Nivele valabile: 0-7."); 
    else if(
pID == INVALID_PLAYER_ID) return SendClientMessage(playeridCOL_TOM"Jucatorul nu este conectat."); 
    else 
    {
        new 
string[100], target[MAX_PLAYER_NAME], pName[MAX_PLAYER_NAME]; 
        
GetPlayerName(playeridpNamesizeof(pName));
        
GetPlayerName(pIDtargetsizeof(target));
        
format(stringsizeof(string), "I-ai setat lui %s admin level %i."targetvalue);
        
SendClientMessage(playeridCOL_GYELLOWstring);
        
format(stringsizeof(string), "Nivelul tau de admin a fost setat la %i de %s."valuepName);
        
SendClientMessage(pIDCOL_GYELLOWstring);
        
PlayerInfo[pID][pAdmin] = value;
    } 
    return 
1

How we fixed and what you need to learn:
  1. You can format a string as many times as you like, you can use one variable, format the message in it, send it to the player, format the message again, send it to another player.
  2. You were using two variables for string.
  3. Don't use un-needed holder for variables, for example "new string[128]" when your string is a lot less, for example "new string[90]"
Reply
#4

Thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)