SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Help Archive

 
 
Thread Tools Display Modes
Old 28/06/2011, 09:17 AM   #1
[Lsgw]LoL
Little Clucker
 
Join Date: May 2011
Posts: 28
Reputation: 0
Default [HElp] /sethealth, /setarmour

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
[Lsgw]LoL is offline  
Old 28/06/2011, 12:49 PM   #2
Jack Shred
Big Clucker
 
Join Date: Oct 2010
Posts: 78
Reputation: 5
Default Re: [HElp] /sethealth, /setarmour

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.
Jack Shred is offline  
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
help with /sethealth mrcoolballs Help Archive 2 22/08/2010 04:35 PM


All times are GMT. The time now is 11:52 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.