/sethealth and string
#1

Whats wrong with this command? it jsut kilsl the player when i try to use it ingame.

Код:
CMD:sethealth(playerid, params[])
{
   if(PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playerid, 0x99333300, "You can't make your own commands smartass!");
   new PID;
   new reason[64];
   new str[128];
   new amount;
   new Playername[MAX_PLAYER_NAME], Adminname[MAX_PLAYER_NAME];
   if(sscanf(params, "u", PID, amount, reason)) return SendClientMessage(playerid, 0xFF0000C8, "USAGE: /sethealth [playerid] [amount] [reason]");
   GetPlayerName(playerid, Adminname, sizeof(Adminname));
   GetPlayerName(PID, Playername, sizeof(Playername));

   if(amount > 100) return SendClientMessage(playerid,0xFF0000FF,"Max 100!");//Available levels
   if(!IsPlayerConnected(PID))
       return SendClientMessage(playerid, 0xFF0000C8, "Player is not Connected!");

   format(str,sizeof(str),"%s health have been sat to %s by Admin %s. Reason: %s", Playername, amount, Adminname, reason);
   SendClientMessageToAll(0xFF0000C8, str);
   SetPlayerHealth(PID, amount);
   SendClientMessage(PID, 0xFF000000,"An admin changed you health!");
   return 1;
}
and this string dont work:

Код:
CMD:stats(playerid, params[])
{
   	new string[200];
    format(string, sizeof(string), "Name: %s ", playerid);
    SendClientMessage(playerid ,0xFF0000C8, string);
    format(string, sizeof(string), "Total Kills: %s ", PlayerInfo[playerid][pKills]);
    SendClientMessage(playerid ,0xFF0000C8, string);
    format(string, sizeof(string), "Total Deaths: %s ", PlayerInfo[playerid][pDeaths]);
    SendClientMessage(playerid ,0xFF0000C8, string);
    format(string, sizeof(string), "9mm kills: %s ", PlayerInfo[playerid][p9mm]);
    SendClientMessage(playerid ,0xFF0000C8, string);
    return 1;
}
any help? There is no errors in the script.
Reply
#2

pawn Код:
CMD:sethealth(playerid, params[])
{
   if(PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playerid, 0x99333300, "You can't make your own commands smartass!");
   new PID, reason[64], amount;
   new Playername[MAX_PLAYER_NAME], Adminname[MAX_PLAYER_NAME];
   if(sscanf(params, "uis(No Reason)", PID, amount, reason)) return SendClientMessage(playerid, 0xFF0000C8, "USAGE: /sethealth [playerid] [amount] [reason]");
   GetPlayerName(playerid, Adminname, sizeof(Adminname));
   GetPlayerName(PID, Playername, sizeof(Playername));
   if(amount > 100 || amount < 0) return SendClientMessage(playerid,0xFF0000FF,"Amount must be between 0 and 100.");//Available levels
   if(!IsPlayerConnected(PID)) return SendClientMessage(playerid, 0xFF0000C8, "Player is not Connected!");
   new str[150];
   format(str,sizeof(str),"%s's health was set to %d by Admin %s. Reason: %s", Playername, amount, Adminname, reason);
   SendClientMessageToAll(0xFF0000C8, str);
   SetPlayerHealth(PID, amount);
   SendClientMessage(PID, 0xFF000000,"An admin changed your health!");
   return 1;
}
String:
pawn Код:
CMD:stats(playerid, params[])
{
    new string[200];
    new PlayersName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, PlayersName, MAX_PLAYER_NAME);
    format(string, sizeof(string), "Name: %s ", PlayersName);
    SendClientMessage(playerid ,0xFF0000C8, string);
    format(string, sizeof(string), "Total Kills: %d ", PlayerInfo[playerid][pKills]);
    SendClientMessage(playerid ,0xFF0000C8, string);
    format(string, sizeof(string), "Total Deaths: %d ", PlayerInfo[playerid][pDeaths]);
    SendClientMessage(playerid ,0xFF0000C8, string);
    format(string, sizeof(string), "9mm kills: %d ", PlayerInfo[playerid][p9mm]);
    SendClientMessage(playerid ,0xFF0000C8, string);
    return 1;
}
Reply
#3

got 3 more cmds i need help with. This:


