Give Kills All command isnt working as well -
asafasaf - 02.08.2017
Hi,
I just built a command to give kills to every one who connected, but It seems like its giving the kills only to ID 0'
and giving X2 kills more then what I wrote in the command.
the script:
Код:
CMD:givekillsall(playerid, params[])
{
if(LevelAdmin(playerid) < 20) return 0;
if(AdmLog[playerid] == false)return SendClientMessage(playerid,Red,"ERROR: айрк озебш мотшлъ агойрйн");
new KillsNum;
sscanf(params,"is[128]",KillsNum);
if(sscanf(params,"i",KillsNum)) return SendClientMessage(playerid,White,"Usage: /GiveKillsAll [Kills]");
if(KillsNum < 0 || KillsNum > 2000) return SendClientMessage(playerid,Red,".ма рйъп мъъ йеъш о200 дшйвеъ млм дщшъ");
foreach(new i: Player) if(logged[i] == true) pInfo [ i ] [ Kills ] = pInfo [ i ] [ Kills ] + KillsNum;
format(String,sizeof(String),".ръп млм дщшъ {"#C_Grey"}%s {"#C_llBlue"}дшйвеъ {"#C_Grey"}%s {"#C_llBlue"}дагойп",GetNum(KillsNum),GetName(playerid));
SendClientMessageToAll(llBlue, String);
TextDrawHideForPlayer(playerid, ClickHard);
return 1;
}
Re: Give Kills All command isnt working as well -
oMa37 - 02.08.2017
PHP код:
CMD:givekillsall(playerid, params[]) {
if(LevelAdmin(playerid) < 20) return 0;
if(AdmLog[playerid] == false) return SendClientMessage(playerid,Red,"ERROR: айрк озебш мотшлъ агойрйн");
new KillsNum;
if(sscanf(params, "i", KillsNum)) return SendClientMessage(playerid,White,"Usage: /GiveKillsAll [Kills]");
if(KillsNum < 0 || KillsNum > 2000) return SendClientMessage(playerid,Red,".ма рйъп мъъ йеъш о200 дшйвеъ млм дщшъ");
foreach(new i : Player) {
if(logged[i] == true)
pInfo[i][Kills] += KillsNum;
}
new String[94];
format(String,sizeof(String),".ръп млм дщшъ {"#C_Grey"}%s {"#C_llBlue"}дшйвеъ {"#C_Grey"}%s {"#C_llBlue"}дагойп",GetNum(KillsNum),GetName(playerid));
SendClientMessageToAll(llBlue, String);
TextDrawHideForPlayer(playerid, ClickHard);
return 1;
}
Re: Give Kills All command isnt working as well -
asafasaf - 02.08.2017
Quote:
Originally Posted by oMa37
PHP код:
CMD:givekillsall(playerid, params[]) {
if(LevelAdmin(playerid) < 20) return 0; if(AdmLog[playerid] == false) return SendClientMessage(playerid,Red,"ERROR: айрк озебш мотшлъ агойрйн");
new KillsNum; if(sscanf(params, "i", KillsNum)) return SendClientMessage(playerid,White,"Usage: /GiveKillsAll [Kills]"); if(KillsNum < 0 || KillsNum > 2000) return SendClientMessage(playerid,Red,".ма рйъп мъъ йеъш о200 дшйвеъ млм дщшъ");
foreach(new i : Player) {
if(logged[i] == true) pInfo[i][Kills] += KillsNum; }
new String[94]; format(String,sizeof(String),".ръп млм дщшъ {"#C_Grey"}%s {"#C_llBlue"}дшйвеъ {"#C_Grey"}%s {"#C_llBlue"}дагойп",GetNum(KillsNum),GetName(playerid)); SendClientMessageToAll(llBlue, String); TextDrawHideForPlayer(playerid, ClickHard); return 1; }
|
Still same problem mate
Re: Give Kills All command isnt working as well -
FailerZ - 02.08.2017
Why are you printing the number as string?
Your variable is already an integer no need for transformations
Fix the format: (I don't know if it should be vice versa but I don't understand this language)
Код:
format(String,sizeof(String),".ръп млм дщшъ {"#C_Grey"}%i{"#C_llBlue"}дшйвеъ {"#C_Grey"}%s {"#C_llBlue"}дагойп",KillsNum,GetName(playerid));
Re: Give Kills All command isnt working as well -
asafasaf - 02.08.2017
Quote:
Originally Posted by FailerZ
Why are you printing the number as string?
Your variable is already an integer no need for transformations
Fix the format: (I don't know if it should be vice versa but I don't understand this language)
Код:
format(String,sizeof(String),".ръп млм дщшъ {"#C_Grey"}%i{"#C_llBlue"}дшйвеъ {"#C_Grey"}%s {"#C_llBlue"}дагойп",KillsNum,GetName(playerid));
|
Still the same dude...
the sentence that u copied is:
"The admin %s has gave %s kills to everyone"
Re: Give Kills All command isnt working as well -
FailerZ - 02.08.2017
Quote:
Originally Posted by asafasaf
Still the same dude...
the sentence that u copied is:
"The admin %s has gave %s kills to everyone"
|
Yeah but why are you using string specifier while you are trying to print an integer?
Anyway do some debug measures to detect where the problem comes from.
Example: (Put this in the loop)
Код:
printf("Players ID %i has been given %i kills", i, KillsNum);
And see what does these print in the server logs when you use the command.
Re: Give Kills All command isnt working as well -
asafasaf - 02.08.2017
The problem is that all the given kills go to ID 0 (only for him),
for example:
There are 2 players in the server, I do the /GiveKillsAll command, /givekillsall 100,
And then, only ID 0 gets 200 kills, behave of they are both get 100 kills.
Re: Give Kills All command isnt working as well -
asafasaf - 02.08.2017
Solved, Thank you for your answers.