godmode in /whois
#1

im having problem with adding godmode in this codes. i mean like when he type /god, his account will say Godmoden (or off) i cant get it done if you dont understand what im saying i could explain some more.
here is the /god command
Код:
CMD:god(playerid, params[])
{
    new str[128];
    if(PlayerAcc[playerid][Log] == 0) return SendClientMessage(playerid, COLOR_RED, "Error: You are not logged in!");
	if(PlayerAcc[playerid][Admin] >= 3)
	{
		if(PlayerAcc[playerid][God] == 0)
		{
			SetPlayerArmour(playerid, 100.0);
			SetPlayerHealth(playerid, 5000.0);
			HealthTimer[playerid] = SetTimerEx("SetToGod", 1000, true, "d", playerid);
			format(str, sizeof(str), "Administrator %s(%d) is now on god mode!", GetName(playerid), playerid);
			SendClientMessageToAll(COLOR_LIME, str);
			GodM[playerid] = Create3DTextLabel("God Mode!", COLOR_ORANGE, 0.0, 0.0, 40.0, 20.0, 0, 1);
			Attach3DTextLabelToPlayer(GodM[playerid], playerid, 0.0, 0.0, 0.40);
			PlayerAcc[playerid][God] = 1;
		}
		else if(PlayerAcc[playerid][God] == 1)
		{
			format(str, sizeof(str), "Administrator %s(%d) is now off god mode!", GetName(playerid), playerid);
			SendClientMessageToAll(COLOR_YELLOW, str);
			Delete3DTextLabel(GodM[playerid]);
			KillTimer(HealthTimer[playerid]);
			SetPlayerHealth(playerid, 100.0);
			PlayerAcc[playerid][God] = 0;
		}
	}
	else return ErrorMessages(playerid, 7);
	return 1;
}
and the /whois command
Код:
CMD:whois(playerid, params[])
{
	new str[128], zone[MAX_ZONE_NAME], str2[128], string[128], str3[128], id;
    if(PlayerAcc[playerid][Log] == 0) return SendClientMessage(playerid, COLOR_RED, "Error: You are not logged in!");
	if(PlayerAcc[playerid][Admin] >= 1)
	{
		if(sscanf(params, "u", id)) return SendClientMessage(playerid, COLOR_RED, "Syntax: /whois (id)");
        if(id == INVALID_PLAYER_ID) return ErrorMessages(playerid, 2);
		new ip[16],
		    h, m, s,
			jail = PlayerAcc[id][Jail],
			mute = PlayerAcc[id][Mute],
			time = PlayerAcc[id][MuteTime],
			admin = PlayerAcc[id][Admin],
			vip = PlayerAcc[id][Vip],
			warn = PlayerAcc[id][Warn],
			skin = PlayerAcc[id][SaveSkin],
			wanted = GetPlayerWantedLevel(id),
			score = GetPlayerScore(id),
			money = GetPlayerMoney(id),
			kill = PlayerAcc[id][Kills],
			cookies = PlayerAcc[id][Cookies],
			death = PlayerAcc[id][Deaths];
		GetPlayerIp(id, ip, sizeof(ip));
		GetPlayer2DZone(id, zone, MAX_ZONE_NAME);
		TotalGameTime(id, h, m, s);
		switch(jail)
		{
			case 0: AdminRank = "No";
			case 1: AdminRank = "Yes";
		}
		switch(mute)
		{
			case 0: DutyStatus = "No";
			case 1: DutyStatus = "Yes";
		}
	    switch(admin)
	    {
   			case 0: Admin2 = "Player";
    		case 1: AdminRank = "Tester";
	    	case 2: AdminRank = "Co-Mod";
	    	case 3: AdminRank = "Mod";
	    	case 4: AdminRank = "Admin";
	    	case 5: AdminRank = "Leader";
	    	case 6: AdminRank = "Manager";
	    }
	    switch(vip)
	    {
			case 0: VIP = "Player";
		    case 1: VIP = "Bronze VIP";
		    case 2: VIP = "Silver VIP";
		    case 3: VIP = "Premium VIP";
	    }
		format(string, sizeof(string), "%s's Account Statistics:", GetName(id));
		SendClientMessage(playerid, COLOR_BLUE, str);
		format(str, sizeof(str), "Jail: [%s] | Mute: [%s] | Time: [%i] | Admin: [%i - %s] | Vip: [%i - %s] | Cookies: [%i]", AdminRank, DutyStatus, time, admin, Admin2, vip, VIP, cookies);
		format(str2, sizeof(str2), "Warning: [%i/%i] | WantedLvl: [%i] | Score: [%i] Money: [$%i] | Kills: [%d] | Deaths: [%d]", warn, MAX_WARNINGS, wanted, score, money, kill, death);
		format(str3, sizeof(str3), "SaveSkin: [%i] | Ratio: [%0.2f] | Location: [%s] Hours: [%i] | Minutes: [%i] | Seconds: [%i]", skin, Float:kill/Float:death, zone, h, m, s);
		SendClientMessage(playerid, COLOR_GREY, string);
		SendClientMessage(playerid, COLOR_GREY, str);
		SendClientMessage(playerid, COLOR_GREY, str2);
		SendClientMessage(playerid, COLOR_GREY, str3);
	}
	else return ErrorMessages(playerid, 1);
	return 1;
}
Reply
#2

