Give Kills All command isnt working as well
#1

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;
}
Reply
#2

PHP код:
CMD:givekillsall(playeridparams[]) {

    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 || KillsNum 2000) return SendClientMessage(playerid,Red,".ма рйъп мъъ йеъш о200 дшйвеъ млм дщшъ");

    foreach(new 
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(llBlueString);
    
TextDrawHideForPlayer(playeridClickHard);
    return 
1;

Reply
#3

Quote:
Originally Posted by oMa37
Посмотреть сообщение
PHP код:
CMD:givekillsall(playeridparams[]) {

    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 || KillsNum 2000) return SendClientMessage(playerid,Red,".ма рйъп мъъ йеъш о200 дшйвеъ млм дщшъ");

    foreach(new 
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(llBlueString);
    
TextDrawHideForPlayer(playeridClickHard);
    return 
1;

Still same problem mate
Reply
#4

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));
Reply
#5

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"
Reply
#6

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.
Reply
#7

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.
Reply
#8

Solved, Thank you for your answers.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)