SA-MP Forums Archive
/setkills - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: /setkills (/showthread.php?tid=133947)



/setkills - Andy_McKinley - 14.03.2010

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;
}



Re: /setkills - Deat_Itself - 14.03.2010

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


Re: /setkills - Babul - 14.03.2010

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) ^^


Re: /setkills - Andy_McKinley - 14.03.2010

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.