Please help !!!
#1

guys i want to make vip system and i make it now i need to detect the id of the player which i want to give him rights
i have this:
pawn Код:
COMMAND:giveplayerrights(playerid, params[])
{
    new targetid, level;
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0x0000000, "You can't use this command.");
    if(sscanf(params, "ui", targetid, level)) return SendClientMessage(playerid, 0xFFFFFF, "USAGE: /giveplayerrights [playerid] [rights level]");
    IsPlayerVip[targetid] = level;
    return 1;
}
so in pawn dont showing me errors but in game when ill start my server andy of my all commands dont work please some one tell me what is the problem in my script or game and does this code is correctly.
Reply
#2

That code is fine.
Are you using ZCMD and the OnPlayerCommandText callback together?
Edit: if yes then you cannot use both ZCMD and the OnPlayerCommandText Strcmp cmds/callback together. You will need to convert all of your commands to ZCMD.
Reply
#3

nope
Reply
#4

ok so here are some commands:
pawn Код:
CMD:giveplayerrights(playerid, params[])
{
    new targetid, level;
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0x0000000, "You can't use this command.");
    if(sscanf(params, "ui", targetid, level)) return SendClientMessage(playerid, 0xFFFFFF, "USAGE: /giveplayerrights [playerid] [rights level]");
    SendClientMessage(playerid, 0x0000000, "You has gived him rights.");
    IsPlayerVip[targetid] = level;
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp("/heal", cmdtext, true, 10) == 0)
    {
        SetPlayerHealth(playerid, 100);
        return 1;
    }
    if(strcmp("/nrg", cmdtext, true, 10) == 0)
    {
        new Float:x, Float:y, Float:z;
        GetPlayerPos(playerid, Float:x, Float:y, Float:z);
        CreateVehicle(522, x, y ,z, 10, 0, 0, 20);
        return 1;
    }
    if(strcmp("/vipopen1", cmdtext, true, 10) == 0)
    {
        if(IsPlayerInRangeOfPoint(playerid, 10.0, -2811.1684570313,-1524.8093261719,142.4806060791))
        {
            if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0x0000000, "You cant open admin gate.");
            MoveObject(vrata,-2811.1684570313,-1524.8093261719,142.4806060791, 2.0);
            return 1;
        }
        else
        {
        SendClientMessage(playerid, 0x0000000, "You are not close enought to open the gate.");
        return 1;
        }
    }
    if(strcmp("/vipclose1", cmdtext, true, 10) == 0)
    {
        if(IsPlayerInRangeOfPoint(playerid, 10.0, -2811.1684570313,-1524.8093261719,142.4806060791))
        {
            if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0x0000000, "You cant open admin gate.");
            MoveObject(vrata,-2810.94750977,-1523.27453613,142.48060608, 2.0);
            return 1;
        }
        else
        {
        SendClientMessage(playerid, 0x0000000, "You are not close enought to close the gate.");
        return 1;
        }
    }
    if(strcmp("/viptele", cmdtext, true, 10) == 0)
    {
        SetPlayerPos(playerid, -2810.94750977,-1523.27453613,142.48060608);
        return 1;
    }
    if(strcmp("/viphelp", cmdtext, true, 10) == 0)
    {
        if(IsPlayerVip[playerid] == 1)
        {
            SendClientMessage(playerid, 0x0000000, "/vipguns, /vippacket");
            return 1;
        }
        if(IsPlayerVip[playerid] == 2)
        {
            SendClientMessage(playerid, 0x0000000, "/viphouse, /vipopen1, /vipclose1");
            return 1;
        }
        else
        {
            SendClientMessage(playerid, 0x0000000, "You are not vip.");
            return 1;
        }
    }
    if(strcmp("/vipguns", cmdtext, true, 10) == 0)
    {
        ShowPlayerDialog(playerid, vipguns, DIALOG_STYLE_MSGBOX, "Vip Guns", "Shawn-off\nTec9", "Accept", "Cancel");
        return 1;
    }
    return SendClientMessage(playerid, 0x0000000, "This command does not exist please try again or something else!");
}
so what i need to do now cause i dont understand much english..
Reply
#5

Quote:
Originally Posted by Rafa
Посмотреть сообщение
so what i need to do now cause i dont understand much english..
You will need to convert all of your strcmp commands to ZCMD. like this:
pawn Код:
CMD:giveplayerrights(playerid, params[])
{
    new targetid, level;
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0x0000000, "You can't use this command.");
    if(sscanf(params, "ui", targetid, level)) return SendClientMessage(playerid, 0xFFFFFF, "USAGE: /giveplayerrights [playerid] [rights level]");
    SendClientMessage(playerid, 0x0000000, "You has gived him rights.");
    IsPlayerVip[targetid] = level;
    return 1;
}
CMD:heal(playerid, params[])
{
    SetPlayerHealth(playerid, 100);
    return 1;
}
CMD:nrg(playerid, params[])
{
    new Float:x, Float:y, Float:z;
    GetPlayerPos(playerid, Float:x, Float:y, Float:z);
    CreateVehicle(522, x, y ,z, 10, 0, 0, 20);
    return 1;
}
CMD:vipopen1(playerid, params[])
{
    if(IsPlayerInRangeOfPoint(playerid, 10.0, -2811.1684570313,-1524.8093261719,142.4806060791))
    {
        if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0x0000000, "You cant open admin gate.");
        MoveObject(vrata,-2811.1684570313,-1524.8093261719,142.4806060791, 2.0);
    }
    else
    {
        SendClientMessage(playerid, 0x0000000, "You are not close enought to open the gate.");
    }
    return 1;
}
CMD:vipclose1(playerid, params[])
{
    if(IsPlayerInRangeOfPoint(playerid, 10.0, -2811.1684570313,-1524.8093261719,142.4806060791))
    {
        if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0x0000000, "You cant open admin gate.");
        MoveObject(vrata,-2810.94750977,-1523.27453613,142.48060608, 2.0);
    }
    else
    {
        SendClientMessage(playerid, 0x0000000, "You are not close enought to close the gate.");
    }
    return 1;
}
CMD:viptele(playerid, params[])
{
    SetPlayerPos(playerid, -2810.94750977,-1523.27453613,142.48060608);
    return 1;
}
CMD:viphelp(playerid, params[])
{
    if(IsPlayerVip[playerid] == 1)
    {
        SendClientMessage(playerid, 0x0000000, "/vipguns, /vippacket");
    }
    else if(IsPlayerVip[playerid] == 2)
    {
        SendClientMessage(playerid, 0x0000000, "/viphouse, /vipopen1, /vipclose1");
    }
    else
    {
        SendClientMessage(playerid, 0x0000000, "You are not vip.");
    }
    return 1;
}
CMD:vipguns(playerid, params[])
{
    ShowPlayerDialog(playerid, vipguns, DIALOG_STYLE_MSGBOX, "Vip Guns", "Shawn-off\nTec9", "Accept", "Cancel");
    return 1;
}

public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
    if(!success) SendClientMessage(playerid, 0x0000000, "This command does not exist please try again or something else!");
    return 1;
}
And remove the OnPlayerCommandText callback.
Reply
#6

and what if i use dcmd and than i will need to convert all commands in dcmd or i can use OnPlayerCommandText and dcmd ?
Reply
#7

You can use OnPlayerCommandReceived too.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)