CMD -
STONEGOLD - 06.07.2015
PHP код:
CMD:makedonator(playerid, params[])
{
new id, string[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(playerid, RED, "Player not found.");
{
PlayerPlaySound(id,1085,0.0,0.0,0.0);
format(string, sizeof(string), "{009BFF}You have give %s (%d) Donator Player level", GetName(id), id);
SendClientMessage(playerid, GREEN, string);
pData[playerid][pDonator] = 1;
}
return true;
}
Whenever i use this cmd it works fine but i get this in my logs
PHP код:
[17:43:36] sscanf warning: Format specifier does not match parameter count.
[17:43:42] sscanf warning: Format 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(playerid, params[])
{
new id, string[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(playerid, RED, "Player not found.");
{
PlayerPlaySound(id,1085,0.0,0.0,0.0);
format(string, sizeof(string), "{009BFF}You have give %s (%d) Donator Player level", GetName(id), id);
SendClientMessage(playerid, GREEN, string);
pData[playerid][pDonator] = 1;
}
return true;
}
Whenever i use this cmd it works fine but i get this in my logs
PHP код:
[17:43:36] sscanf warning: Format specifier does not match parameter count.
[17:43:42] sscanf warning: Format 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(playerid, params[]) {
new id, string[256];
if(sscanf(params, "u", id)) {
if(pData[playerid][pAdmin] < 4) return 0;
if(!IsPlayerConnected(id)) {
SendClientMessage(playerid, RED, "Player not found.");
return 1;
} else {
PlayerPlaySound(id,1085,0.0,0.0,0.0);
format(string, sizeof(string), "{009BFF}You have give %s (%d) Donator Player level", GetName(id), id);
SendClientMessage(playerid, GREEN, string);
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(playerid, params[]) {
new id, string[256];
if(sscanf(params, "u", id)) {
if(pData[playerid][pAdmin] < 4) return 0;
if(!IsPlayerConnected(id)) {
SendClientMessage(playerid, RED, "Player not found.");
return 1;
} else {
PlayerPlaySound(id,1085,0.0,0.0,0.0);
format(string, sizeof(string), "{009BFF}You have give %s (%d) Donator Player level", GetName(id), id);
SendClientMessage(playerid, GREEN, string);
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.