/setkills
#1

Seriously, I have no idea what's wrong with this command... It IS working, but showing something wrong (ClientMessage).
It sets the kills to the amount I want but says:

''Adminstrator [UF]DarkPhoenix has set your kills to 1'' when I set it to 500.

pawn Код:
dcmd_setkills(playerid, params[])
{
  if(pInfo[playerid][pAdmin] < 5) return SystemMessage(playerid, "You are not an Administrator with the required level.");
  new amount, str[128];
  if(sscanf(params, "ud", giveplayerid, amount)) return SystemMessage(playerid, "[USAGE] ''/setkills [playername/id] [amount]''.");
  if(!IsPlayerConnected(giveplayerid)) return SystemMessage(playerid, "This player is not active.");
    if(amount < 0) return SystemMessage(playerid, "Invalid amount!");
    GetName(giveplayerid, playername);
    GetName(playerid, adminname);
    pInfo[giveplayerid][pKills] = amount;
    SetPlayerScore(giveplayerid, amount);
    format(str, sizeof(str), "Administrator %s has set your kills to %d", adminname, playerid, amount);
    SystemMessage(giveplayerid, str);
    format(str, sizeof(str), "You have set %s's kills to %d", playername, giveplayerid, amount);
    SystemMessage(playerid, str);
    return 1;
}
Reply
#2

i dont exactly know but did u tried %s instead %d or %f ? if no then try it
Reply
#3

your format is getting 2 variables, you gave it 3...
Код:
	format(str, sizeof(str), "Administrator %s has set your kills to %d", adminname, amount);
or
Код:
	format(str, sizeof(str), "Administrator (%d) %s has set your kills to %d", playerid, adminname, amount);
and the next line
Код:
	format(str, sizeof(str), "You have set %s's kills to %d", playername, amount);
or
Код:
	format(str, sizeof(str), "You have set (%d) %s's kills to %d", giveplayerid, playername, amount);
so your kills' score was really the players' ID (1 here) ^^
Reply
#4

Quote:
Originally Posted by _Saif_
i dont exactly know but did u tried %s instead %d or %f ? if no then try it
Not working.

Quote:
Originally Posted by Babul
your format is getting 2 variables, you gave it 3...
Код:
	format(str, sizeof(str), "Administrator %s has set your kills to %d", adminname, amount);
or
Код:
	format(str, sizeof(str), "Administrator (%d) %s has set your kills to %d", playerid, adminname, amount);
and the next line
Код:
	format(str, sizeof(str), "You have set %s's kills to %d", playername, amount);
or
Код:
	format(str, sizeof(str), "You have set (%d) %s's kills to %d", giveplayerid, playername, amount);
so your kills' score was really the players' ID (1 here) ^^
Works, thank you.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)