Need help in duel system !
#1

I have problem, when i am inviting player for duel, invitation message not showing to his!

see my script:

pawn Код:
CMD:duel(playerid,params[])
{
    new target;
    if(pInfo[playerid][Minigame] == 1) return sMess(playerid,4);
    if(pInfo[playerid][Dinviter] != -1) return SendClientMessage(playerid,Red,"** You already have an invitation from player!");
    if(sscanf(params,"u",target)) return SendClientMessage(playerid,-1,"**Usage: /duel <playerid>");
    if(pInfo[target][Dinviter] != -1) return SendClientMessage(playerid,Red,"** Target have an invitation from player!");
    if(pInfo[target][InDuel] == 1) return SendClientMessage(playerid,Red,"** Target already in duel!");
    if(pInfo[playerid][InDuel] == 1) return SendClientMessage(playerid,Red,"** You are already in duel!");

    pInfo[playerid][Dinviter] = target;
   
    ShowPlayerDialog(playerid, DIALOG_DUEL, DIALOG_STYLE_LIST,"Select duel wepaon", "Sawn-off\nDeagle\nUzi", "Ok", "Back");
    return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    // duel
    if(dialogid == DIALOG_DUEL && response)
    {
            switch(dialogid)
            {
                case 0:
                {
                    new ms[500];
                    new target = pInfo[playerid][Dinviter];
                    // target = player id invited for duel!
                    // playerid = inviter

                    format(ms,500,"{808080}["WI"DUEL-INVITE{808080}] : Player %s is inviting you for duel Sawn-Off!",GetName(playerid));
                    SendClientMessage(target,-1,ms); // This message for player invite for duel!
                    SendClientMessage(target,-1,"==>> Type /yes if you want to duel!"); // This message for player invite for duel!
                    SendClientMessage(playerid,-1,"** Please wait for target accepting your request!"); // This message for inviter!
                    pInfo[target][Dinviter] = playerid;
                    pInfo[target][DuelType] = 1;
                    pInfo[playerid][DuelType] = 1;
                    SetTimerEx("ResetD",10000,0,"dd",pInfo[playerid][Dinviter],playerid);
                }
                case 1:
                {
                   
               
                }
                case 2:
                {
                   
                   
                }
            }
           
            if(!response)
            {
                pInfo[playerid][Dinviter] = -1;
            }
    }
    return 1;
}
Whats wrong ?

Sorry for my bad english
Reply
#2

Instead of
Quote:

if(sscanf(params,"u",target)) return SendClientMessage(playerid,-1,"**Usage: /duel <playerid>");

try
Quote:

target = strval(params);

or something like that. Strval should work fine for getting the id from the string

Add some debugging code like printf(target); etc, to see what the value of the variable is when you are using it in the SendClientMessage. Printing variables always helps to find problems.

I haven't tested so I don't know if that is the problem, but I have never used the "u" character before in sscanf, so I just assume its something to do with that, but maybe not. I cant see any other problems as such.
Reply
#3

i will test bro
Reply
#4

still not worked !
anyone ?
Reply
#5

Why are you using both an if and a switch to check the dialogid?
Reply
#6

Код:
switch(dialogid)
to:
Код:
switch(listitem)
Reply
#7

OMG !!!
my fault..
Sorry +rep
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)