#1

I've made a set health command but when I set my own health or someone's else's it sets it only to 1 hp.

What I've done wrong?

Код:
CMD:sethp(playerid, params[])
{
    if(connected[playerid] == true) return GameTextForPlayer(playerid, "~r~Spawn First", 5000, 5);
    if(pInfo[playerid][Admin] < 1) return SendClientMessage(playerid, -1, "{C3C3C3}(INFO) You don't have the priviliges to use this command.");
	new target, str[128], name[MAX_PLAYER_NAME],Float:hp;
	if(!IsPlayerConnected(target)) return SendClientMessage(playerid, -1, "{c3c3c3}(INFO) That player is not connected!");
	if(sscanf(params, "ud", target, hp)) return SendClientMessage(playerid, -1, "{c3c3c3}(INFO) /sethp [id] [amount]");
	GetPlayerName(target, name, sizeof(name));
	format(str, sizeof(str), "{EFB509}(INFO) You have set %s's health to %d", name, hp);
	SendClientMessage(playerid, -1, str);
	format(str, sizeof(str), "{EFB509}An admin has set your hp to %d", hp);
	SendClientMessage(target, -1, str);
	SetPlayerHealth(target, hp);
	return 1;
}
Reply
#2

try this

PHP код:
if(sscanf(params"ui"targethp)) 
Reply
#3

dont need to use float.
remove new Float:hp from the code and just left new hp;
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)