SA-MP Forums Archive
CMD - 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: CMD (/showthread.php?tid=580559)



CMD - STONEGOLD - 06.07.2015

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


Re: CMD - X337 - 06.07.2015

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



Re: CMD - rymax99 - 06.07.2015

Код:
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.


Re: CMD - X337 - 06.07.2015

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.


Re: CMD - STONEGOLD - 06.07.2015

Thanks x337 for code. thanks ray for explanation.


Re: CMD - Prokill911 - 06.07.2015

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;




Re: CMD - rymax99 - 06.07.2015

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.