18.02.2012, 12:46
i have 2 problems
1.) when i type /aduty it sets all admins to aduty here is the code
2.) when i type /god. setplayerhealth wont work.
Please help
1.) when i type /aduty it sets all admins to aduty here is the code
pawn Код:
CMD:admins(playerid, params[]) //credits to lamarr
{
new string[900];
new fstring[900];
new adutyrank[50];
switch(PlayerInfo[playerid][Admin])
{
case 1: AdminRank = "Moderator";
case 2: AdminRank = "Global Moderator";
case 3: AdminRank = "Administrator";
case 4: AdminRank = "Operator";
case 5: AdminRank = "Head Administrator";
case 6: AdminRank = "Mapper";
case 7: AdminRank = "Scripter";
case 8: AdminRank = "Head Scripter";
case 9: AdminRank = "Co-Owner";
case 10: AdminRank = "Server-Owner";
}
switch(IsAdminInDuty[playerid])
{
case 0: adutyrank = ""red"Playing!";
case 1: adutyrank = ""green"On Duty!";
}
for(new i=0; i<MAX_PLAYERS; i++)
{
if(PlayerInfo[i][Admin] > 0)
{
new pname[MAX_PLAYER_NAME];
GetPlayerName(i,pname, sizeof(pname));
format(fstring, sizeof(fstring),""white"%s (ID:%i) - "red"Level: "white"%i | %s | %s"white"\n", pname, i, PlayerInfo[i][Admin], AdminRank, adutyrank);
strcat(string, fstring, sizeof(string));
}
}
ShowPlayerDialog(playerid,2563,DIALOG_STYLE_MSGBOX,"Administrator Online",string,"OK","");
return 1;
}
pawn Код:
CMD:aduty(playerid, params[])
{
new string[100],pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
if(PlayerInfo[playerid][Admin] > 1)
{
if(IsAdminInDuty[playerid] == 0)
{
IsAdminInDuty[playerid] = 1;
SendClientMessage(playerid, COLOR_GREEN, "You are now in Admin Duty!");
PlayerPlaySound(playerid, 1085, 0.0, 0.0, 0.0);
GivePlayerWeapon(playerid, 22, 5000);
GivePlayerWeapon(playerid, 5, 1);
GivePlayerWeapon(playerid, 29, 5000);
SetPlayerHealth(playerid, 999999.9);
SetPlayerArmour(playerid, 999999.9);
format(string, sizeof(string), "Administrator %s(ID:%d) is now on Admin Duty!", pname, playerid);
SendClientMessageToAll(COLOR_RED, string);
}
else
{
IsAdminInDuty[playerid] = 0;
PlayerPlaySound(playerid, 1085, 0.0, 0.0, 0.0);
SendClientMessage(playerid, COLOR_RED, "You are now off Duty!");
SetPlayerHealth(playerid, 100);
SetPlayerArmour(playerid, 100);
format(string, sizeof(string), "Administrator %s(ID:%d) is now off Duty!", pname, playerid);
SendClientMessageToAll(COLOR_RED, string);
}
}
else return SendClientMessage(playerid, COLOR_RED, "You must be Administrator Level 1 or higher to use this command!");
return 1;
}
pawn Код:
CMD:god(playerid, params[])
{
new string[128],pname[MAX_PLAYERS];
GetPlayerName(playerid, pname, sizeof(pname));
if(PlayerInfo[playerid][Admin] > 1)
{
format(string, sizeof(string), "ADMIN-SPEC: %s has used /god", pname);
SentMessageToAdmins(COLOR_GREY, string);
if(GodMode[playerid] == 0)
{
GodMode[playerid] = 1;
GodTimer = SetTimer("God", 1000, true);
GivePlayerWeapon(playerid, 22, 5000);
GivePlayerWeapon(playerid, 5, 1);
GivePlayerWeapon(playerid, 29, 5000);
format(string, sizeof(string), "Administrator %s(ID:%d) has turn on his/her God Mode!", pname, playerid);
SendClientMessageToAll(COLOR_GREEN, string);
SendClientMessage(playerid, COLOR_GREEN, "| - God Mode ON! - |");
PlayerPlaySound(playerid, 1085, 0.0, 0.0, 0.0);
}
else
{
GodMode[playerid] = 0;
KillTimer(GodTimer);
SetPlayerHealth(playerid, 100.0);
SetPlayerArmour(playerid, 100.0);
format(string, sizeof(string), "Administrator %s(ID:%d) has turn off his/her God Mode!", pname, playerid);
SendClientMessageToAll(COLOR_RED, string);
SendClientMessage(playerid, COLOR_RED, "| - God Mode OFF! - |");
PlayerPlaySound(playerid, 1085, 0.0, 0.0, 0.0);
}
}
return 1;
}
pawn Код:
forward God(playerid);
public God(playerid)
{
SetPlayerHealth(playerid, 999999.9);
SetPlayerArmour(playerid, 999999.9);
return 1;
}