Not working online
#1

Hello, I have been testing my commands offline by my self and they worked but when I hosted it for my friends they don't work
e.g.
Код:
CMD:akill(playerid, params[])
{
	if(Player_Data[playerid][Adminlevel] >=4)
	{
		if(sscanf(params, "u[50]", pid)) return SCM(playerid, GREY, "[SERVER]: /akill [playerid/name]");
		{
			if(pid != INVALID_PLAYER_ID)
			{
				if(Player_Data[playerid][Adminlevel] < Player_Data[pid][Adminlevel]) return SCM(playerid, RED, "You can't akill an admin with a higher level than you.");
				format(string2, sizeof(string2), "Admin %s has akilled %s.", PlayerName(playerid), PlayerIDName(pid));
				SCMTA(RED, string2);
				SetPlayerHealth(playerid, 0.0);
			}
			else return SCM(playerid, GREY, "That player isn't connected.");
			if(pid == playerid)
			{
				SCM(playerid, RED, "You cannot akill yourself");
			}
		}
	}
	else return SCM(playerid, GREY, UNAUTHORIZED);
	return 1;
}
If i put in values it only says the usage return :/ and doesn't do anything
please help
Reply
#2

SetPlayerHealth(playerid, 0.0);

You're setting the HP of the one who types the command to 0.0.

Also

pawn Код:
if(pid == playerid)
    return SCM(playerid, RED, "You cannot akill yourself");
Should be before the command is executed.
Reply
#3

pawn Код:
if(sscanf(params, "u[50]", pid)) return SCM(playerid, GREY, "[SERVER]: /akill [playerid/name]");
{
...
}
u do not use "else" in your condition statement.
try something like this
pawn Код:
if(sscanf(params, "u[50]", pid)) return SCM(playerid, GREY, "[SERVER]: /akill [playerid/name]");
else
{
...
}
Reply
#4

Quote:
Originally Posted by Borg
Посмотреть сообщение
pawn Код:
if(sscanf(params, "u[50]", pid)) return SCM(playerid, GREY, "[SERVER]: /akill [playerid/name]");
{
...
}
u do not use "else" in your condition statement.
try something like this
pawn Код:
if(sscanf(params, "u[50]", pid)) return SCM(playerid, GREY, "[SERVER]: /akill [playerid/name]");
else
{
...
}
The else will never be executed if return is used, because if it doesn't find the parameters it simply will stop at that point.

pawn Код:
if(sscanf(params, "u[50]", pid)) return SCM(playerid, GREY, "[SERVER]: /akill [playerid/name]");

//code
Is enough.
Reply
#5

Quote:
Originally Posted by Borg
Посмотреть сообщение
pawn Код:
if(sscanf(params, "u[50]", pid)) return SCM(playerid, GREY, "[SERVER]: /akill [playerid/name]");
{
...
}
u do not use "else" in your condition statement.
try something like this
pawn Код:
if(sscanf(params, "u[50]", pid)) return SCM(playerid, GREY, "[SERVER]: /akill [playerid/name]");
else
{
...
}
I've tried changing it to that but it still isnt working online while I test it :/
It just prints [SERVER]: /akill [playerid/name]
Reply
#6

Bump
Reply
#7

pawn Код:
CMD:akill(playerid, params[])
{
    if(Player_Data[playerid][Adminlevel] >=4)
    {
        if(sscanf(params, "u[50]", pid)) return SCM(playerid, GREY, "[SERVER]: /akill [playerid/name]");
        if(pid != playerid)
        {
            if(pid != INVALID_PLAYER_ID)
            {
                if(Player_Data[playerid][Adminlevel] < Player_Data[pid][Adminlevel]) return SCM(playerid, RED, "You can't akill an admin with a higher level than you.");
                format(string2, sizeof(string2), "Admin %s has akilled %s.", PlayerName(playerid), PlayerIDName(pid));
                SCMTA(RED, string2);
                SetPlayerHealth(pid, 0.0);
            }
            else return SCM(playerid, GREY, "That player isn't connected.");
        }
        else return SCM(playerid, RED, "You can not akill yourself");
    }
    else return SCM(playerid, GREY, UNAUTHORIZED);
    return 1;
}
Reply
#8

Quote:
Originally Posted by Don_Cage
Посмотреть сообщение
pawn Код:
CMD:akill(playerid, params[])
{
    if(Player_Data[playerid][Adminlevel] >=4)
    {
        if(sscanf(params, "u[50]", pid)) return SCM(playerid, GREY, "[SERVER]: /akill [playerid/name]");
        if(pid != playerid)
        {
            if(pid != INVALID_PLAYER_ID)
            {
                if(Player_Data[playerid][Adminlevel] < Player_Data[pid][Adminlevel]) return SCM(playerid, RED, "You can't akill an admin with a higher level than you.");
                format(string2, sizeof(string2), "Admin %s has akilled %s.", PlayerName(playerid), PlayerIDName(pid));
                SCMTA(RED, string2);
                SetPlayerHealth(pid, 0.0);
            }
            else return SCM(playerid, GREY, "That player isn't connected.");
        }
        else return SCM(playerid, RED, "You can not akill yourself");
    }
    else return SCM(playerid, GREY, UNAUTHORIZED);
    return 1;
}
Thanks man, worked perfect 1+ Rep
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)