#1

PHP код:
CMD:makedonator(playeridparams[])
{
    new 
idstring[256];
    if(
sscanf(params"ud"id)) return SendClientMessage(playerid,RED,"[USAGE]: /makedonator [name/id]");
    if(
pData[playerid][pAdmin] < 4) return 0;
    if(!
IsPlayerConnected(id)) return SendClientMessage(playeridRED"Player not found.");
    {
        
PlayerPlaySound(id,1085,0.0,0.0,0.0);
        
format(stringsizeof(string), "{009BFF}You have give %s (%d) Donator Player level"GetName(id), id);
        
SendClientMessage(playeridGREENstring);
        
pData[playerid][pDonator] = 1;
    }
    return 
true;

Whenever i use this cmd it works fine but i get this in my logs

PHP код:
[17:43:36sscanf warningFormat specifier does not match parameter count.
[
17:43:42sscanf warningFormat specifier does not match parameter count
whats wrong, and also explain please
Reply
#2

change :
Код:
if(sscanf(params, "ud", id)) return SendClientMessage(playerid,RED,"[USAGE]: /makedonator [name/id]");
to :
Код:
if(sscanf(params, "u", id)) return SendClientMessage(playerid,RED,"[USAGE]: /makedonator [name/id]");
Reply
#3

Код:
if(sscanf(params, "ud", id)) return SendClientMessage(playerid,RED,"[USAGE]: /makedonator [name/id]");
You're using 2 specifiers(u and d) when you're only storing information in one variable, therefore remove the 'd' and you should be all set to go.
Reply
#4

Quote:
Originally Posted by rymax99
Посмотреть сообщение
Код:
if(sscanf(params, "ud", id)) return SendClientMessage(playerid,RED,"[USAGE]: /makedonator [name/id]");
You're using 2 specifiers(u and d) when you're only storing information in one variable, therefore remove the 'd' and you should be all set to go.
you can bold the text instead change the color to yellow, it's hurt my eyes ROFL.
Reply
#5

Thanks x337 for code. thanks ray for explanation.
Reply
#6

Quote:
Originally Posted by STONEGOLD
Посмотреть сообщение
PHP код:
CMD:makedonator(playeridparams[])
{
    new 
idstring[256];
    if(
sscanf(params"ud"id)) return SendClientMessage(playerid,RED,"[USAGE]: /makedonator [name/id]");
    if(
pData[playerid][pAdmin] < 4) return 0;
    if(!
IsPlayerConnected(id)) return SendClientMessage(playeridRED"Player not found.");
    {
        
PlayerPlaySound(id,1085,0.0,0.0,0.0);
        
format(stringsizeof(string), "{009BFF}You have give %s (%d) Donator Player level"GetName(id), id);
        
SendClientMessage(playeridGREENstring);
        
pData[playerid][pDonator] = 1;
    }
    return 
true;

Whenever i use this cmd it works fine but i get this in my logs

PHP код:
[17:43:36sscanf warningFormat specifier does not match parameter count.
[
17:43:42sscanf warningFormat specifier does not match parameter count
whats wrong, and also explain please
Should never do it that way in the first place.

Try..
PHP код:
CMD:makedonator(playeridparams[]) {
    new 
idstring[256];
    if(
sscanf(params"u"id)) {        
        if(
pData[playerid][pAdmin] < 4) return 0;
        if(!
IsPlayerConnected(id)) {
            
SendClientMessage(playeridRED"Player not found.");
            return 
1;
        } else {
            
PlayerPlaySound(id,1085,0.0,0.0,0.0);
            
format(stringsizeof(string), "{009BFF}You have give %s (%d) Donator Player level"GetName(id), id);
            
SendClientMessage(playeridGREENstring);
            
pData[playerid][pDonator] = 1;
        }        
    } else {
        
SendClientMessage(playerid,RED,"[USAGE]: /makedonator [name/id]");
        return 
1;
    }
    return 
true;

Reply
#7

Quote:
Originally Posted by Prokill911
Посмотреть сообщение
Should never do it that way in the first place.

Try..
PHP код:
CMD:makedonator(playeridparams[]) {
    new 
idstring[256];
    if(
sscanf(params"u"id)) {        
        if(
pData[playerid][pAdmin] < 4) return 0;
        if(!
IsPlayerConnected(id)) {
            
SendClientMessage(playeridRED"Player not found.");
            return 
1;
        } else {
            
PlayerPlaySound(id,1085,0.0,0.0,0.0);
            
format(stringsizeof(string), "{009BFF}You have give %s (%d) Donator Player level"GetName(id), id);
            
SendClientMessage(playeridGREENstring);
            
pData[playerid][pDonator] = 1;
        }        
    } else {
        
SendClientMessage(playerid,RED,"[USAGE]: /makedonator [name/id]");
        return 
1;
    }
    return 
true;

What makes the way you're writing it better than the way he's writing it(apart from the issue that was already addressed twice, along with an explanation of why it happens)? His is far cleaner and easier to read.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)