31.08.2009, 07:30
could someone help me coz i need a /makeadmin command and a / heal command
so evan if you do one i dont care i just need some help
so evan if you do one i dont care i just need some help
Originally Posted by sggassasin
could someone help me coz i need a /makeadmin command and a / heal command
so evan if you do one i dont care i just need some help |
if(strcmp(cmd, "/heal", true) == 0) { if(IsPlayerConnected(playerid)) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /heal [playerid/PartOfName]"); return 1; } new playa; playa = ReturnUser(tmp); if(IsPlayerConnected(playa)) { if(playa != INVALID_PLAYER_ID) { SetPlayerHealth(playa,100.0); format(string, sizeof(string), "You have been healed to 100 health."); SendClientMessage(playa, TEAM_GREEN_COLOR,string); } } } return 1; }
Originally Posted by sggassasin
im not asking for a script im asking for help way difrent + othing gets done on that script
|
Originally Posted by MenaceX^
Quote:
|
if(strcmp(cmdtext, "/makeadmin", true) == 0) { new string[128]; new tmp[256]; new player[MAX_PLAYER_NAME]; new giveplayerid; if(PlayerInfo[playerid][pAdmin] <= 5) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, 0xFFFF00AA, "USAGE: /makeadmin [playerid] [level]"); SendClientMessage(playerid, 0xFFFF00AA, "FUNCTION: Player will be an admin."); return 1; } giveplayerid = ReturnUser(tmp); tmp = strtok(cmdtext, idx); new level = strval(tmp); if(giveplayerid != INVALID_PLAYER_ID) { GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer)); GetPlayerName(playerid, player, sizeof(player)); PlayerInfo[playerid][pAdmin] = level; printf("Admin %s made %s a level %d admin.", player, giveplayer, level); format(string, sizeof(string), "You are now an administrator level %d thanks to %s.", level, player); SendClientMessage(giveplayerid, 0x00C2ECFF, string); format(string, sizeof(string), "You have given %s level %d admin.", giveplayer,PlayerInfo[giveplayerid][pAdmin]); SendClientMessage(playerid, 0x00C2ECFF, string); } else if(giveplayerid == INVALID_PLAYER_ID) { format(string, sizeof(string), "%i is not an active player.", giveplayerid); SendClientMessage(playerid, 0xE60000FF, string); } } else { SendClientMessage(playerid, 0xE60000FF, "You are not a lead admin!"); } return 1; }
public OnPlayerCommandText(playerid, cmdtext[])
{
dcmd(makeadmin, 9, cmdtext);
return 0;
}
dcmd_makeadmin(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] != 5) return SendClientMessage(playerid, color, "Sorry, You need to be a level 5 admin to use this command");
new id, level;
if(sscanf(params, "ui", id, level)) return SendClientMessage(playerid, color, "USAGE: /makeadmin [playerid] [level]");
else if (id == INVALID_PLAYER_ID) return SendClientMessage(playerid, color, "Player not found");
else if ((level < 1) || (level > 5)) return SendClientMessage(playerid, color, "The admin level can't be bigger then 5 and smaller then 1");
else
{
PlayerInfo[id][pAdmin] = level;
SendClientMessage(playerid, color, "Player became admin");
}
return 1;
}
PlayerInfo[playerid][pAdmin] = level;
PlayerInfo[giveplayerid][pAdmin] = level;