[HElp] /sethealth, /setarmour
#1

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
Reply
#2

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)