pawn Код:
CMD:giveweapon(playerid, params[])
{
   if(PlayerInfo[playerid][pAdmin] < 3) return SendClientMessage(playerid, 0x99333300, "You can't make your own commands smartass!");
   new PID, reason[64], ammo, weaponid;
   new Playername[MAX_PLAYER_NAME], Adminname[MAX_PLAYER_NAME];

   if(sscanf(params, "uis(No Reason)", PID, weaponid, ammo, reason)) return SendClientMessage(playerid, 0xFF0000C8, "USAGE: /giveweapon [playerid] [weaponid] [ammo] [reason]");

   GetPlayerName(playerid, Adminname, sizeof(Adminname));
   GetPlayerName(PID, Playername, sizeof(Playername));

   if(!IsPlayerConnected(PID)) return SendClientMessage(playerid, 0xFF0000C8, "Player is not Connected!");

   new str[150];
   format(str,sizeof(str),"%s's got a weapon from Admin %s (ID %s. Ammo: %s)Reason: %s", Playername,Adminname, weaponid, ammo, reason);
   SendClientMessageToAll(0xFF0000C8, str);
   GivePlayerWeapon(PID, weaponid, ammo);
   SendClientMessage(PID, 0xFF000000,"An admin changed your kills!");
   return 1;
}
CMD:setmod(playerid, params[])
{
   if(PlayerInfo[playerid][pAdmin] < 4) return SendClientMessage(playerid, 0x99333300, "You can't make your own commands smartass!");
   new PID;
   new str[128];
   new Playername[MAX_PLAYER_NAME], Adminname[MAX_PLAYER_NAME];
   if(sscanf(params, "u", PID)) return SendClientMessage(playerid, 0xFF0000C8, "USAGE: /setmod [playerid]");
   GetPlayerName(playerid, Adminname, sizeof(Adminname));
   GetPlayerName(PID, Playername, sizeof(Playername));

   if(PlayerInfo[PID][pAdmin] == 1) return SendClientMessage(playerid,0xFF0000FF, "That person is already moderator!");

   if(!IsPlayerConnected(PID))
       return SendClientMessage(playerid, 0xFF0000C8, "Player is not Connected!");

   format(str,sizeof(str),"Owner %s made %s moderator. (Level: 1)", Adminname, Playername);
   SendClientMessageToAll(0xFF0000C8, str);
   PlayerInfo[PID][pAdmin] = 1;
   SendClientMessage(PID, 0xFF000000,"You have been made an moderator!");
   return 1;
}
CMD:freeze(playerid, params[])
{
   if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid, 0x99333300, "You can't make your own commands smartass!");
   new PID, reason[64];
   new Playername[MAX_PLAYER_NAME], Adminname[MAX_PLAYER_NAME];

   if(sscanf(params, "uis(No Reason)", PID, reason)) return SendClientMessage(playerid, 0xFF0000C8, "USAGE: /freeze [playerid] [reason]");

   GetPlayerName(playerid, Adminname, sizeof(Adminname));
   GetPlayerName(PID, Playername, sizeof(Playername));

   if(!IsPlayerConnected(PID)) return SendClientMessage(playerid, 0xFF0000C8, "Player is not Connected!");

   new str[150];
   format(str,sizeof(str),"%s have been freezed by Admin %s. Reason: %s", Playername, Adminname, reason);
   SendClientMessageToAll(0xFF0000C8, str);
   TogglePlayerControllable(PID, 0);
   SendClientMessage(PID, 0xFF000000,"An admin freezed you!");
   return 1;
}
Reply
#4

pawn Код:
CMD:giveweapon(playerid, params[])
{
   if(PlayerInfo[playerid][pAdmin] < 3) return SendClientMessage(playerid, 0x99333300, "You can't make your own commands smartass!");
   new PID, reason[64], ammo, weaponid;
   new Playername[MAX_PLAYER_NAME], Adminname[MAX_PLAYER_NAME];

   if(sscanf(params, "udds(No Reason)", PID, weaponid, ammo, reason)) return SendClientMessage(playerid, 0xFF0000C8, "USAGE: /giveweapon [playerid] [weaponid] [ammo] [reason]");

   GetPlayerName(playerid, Adminname, sizeof(Adminname));
   GetPlayerName(PID, Playername, sizeof(Playername));

   if(!IsPlayerConnected(PID)) return SendClientMessage(playerid, 0xFF0000C8, "Player is not Connected!");

   new str[150];
   format(str,sizeof(str),"%s's got a weapon from Admin %s (ID %s. Ammo: %s)Reason: %s", Playername,Adminname, weaponid, ammo, reason);
   SendClientMessageToAll(0xFF0000C8, str);
   GivePlayerWeapon(PID, weaponid, ammo);
   SendClientMessage(PID, 0xFF000000,"An admin changed your kills!");
   return 1;
}


CMD:freeze(playerid, params[])
{
   if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid, 0x99333300, "You can't make your own commands smartass!");
   new PID, reason[64];
   new Playername[MAX_PLAYER_NAME], Adminname[MAX_PLAYER_NAME];

   if(sscanf(params, "us(No Reason)", PID, reason)) return SendClientMessage(playerid, 0xFF0000C8, "USAGE: /freeze [playerid] [reason]");

   GetPlayerName(playerid, Adminname, sizeof(Adminname));
   GetPlayerName(PID, Playername, sizeof(Playername));

   if(!IsPlayerConnected(PID)) return SendClientMessage(playerid, 0xFF0000C8, "Player is not Connected!");

   new str[150];
   format(str,sizeof(str),"%s have been freezed by Admin %s. Reason: %s", Playername, Adminname, reason);
   SendClientMessageToAll(0xFF0000C8, str);
   TogglePlayerControllable(PID, 0);
   SendClientMessage(PID, 0xFF000000,"An admin freezed you!");
   return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)