SA-MP Forums Archive
Wired problem in zcmd.. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Wired problem in zcmd.. (/showthread.php?tid=472734)



SOLVED - [D]ry[D]esert - 30.10.2013

SOLVED-


Re: Wired problem in zcmd.. - iggy1 - 30.10.2013

I think you need to use OnPlayerCommandRecieved. Returning 0 there will prevent the command from being performed.


Re: Wired problem in zcmd.. - Patrick - 30.10.2013

I never had a problem with this using zcmd seems wierd, at least try this

pawn Код:
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
    new string[60]; //Name + the Message
    if(!success) return format(string, sizeof(string), "(%s) Invalid Server Command", cmdtext), SendClientMessage(playerid, -1, string);
    if(!LoggedIn[playerid]) return SendClientMessage(playerid, -1,"You need to login to use this command");
    return 1;
}



Re: Wired problem in zcmd.. - [D]ry[D]esert - 30.10.2013

Tried both, non has worked.
EDIT: Check my code above, I've posted my OnPlayerCommandPerformed.


Re: Wired problem in zcmd.. - Konstantinos - 30.10.2013

Actually OnPlayerCommandReceived is the correct callback.
pawn Код:
public OnPlayerCommandReceived(playerid, cmdtext[])
{
    if(!LoggedIn[playerid])
    {
        SendClientMessage(playerid,COLOR_GREEN,"You have to login first");
        return 0;
    }
    return 1;
}



Re: Wired problem in zcmd.. - Jefff - 30.10.2013

Quote:
Originally Posted by iggy1
Посмотреть сообщение
I think you need to use OnPlayerCommandRecieved. Returning 0 there will prevent the command from being performed.
Answer

pawn Код:
public OnPlayerCommandReceived(playerid, cmdtext[])
{

    if(!LoggedIn[playerid])
        return !SendClientMessage(playerid,COLOR_GREEN,"You have to login first");

    return 1;
}



Re: Wired problem in zcmd.. - [D]ry[D]esert - 30.10.2013

Quote:
Originally Posted by iggy1
Посмотреть сообщение
I think you need to use OnPlayerCommandRecieved. Returning 0 there will prevent the command from being performed.
Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
Actually OnPlayerCommandReceived is the correct callback.
pawn Код:
public OnPlayerCommandReceived(playerid, cmdtext[])
{
    if(!LoggedIn[playerid])
    {
        SendClientMessage(playerid,COLOR_GREEN,"You have to login first");
        return 0;
    }
    return 1;
}
Quote:
Originally Posted by Jefff
Посмотреть сообщение
Answer

pawn Код:
public OnPlayerCommandReceived(playerid, cmdtext[])
{

    if(!LoggedIn[playerid])
        return !SendClientMessage(playerid,COLOR_GREEN,"You have to login first");

    return 1;
}
lol, my bad..
i tried iggy's post in a wrong way. sorry :\