Health dont get down / discreas!!!
#1

i got problem when i use this command every time all players in server get unlimited health! they dont lose health! help whats wrong!

pawn Код:
if(strcmp(cmd, "/hit", true) == 0) {
    if(IsSpawned[playerid] == 0) {
    SendClientMessage(playerid, COLOR_ERROR, "You are dead. You cannot use this command");
    return 1;
    }
    if(gTeam[playerid] == TEAM_HITMAN) {
    SendClientMessage(playerid,COLOR_ERROR,"You are a Hitman. You cannot place a Hit contract on anyone");
    return 1;
    }
    if(InDerby[playerid] == 1) {
    SendClientMessage(playerid,COLOR_ERROR,"You cannot use this command while you are in the stadium");
    return 1;
    }
    tmp = strtok(cmdtext, idx);
    if(!strlen(tmp)) {
    SendClientMessage(playerid, COLOR_ERROR, "USAGE: /hit (ID) (Amount)");
    return 1;
    }
    giveplayerid = strval(tmp);
    if(!IsNumeric(tmp)) {
    SendClientMessage(playerid, COLOR_ERROR, "USAGE: /hit (ID) (Amount) ID Must be a number");
    return 1;
    }
    if (!GetPlayersInTeam(TEAM_HITMAN)) {
    SendClientMessage(playerid,COLOR_ERROR,"There are no Hitmen online");
    return 1;
    }
    if(gTeam[giveplayerid] == TEAM_HITMAN){
    SendClientMessage(playerid,COLOR_ERROR,"You cant place a hit on hitman players!");
    return 1;
    }
    if(!IsPlayerConnected(giveplayerid)) {
    format(string, sizeof(string), "ID (%d) is not an active player", giveplayerid);
    SendClientMessage(playerid, COLOR_ERROR, string);
    return 1;
    }
    new hittername[24];
    new hiteename[24];
    GetPlayerName(playerid,hittername, 24);
    GetPlayerName(giveplayerid,hiteename, 24);
    if(IsSpawned[giveplayerid] == 0) {
    format(string, sizeof(string), "%s(%d) Is dead. You cannot place a hit contract on a dead body",hiteename,giveplayerid);
    SendClientMessage(playerid, COLOR_ERROR, string);
    return 1;
    }
    if(giveplayerid == playerid) {
    SendClientMessage(playerid, COLOR_ERROR, "You cannot put a hit contract on yourself");
    return 1;
    }
    if(HasHitOnHim[giveplayerid] >= 1) {
    format(string, sizeof(string), "%s(%d) Already has a hit contract. You cannot place a further hit contract on that player",hiteename,giveplayerid);
    SendClientMessage(playerid, COLOR_ERROR, string);
    return 1;
    }
    tmp = strtok(cmdtext, idx);
    if(!strlen(tmp)) {
    SendClientMessage(playerid, COLOR_ERROR, "USAGE: /hit (ID) (Amount)");
    return 1;
    }
    new hitmoney = strval(tmp);
    if(!IsNumeric(tmp)) {
    SendClientMessage(playerid, COLOR_ERROR, "USAGE: /hit (ID) (Amount) Amount must be a number");
    return 1;
    }
    if(hitmoney <= 6999 || hitmoney > 1000001) {
    SendClientMessage(playerid, COLOR_ERROR, "Min/Max hit contract amount is $7000 - $1000000");
    return 1;
    }
    if(GetPlayerMoney(playerid) < hitmoney) {
    format(string, sizeof(string), "You cannot afford to place a $%d hit contract on %s(%d)",hitmoney,hiteename,giveplayerid);
    SendClientMessage(playerid, COLOR_ERROR, string);
    return 1;
    }
    SendClientMessage(playerid, 0xA9A9A9AA, "|_Hit Contract Placed_|");
    format(string, sizeof(string), "You have placed a hit contract on %s(%d) for $%d",hiteename,giveplayerid,hitmoney);
    SendClientMessage(playerid, 0x00C7FFAA, string);
    SendClientMessage(giveplayerid, 0xA9A9A9AA, "|_Hit Contract Placed On You_|");
    SendClientMessage(giveplayerid, 0x00C7FFAA, "A Hit Contract has been placed on you! Watch out for hitmen.");
    GameTextForPlayer(giveplayerid, "~w~HIT CONTRACT~n~PLACED ON YOU",5000,5);
    format(string, sizeof(string), "%s(%d) has placed a hit on %s(%d) for $%d",hittername,playerid,hiteename,giveplayerid,hitmoney);
    printf("%s",string);
    HasHitOnHim[giveplayerid] =1400;
    for(new i=0;i<MAX_PLAYERS;i++)
    {
    if(gTeam[i] == TEAM_HITMAN) {
    SendClientMessage(i, 0xA9A9A9AA, "|_Hit Contract Placed_|");
    format(string, sizeof(string), "{3399FF}%s(%d) {FFFFFF}Has placed a hit contract on {3399FF}%s(%d) for $%d",hittername,playerid,hiteename,giveplayerid,hitmoney);
    SendClientMessage(i, 0x00C7FFAA, string);
    }
    }
    return 1;
    }
Reply
#2

bump any help! when i always hit someone by this command! no one in server lose health or armor!
Reply
#3

Show us the Function HasHitOnHim
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)