Command
#1

Hi I want to ask, how can I do that as a command /set (playerid-partofname) (level or xp or money for example) (value)
and when admin type for example /set rumen98 Level 50 , to set level ot ,,rumen98'' to level 50
just wanna know how I can make the base, I'll do the actual command??
if its possible in <zcmd> command

and my other question is, how can I do in OnPlayerClickPlayer function like /pay command, but however with inputtext dialog??
Reply
#2

pawn Код:
CMD:set(playerid,params[])
{
    new id, thing[128] , value;
    if(!sscanf(params, "ds[128]d", id, thing, value))
    {
         if(strcmp(thing,"level", true) == 0)
          {
           // your code here
          }
          if(strcmp(thing,"xp", true) == 0)
          {
           // your code here
          }
          if(strcmp(thing,"money", true) == 0)
          {
           // your code here
          }
    }
    else
     SendClientMessage(playerid, -1, "USAGE: /set [playerid/partofName] [Thing] [value]");

return 1;
}
Hope i helped
Reply
#3

Explain more on OnPlayerClickPlayer thing.
What's your point? What do you want to happen when a player clicks on the other one?
Reply
#4

iFiras When Player Click player to show him Dialog ,,What would you like to send'' and menus are as Money, XP, Fuel. When you select one of these menus, there appears to inputtext dialog and write the number, verify that you have chosen something that the player who has chosen is 5 meters from him and gives them
Reply
#5

Quote:
Originally Posted by Fred1993
Посмотреть сообщение
pawn Код:
CMD:set(playerid,params[])
{
    new id, thing[128] , value;
    if(!sscanf(params, "ds[128]d", id, thing, value))
    {
         if(strcmp(thing,"level", true) == 0)
          {
           // your code here
          }
          if(strcmp(thing,"xp", true) == 0)
          {
           // your code here
          }
          if(strcmp(thing,"money", true) == 0)
          {
           // your code here
          }
    }
    else
     SendClientMessage(playerid, -1, "USAGE: /set [playerid/partofName] [Thing] [value]");

return 1;
}
Hope i helped
If you want to use the playerid OR a part of the player's name. Use "u" not "d".
It will look like this:
pawn Код:
if(!sscanf(params, "us[128]d", id, thing, value))
Reply
#6

Quote:
Originally Posted by Bible
Посмотреть сообщение
If you want to use the playerid OR a part of the player's name. Use "u" not "d".
It will look like this:
pawn Код:
if(!sscanf(params, "us[128]d", id, thing, value))
Oh yeah sorry forgot that
Reply
#7

Bump, Help with OnPlayerClickPlayer please
Reply
#8

https://sampwiki.blast.hk/wiki/OnPlayerClickPlayer

I think it works like this:
pawn Код:
public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
    ShowPlayerDialog(playerid, DIALOG_CLICKMENU, DIALOG_STYLE_LIST, "What do you want to do?", "Give Money\nGive EXP\nGive Fuel\n", "Continue", "Close");
    return 1;
}
Continue the Dialog responses under the OnDialogResponse callback.
Reply
#9

Quote:
Originally Posted by Bible
Посмотреть сообщение
https://sampwiki.blast.hk/wiki/OnPlayerClickPlayer

I think it works like this:
pawn Код:
public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
    ShowPlayerDialog(playerid, DIALOG_CLICKMENU, DIALOG_STYLE_LIST, "What do you want to do?", "Give Money\nGive EXP\nGive Fuel\n", "Continue", "Close");
    return 1;
}
Continue the Dialog responses under the OnDialogResponse callback.
i know that, i just want to know how to make an function like when Money to show inputtext dialog and when player type example 500 and have 500 money and clicked player is around 5 meter from player to give him 500 money... It's like /pay command, but however with dialogс
Reply
#10

You mean something like this?
pawn Код:
new StoreID[MAX_PLAYERS];

public OnPlayerClickPlayer(playerid, clickedplayerid, source) //Bibles example
{
    ShowPlayerDialog(playerid, DIALOG_CLICKMENU, DIALOG_STYLE_LIST, "What do you want to do?", "Give Money\nGive EXP\nGive Fuel\n", "Continue", "Close");
    StoreID[playerid] = clickedplayerid;
    return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch(dialogid)
    {
        case DIALOG_CLICKPLAYER:
        {
            if(response)
            {
                switch(listitem)
                {
                    case 0: //Lets give a player a defined amount of money...
                    {
                        ShowPlayerDialog(playerid, DIALOG_GIVEMONEY, DIALOG_STYLE_INPUT, "Give Money", "How much?", "Go", "Cancel");
                    }
                }
            }
        }
        case DIALOG_GIVEMONEY:
        {
            if(response)
            {
                new Float:x, Float:y, Float:z;
                GetPlayerPos(StoreID[playerid], x, y, x);
                if(IsPlayerInRangeOfPoint(playerid, 5, x, y, z)//Are you within 5 units?
                {
                    GivePlayerMoney(StoreID[playerid], inputtext); //This will give the player the amount of moeny you entered
                }
            }
        }
    }
}
I wouldn't recommend using that, it's just a rough example to help you.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)