PHP код:
CMD:god(playeridparams[])
{
    new 
str[128];
    if(
PlayerAcc[playerid][Log] == 0) return SendClientMessage(playeridCOLOR_RED"Error: You are not logged in!");
    if(
PlayerAcc[playerid][Admin] >= 3)
    {
        if(
PlayerAcc[playerid][God] == 1)
        {
            
SetPlayerArmour(playerid100.0);
            
SetPlayerHealth(playerid5000.0);
            
HealthTimer[playerid] = SetTimerEx("SetToGod"1000true"d"playerid);
            
format(strsizeof(str), "Administrator %s(%d) is now on god mode!"GetName(playerid), playerid);
            
SendClientMessageToAll(COLOR_LIMEstr);
            
GodM[playerid] = Create3DTextLabel("God Mode!"COLOR_ORANGE0.00.040.020.001);
            
Attach3DTextLabelToPlayer(GodM[playerid], playerid0.00.00.40);
            
PlayerAcc[playerid][God] = 1;
        }
        else if(
PlayerAcc[playerid][God] == 0)
        {
            
format(strsizeof(str), "Administrator %s(%d) is now off god mode!"GetName(playerid), playerid);
            
SendClientMessageToAll(COLOR_YELLOWstr);
            
Delete3DTextLabel(GodM[playerid]);
            
KillTimer(HealthTimer[playerid]);
            
SetPlayerHealth(playerid100.0);
            
PlayerAcc[playerid][God] = 0;
        }
    }
    else return 
ErrorMessages(playerid7);
    return 
1;

Reply
#3

i mean when a player type /god, and someone used /whos (id) on them, they will see Godmode: on (or off) to see if he have godmode on or off.
Reply
#4

i think you dont understand what im saying
Reply
#5

i think i should explain some more. i mean like add "Godmode: []" in this.
Quote:

format(string, sizeof(string), "%s's Account Statistics:", GetName(id));
SendClientMessage(playerid, COLOR_BLUE, str);
format(str, sizeof(str), "Jail: [%s] | Mute: [%s]| Godmode:[%i] | Time: [%i] | Admin: [%i - %s] | Vip: [%i - %s] | Cookies: [%i]", AdminRank, DutyStatus, time, admin, Admin2, vip, VIP, cookies);
format(str2, sizeof(str2), "Warning: [%i/%i] | WantedLvl: [%i] | Score: [%i] Money: [$%i] | Kills: [%d] | Deaths: [%d]", warn, MAX_WARNINGS, wanted, score, money, kill, death);
format(str3, sizeof(str3), "SaveSkin: [%i] | Ratio: [%0.2f] | Location: [%s] Hours: [%i] | Minutes: [%i] | Seconds: [%i]", skin, Float:kill/Float:death, zone, h, m, s);
SendClientMessage(playerid, COLOR_GREY, string);
SendClientMessage(playerid, COLOR_GREY, str);
SendClientMessage(playerid, COLOR_GREY, str2);
SendClientMessage(playerid, COLOR_GREY, str3);

especially when a player type /god. it would say "Godmode: on or off", when a player use /whois to his account info. i need help with this.
Reply
#6

This is probably an easier method:
pawn Код:
CMD:god(playerid, params[])
{
    if(!PlayerAcc[playerid][Log]) return SendClientMessage(playerid, COLOR_RED, "Error: You are not logged in!");
    if(PlayerAcc[playerid][Admin] < 3) return ErrorMessages(playerid, 7);
    new str[65];
    if(!PlayerAcc[playerid][God])
    {
        SetPlayerArmour(playerid, 100.0);
        SetPlayerHealth(playerid, 5000.0);
        HealthTimer[playerid] = SetTimerEx("SetToGod", 1000, true, "d", playerid);
        format(str, sizeof(str), "Administrator %s(%d) is now on god mode!", GetName(playerid), playerid);
        SendClientMessageToAll(COLOR_LIME, str);
        GodM[playerid] = Create3DTextLabel("God Mode!", COLOR_ORANGE, 0.0, 0.0, 40.0, 20.0, 0, 1);
        Attach3DTextLabelToPlayer(GodM[playerid], playerid, 0.0, 0.0, 0.40);
    }
    else
    {
        format(str, sizeof(str), "Administrator %s(%d) is now off god mode!", GetName(playerid), playerid);
        SendClientMessageToAll(COLOR_YELLOW, str);
        Delete3DTextLabel(GodM[playerid]);
        KillTimer(HealthTimer[playerid]);
        SetPlayerHealth(playerid, 100.0);
    }
    PlayerAcc[playerid][God] = (PlayerAcc[playerid][God]) ? (0) : (1);
    return 1;
}

CMD:whois(playerid, params[])
{
    if(!PlayerAcc[playerid][Log]) return SendClientMessage(playerid, COLOR_RED, "Error: You are not logged in!");
    if(PlayerAcc[playerid][Admin] < 1) return ErrorMessages(playerid, 1);
    new id;
    if(sscanf(params, "u", id)) return SendClientMessage(playerid, COLOR_RED, "Syntax: /whois (id)");
    if(!IsPlayerConnected(id) || id == INVALID_PLAYER_ID) return ErrorMessages(playerid, 2);
    new
            h, m, s,
            jail = PlayerAcc[id][Jail],
            mute = PlayerAcc[id][Mute],
            time = PlayerAcc[id][MuteTime],
            admin = PlayerAcc[id][Admin],
            vip = PlayerAcc[id][Vip],
            warn = PlayerAcc[id][Warn],
            skin = PlayerAcc[id][SaveSkin],
            wanted = GetPlayerWantedLevel(id),
            score = GetPlayerScore(id),
            money = GetPlayerMoney(id),
            kill = PlayerAcc[id][Kills],
            cookies = PlayerAcc[id][Cookies],
            death = PlayerAcc[id][Deaths],
            zone[MAX_ZONE_NAME],
            AdminRank[8],
            VIP[12],
            str[144]
    ;
    GetPlayer2DZone(id, zone, MAX_ZONE_NAME);
    TotalGameTime(id, h, m, s);
    switch(admin)
    {
        case 1: AdminRank = "Tester";
        case 2: AdminRank = "Co-Mod";
        case 3: AdminRank = "Mod";
        case 4: AdminRank = "Admin";
        case 5: AdminRank = "Leader";
        case 6: AdminRank = "Manager";
        default: AdminRank = "Player";
    }
    switch(vip)
    {
        case 1: VIP = "Bronze VIP";
        case 2: VIP = "Silver VIP";
        case 3: VIP = "Premium VIP";
        default: VIP = "Player";
    }
    format(str, sizeof(str), "%s's Account Statistics:", GetName(id));
    SendClientMessage(playerid, COLOR_BLUE, str);
    format(str, sizeof(str), "Jail: [%s] | Mute: [%s] | Time: [%i] | Admin: [%i - %s] | Vip: [%i - %s] | Cookies: [%i]", (jail) ? ("Yes") : ("No"), (mute) ? ("Yes") : ("No"), time, admin, AdminRank, vip, VIP, cookies);
    SendClientMessage(playerid, COLOR_GREY, str);
    format(str, sizeof(str), "Warning: [%i/%i] | WantedLvl: [%i] | Score: [%i] Money: [$%i] | Kills: [%d] | Deaths: [%d]", warn, MAX_WARNINGS, wanted, score, money, kill, death);
    SendClientMessage(playerid, COLOR_GREY, str);
    format(str, sizeof(str), "SaveSkin: [%i] | Ratio: [%0.2f] | Location: [%s] Hours: [%i] | Minutes: [%i] | Seconds: [%i]", skin, kill/death, zone, h, m, s);
    SendClientMessage(playerid, COLOR_GREY, str);
    return 1;
}
I'm a bit too lazy to explain right now, it's 6:30am and I'm still awake... so yeah :/
Reply
#7

hey I need help. you all might not understand me.
Reply
#8

Just check if PlayerAcc[playerid][God] returns 1 or 0. If returns 1, just make it display on or off. (The check must be done in the /whois command. I will give a example, but im not sure it will happen. It will still give you a base to work on.

CMD:whois(playerid, params[])
{

if(PlayerAcc[playerid][God] == 1)
{
SendClientMessage(playerid, blabla, "godmode on");
}
else
{
SendClientMessage(playerid, blabla, "godmode off");
}
return 1;
}

and so, with some basics you can integrate this into your code.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)