What's wrong with this?
#1

PHP код:
CMD:vsay(playerid,params[])
{
    if(
PlayerInfo[playerid][pVIP] >= 3)
    {
    new 
string[128];
    new 
name[MAX_PLAYER_NAME];
    new 
text;
    
GetPlayerName(playeridnamesizeof(name));
    if(
sscanf(params"s[128]"text)) return SendClientMessage(playerid0xf8f8f8fff"Syntax: {ff0ff0}/vsay <text>");
    
format(string,sizeof(string)," {ff0000}(V.I.P){00ffff} %s(%i): {FFFF00}%s",name,playerid,text);
    
SendClientMessageToAll(0xF8f8F8FFF,string);
    }
    else
    {
    
SendClientMessage(playerid0xf8F8F8FFF,"ERROR: {FFFF00}You must be a Gold V.I.P membership to use this command!");
    }
    return 
1;

Reply
#2

text has to be an array
Reply
#3

Quote:
Originally Posted by [Bios]Marcel
Посмотреть сообщение
text has to be an array
Like? For example?
Reply
#4

Try with this code

PHP код:
CMD:vsay(playerid,params[]) 

    if(
PlayerInfo[playerid][pVIP] >= 3
    { 
        new 
string[128]; 
        new 
name[MAX_PLAYER_NAME]; 
        new 
text
        
GetPlayerName(playeridnamesizeof(name)); 

        if(!
sscanf(params"s[128]"text)) return SendClientMessage(playerid0xf8f8f8fff"Syntax: {ff0ff0}/vsay <text>"); 
        
format(string,sizeof(string)," {ff0000}(V.I.P){00ffff} %s(%i): {FFFF00}%s",name,playerid,text); 
        
SendClientMessageToAll(0xF8f8F8FFF,string); 
        } 
        else 
        { 
        
SendClientMessage(playerid0xf8F8F8FFF,"ERROR: {FFFF00}You must be a Gold V.I.P membership to use this command!"); 
        } 
    return 
1

Reply
#5

to much lines for this commands.
use it like this.

PHP код:
CMD:vsay(playerid,params[])
{
    if(
PlayerInfo[playerid][pVIP] < 3)return SendClientMessage(playerid0xf8F8F8FFF,"ERROR: {FFFF00}You must be a Gold V.I.P membership to use this command!");
    new 
string[128], name[MAX_PLAYER_NAME], text[128];
    
GetPlayerName(playeridnamesizeof(name));
    if(
sscanf(params"s[128]"text))return SendClientMessage(playerid0xf8f8f8fff"Syntax: {ff0ff0}/vsay <text>");
    {
        
format(string,sizeof(string),"{ff0000}(V.I.P){00ffff} %s(%i): {FFFF00}%s",name,playerid,text);
        
SendClientMessageToAll(0xF8f8F8FFF,string);
    }
    return 
1;

Reply
#6

Код:
 new text[128] - this an array
Every character that you wrote will take a place there
"Hello" will be
Код:
 text[0] = "H" 
text[1] = "E"
And so on
So your "new text" need to be an array
Reply
#7

Thanks Guys! much thanks!
Reply
#8

You don't need to use sscanf at all in this case. Just use isnull and the params.
Код:
CMD:vsay(playerid, params[])
{
    if (PlayerInfo[playerid][pVIP] < 3) 
        return SendClientMessage(playerid, 0xf8F8F8FFF,"ERROR: {FFFF00}You must be a Gold V.I.P membership to use this command!");

    if (isnull(params)) 
        return SendClientMessage(playerid, 0xf8f8f8fff, "Syntax: {ff0ff0}/vsay <text>");

    new string[128], name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof(name));
    format(string, sizeof(string),"{ff0000}(V.I.P){00ffff} %s(%i): {FFFF00}%s", name, playerid, params);
    SendClientMessageToAll(0xF8f8F8FFF, string);
    return 1;
}
Reply
#9

Quote:
Originally Posted by GoldenLion
Посмотреть сообщение
You don't need to use sscanf at all in this case. Just use isnull and the params.
Код:
CMD:vsay(playerid, params[])
{
    if (PlayerInfo[playerid][pVIP] < 3) 
        return SendClientMessage(playerid, 0xf8F8F8FFF,"ERROR: {FFFF00}You must be a Gold V.I.P membership to use this command!");

    if (isnull(params)) 
        return SendClientMessage(playerid, 0xf8f8f8fff, "Syntax: {ff0ff0}/vsay <text>");

    new string[128], name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof(name));
    format(string, sizeof(string),"{ff0000}(V.I.P){00ffff} %s(%i): {FFFF00}%s", name, playerid, params);
    SendClientMessageToAll(0xF8f8F8FFF, string);
    return 1;
}
Okay thanks, more easy than sscanf
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)