Help How This?
#1

Код:
	if(strcmp(cmd, "/setarmour", true) == 0 && PlayerAdminLevel[playerid] >= 1) // Gives a player money
	{
    tmp = strtok(cmdtext, idx);
    if(!strlen(tmp)) {
    SendClientMessage(playerid, COLOR_ERROR, "USAGE: /setarmour (id) (amount)");
    return 1;
    }
    if(!IsNumeric(tmp)) {
    SendClientMessage(playerid, COLOR_ERROR, "USAGE: /setarmour (id) (amount) ID Must be a number");
    return 1;
    }
    giveplayerid = strval(tmp);
    if(!IsPlayerConnected(giveplayerid)) {
    format(string, sizeof(string), "ID (%d) is not an active player", giveplayerid);
    SendClientMessage(playerid, COLOR_ERROR, string);
    return 1;
    }
    new sendername[24];
    new receivername[24];
    GetPlayerName(playerid,sendername, 24);
	GetPlayerName(giveplayerid,receivername, 24);
    tmp = strtok(cmdtext, idx);
    if(!strlen(tmp)) {
    SendClientMessage(playerid, COLOR_ERROR, "USAGE: /setarmour (id) (amount)");
    return 1;
    }
    if(!IsNumeric(tmp)) {
    SendClientMessage(playerid, COLOR_ERROR, "USAGE: /setarmour (id) (amount) Amount 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;
    }
    new s[128];
    new pname[24];
    GetPlayerName(giveplayerid,pname,24);
    new armour = strval(tmp);
    SetPlayerArmour(giveplayerid,armour);
    if(armour < 0 || armour > 100)return SendClientMessage(playerid,COLOR_ERROR,"Armour Cant Be Less Than 0 And More Than 100");
	format(string, sizeof(string), "Server %s Has Set Your Armour To %d",AdminRanks[PlayerAdminLevel[playerid]],armour);
    SendClientMessage(giveplayerid,0xB22222AA, string);
    format(s, sizeof(s),"You Have Set %s(%d) Armour To %d", pname,giveplayerid,armour);
    SendClientMessage(giveplayerid,COLOR_RED,s);
    return 1;
    }
i have make this command it work no error in command but the error is i have but this
Код:
    if(armour < 0 || armour > 100)return SendClientMessage(playerid,COLOR_ERROR,"Armour Cant Be Less Than 0 And More Than 100");
when i go in game and type /setarmour 0 500 its say --> Armour Cant Be Less Than 0 And More Than 100 but its give me 500 armour how this help
Reply
#2

Replace

Код:
    new s[128];
    new pname[24];
    GetPlayerName(giveplayerid,pname,24);
    new armour = strval(tmp);
    SetPlayerArmour(giveplayerid,armour);
    if(armour < 0 || armour > 100)return SendClientMessage(playerid,COLOR_ERROR,"Armour Cant Be Less Than 0 And More Than 100");
	format(string, sizeof(string), "Server %s Has Set Your Armour To %d",AdminRanks[PlayerAdminLevel[playerid]],armour);
    SendClientMessage(giveplayerid,0xB22222AA, string);
    format(s, sizeof(s),"You Have Set %s(%d) Armour To %d", pname,giveplayerid,armour);
    SendClientMessage(giveplayerid,COLOR_RED,s);
with

Код:
    new s[128];
    new pname[24];
    GetPlayerName(giveplayerid,pname,24);
    new armour = strval(tmp);
    if(armour < 0 || armour > 100)
    {
    SendClientMessage(playerid, COLOR_ERROR, "Armour can't be less then 0 or more then 100.");
    }
    else
    {
    SetPlayerArmour(giveplayerid,armour);
	format(string, sizeof(string), "Server %s Has Set Your Armour To %d",AdminRanks[PlayerAdminLevel[playerid]],armour);
    SendClientMessage(giveplayerid,0xB22222AA, string);
    format(s, sizeof(s),"You Have Set %s(%d) Armour To %d", pname,giveplayerid,armour);
    SendClientMessage(giveplayerid,COLOR_RED,s);
    }
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)