Major issue - Giveplayerid is always invalid.
#1

Everytime I try use a command it says "that player is not connected" - Obviously when they are. Before it worked, it's stopped. What are the usual causes of this?
Reply
#2

Show some script please, without your script we can't give any answer!
Reply
#3

Which part would you like? It's just I would like to see common problems, that'll help me narrow it down.
Reply
#4

Quote:
Originally Posted by Dokins
Посмотреть сообщение
Which part would you like? It's just I would like to see common problems, that'll help me narrow it down.
These are not common - show a command where it happens.
Reply
#5

Alright.
This ALWAYS worked.

pawn Код:
CMD:kick(playerid, params[])
{
    if(LoggedIn[playerid] == 0) return SendClientMessage(playerid, COLOUR_GREY, "You must be logged in to use this command.");
   
    new reason[128], giveplayerid;
    if(AdminLevel[playerid] < 1) return SendClientMessage(playerid, COLOUR_GREY, "You are not authorized to use this command.");
    if(sscanf(params, "us[128]", giveplayerid, reason)) return SendClientMessage(playerid, COLOUR_GREY, "Usage: /kick [player id] [reason]");
    if(giveplayerid == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOUR_GREY, "That player is not connected.");
   
    format(reason, sizeof(reason), "Admin %s Kicked %s [Reason: %s ]", GetNameEx(playerid), GetNameEx(giveplayerid), reason);
    SendClientMessageToAll(COLOUR_REALRED, reason);
    Kick(giveplayerid);
    return 1;
}
Reply
#6

pawn Код:
if(giveplayerid == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOUR_GREY, "That player is not connected.");
It's better to check with IsPlayerConnected
pawn Код:
if(!IsPlayerConnected(giveplayerid)) return SendClientMessage(playerid, COLOUR_GREY, "That player is not connected.");
Reply
#7

I've actually found the issue..... It's if the player is ID 0 any command will not work. Although after I added something it's stopped working. But these things cannot really affect it.

I'll show you them.
Reply
#8

Command 1.

pawn Код:
CMD:armour(playerid, params[])
{
    if(LoggedIn[playerid] == 0) return SendClientMessage(playerid, COLOUR_GREY, "You must be logged in to use this command.");
    if(IsPlayerInRangeOfPoint(playerid, 5,962.6015, 2101.4980, 1011.0267) && Faction[playerid] == 3 || IsPlayerInRangeOfPoint(playerid, 5, 321.1703,308.9879,999.1484) && Faction[playerid] == 1)
    {
        ShowPlayerDialog(playerid, DIALOG_ARMOUR, DIALOG_STYLE_LIST, "Armour Selection(Also provides health.)", "Standard Armour\nKevlar Vest(Increased Protection)\nHealth\n", "Select", "Cancel");
    }
    return 1;
}
Command 2.
pawn Код:
CMD:removevest(playerid, params[])
{
    if(LoggedIn[playerid] == 0) return SendClientMessage(playerid, COLOUR_GREY, "You must be logged in to use this command.");
    if(!IsPlayerAttachedObjectSlotUsed(playerid, 0))return SendClientMessage(playerid, COLOUR_GREY, "You do not have a Kevlar Vest attached.");

    RemovePlayerAttachedObject(playerid, 0);
    SetPlayerArmour(playerid, 0);
    SendClientMessage(playerid, COLOUR_BLUE, "Kevlar Vest removed.");
    return 1;
}
DIALOG
pawn Код:
else if(dialogid == DIALOG_ARMOUR)
                {
            if(response == 0)
                {
                    return 1;
                }
            if(listitem == 0)
                {
                    SetPlayerArmour(playerid, 100.0);
                    SendClientMessage(playerid, COLOUR_BLUE, "Standard Armour Retrieved.");
                }
                if(listitem == 1)
                {
                    SetPlayerAttachedObject(playerid,0,19142,1,0.10,0.03,0.00,-1.0,-3.0,2.0,0.93,1.23,1.18);
                    SetPlayerArmour(playerid, 150.0);
                    SendClientMessage(playerid, COLOUR_BLUE, "Kevlar Vest Retrieved, Armour Protection has increased.");

                }
                if(listitem == 2)
                {
                    SetPlayerHealth(playerid, 100.0);
                    SendClientMessage(playerid, COLOUR_BLUE, "Health Restored.");
                }
            }
Reply
#9

Resolved: It was a filterscript.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)