Posts: 288
Threads: 2
Joined: Sep 2009
pawn Code:
new Float:DuelHealth;
new Float:DuelArmor;
if(dialogid == DIALOG_DUEL3)
{
if(response)
{
new Float:health = strlen(inputtext);
DuelHealth = health;
NewSettings(playerid);
SendClientMessage(playerid, COLOR_WHITE, " ** You have set the Health ");
}
}
if(dialogid == DIALOG_DUEL3)
{
if(response)
{
new Float:armor= strlen(inputtext);
DuelHealth = armor;
NewSettings(playerid);
SendClientMessage(playerid, COLOR_WHITE, " ** You have set the Armor");
}
}
forward NewSettings(playerid);
public NewSettings(playerid)
{
SetPlayerHealth(playerid, DuelHealth);
SetPlayerArmour(playerid, DuelArmor);
}
https://sampwiki.blast.hk/wiki/Scripting_Basics#Functions
Posts: 937
Threads: 106
Joined: Jan 2010
Reputation:
0
Wrong.
It sets my HP to like 1 as-well as armor.
When I put any value into the Input box.
The only way I can have it as 100, is if I skip Health / Armor.
Because it sets it to 100 Auto if that step is skipped.
Removed the Float: and added = 100;
new DuelHealth = 100;
new DuelArmor = 100;
Posts: 2,629
Threads: 40
Joined: Mar 2008
Reputation:
0
Both of the dialogs have the same ID, I don't know how you are trying to work it but, that's obviously not going to work. Also, if you have it for more than one person? How is the variables going to save properly? Use Player Variables, they are probably the best for this situation. Also, player armour and health is not a integer, it's a Float.
Posts: 937
Threads: 106
Joined: Jan 2010
Reputation:
0
Dialogs are not the Same ID, I just didn't change it when typing the code on here.
EDIT: Fixed, Forgot the main DuelHealth to make it a Float.xD
Thanks !