[HElp] /sethealth, /setarmour - 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: [HElp] /sethealth, /setarmour (
/showthread.php?tid=264877)
[HElp] /sethealth, /setarmour -
[Lsgw]LoL - 28.06.2011
Code:
if(strcmp(cmd, "/sethealth", true) == 0 && PlayerAdminLevel[playerid] >= 1) // Blow A Player Up In A Car
{
tmp = strtok(cmdtext, idx);
new health = strval(tmp);
new s[128];
new pname[24];
new uname[24];
GetPlayerName(giveplayerid, pname, 24);
GetPlayerName(playerid,uname,24);
if(!strlen(tmp)) {
SendClientMessage(playerid, COLOR_ERROR, "USAGE: /sethealth (id) (ammount)");
return 1;
}
if(health < 0) {
SendClientMessage(playerid, COLOR_ERROR, "Health Cant Be Less Than 0");
return 1;
}
if(health > 100) {
SendClientMessage(playerid, COLOR_ERROR, "Health Cant Be More Than 100");
return 1;
}
giveplayerid = strval(tmp);
if(!IsNumeric(tmp)) {
SendClientMessage(playerid, COLOR_ERROR, "USAGE: /sethealth (id) (ammount) ID Must be a number");
return 1;
}
if(!IsPlayerConnected(giveplayerid)) {
format(string, sizeof(string), "ID (%d) Is not an active player",giveplayerid);
SendClientMessage(playerid, COLOR_ERROR, string);
return 1;
}
format(string, sizeof(string), "Server %s Has Set Your Health To %d",AdminRanks[PlayerAdminLevel[playerid]],health);
SendClientMessageToAll(0xB22222AA, string);
format(s, sizeof(s),"You Have Set %s(%d) Health To %d", pname,giveplayerid,health);
SendClientMessage(giveplayerid,COLOR_RED,s);
SetPlayerHealth(giveplayerid,health);
return 1;
}
Code:
if(strcmp(cmd, "/setarmour", true) == 0 && PlayerAdminLevel[playerid] >= 1) // Blow A Player Up In A Car
{
tmp = strtok(cmdtext, idx);
new armour = strval(tmp);
new s[128];
new pname[24];
new uname[24];
GetPlayerName(giveplayerid, pname, 24);
GetPlayerName(playerid,uname,24);
if(!strlen(tmp)) {
SendClientMessage(playerid, COLOR_ERROR, "USAGE: /setarmour (id) (ammount)");
return 1;
}
if(armour < 0) {
SendClientMessage(playerid, COLOR_ERROR, "Armour Cant Be Less Than 0");
return 1;
}
if(armour > 100) {
SendClientMessage(playerid, COLOR_ERROR, "Armour Cant Be More Than 100");
return 1;
}
giveplayerid = strval(tmp);
if(!IsNumeric(tmp)) {
SendClientMessage(playerid, COLOR_ERROR, "USAGE: /setarmour (id) (ammount) ID Must be a number");
return 1;
}
if(!IsPlayerConnected(giveplayerid)) {
format(string, sizeof(string), "ID (%d) Is not an active player",giveplayerid);
SendClientMessage(playerid, COLOR_ERROR, string);
return 1;
}
format(string, sizeof(string), "Server %s Has Set Your Armour To %d",AdminRanks[PlayerAdminLevel[playerid]],armour);
SendClientMessageToAll(0xB22222AA, string);
format(s, sizeof(s),"You Have Set %s(%d) Armour To %d", pname,giveplayerid,armour);
SendClientMessage(giveplayerid,COLOR_RED,s);
SetPlayerArmour(giveplayerid,armour);
return 1;
}
help when i try to go ingame and type /sethealth 0 100 at give me 0 health and i die in game help how to fix /setarmour same as /sethealth just give me 0 armour
Re: [HElp] /sethealth, /setarmour -
Jack Shred - 28.06.2011
Code:
if(strcmp(cmd, "/sethealth", true) == 0)
{
if(PlayerAdminLevel[playerid] >= 1) // Blow A Player Up In A Car
{
tmp = strtok(cmdtext, idx);
new health = strval(tmp);
new s[128];
new pname[24];
new uname[24];
GetPlayerName(giveplayerid, pname, 24);
GetPlayerName(playerid,uname,24);
if(!strlen(tmp)) {
SendClientMessage(playerid, COLOR_ERROR, "USAGE: /sethealth (id) (amount)");
return 1;
}
if(health < 0) {
SendClientMessage(playerid, COLOR_ERROR, "Health Cant Be Less Than 0");
return 1;
}
if(health > 100) {
SendClientMessage(playerid, COLOR_ERROR, "Health Cant Be More Than 100");
return 1;
}
giveplayerid = strval(tmp);
if(!IsNumeric(tmp)) {
SendClientMessage(playerid, COLOR_ERROR, "USAGE: /sethealth (id) (amount) ID Must be a number");
return 1;
}
if(!IsPlayerConnected(giveplayerid)) {
format(string, sizeof(string), "ID (%d) Is not an active player",giveplayerid);
SendClientMessage(playerid, COLOR_ERROR, string);
return 1;
}
format(string, sizeof(string), "Server %s Has Set Your Health To %d",AdminRanks[PlayerAdminLevel[playerid]],health);
SendClientMessageToAll(0xB22222AA, string);
format(s, sizeof(s),"You Have Set %s(%d) Health To %d", pname,giveplayerid,health);
SendClientMessage(giveplayerid,COLOR_RED,s);
SetPlayerHealth(giveplayerid,health);
return 1;
}
}
Try this, not sure if it'll fix it.