Simple help :) Click here
#1

Hey guys i am creating duel cmd.

But it shows me some errors.

Command:

pawn Код:
COMMAND:duel(playerid, params[])
{
    new string[128];
    new TargetID;
    new DuelSenderName[MAX_PLAYER_NAME];
   
    if(sscanf(params, "u", TargetID))
    {
        SendClientMessage(playerid, 0xFFFFAAFF, "Correct Usage: /Duel (PlayerID/PartOfName).");
        SendClientMessage(playerid, 0xFFFFAAFF, "Function: Will send an invite to a player you want to duel.");
        return 1;
    }
    if(!IsPlayerConnected(TargetID)) return ShowPlayerDialog(playerid,2,DIALOG_STYLE_MSGBOX,"{FF0000}Duel Error!","The player you want to duel is not availabe or the ID is wrong.","Exit", "");
    if(playerid != TargetID) return ShowPlayerDialog(playerid,8000,DIALOG_STYLE_MSGBOX,"{FF0000}Duel Error!","You can't duel yourself.","Exit", "");
    {
        GetPlayerName(playerid, DuelSenderName, sizeof(DuelSenderName));
        format(string, sizeof(string), "%s wants to duel with you, Wether accept or cancel.", DuelSenderName);
        ShowPlayerDialog(TargetID, 20000, DIALOG_STYLE_MSGBOX, "{00FF00}Duel Invitation!", string, "Accept", "Cancel");
    }
    }
    else
    {
    ShowPlayerDialog(TargetID,100,DIALOG_STYLE_LIST,"Select Weapon!","Deagle","Start","Exit");
    }
    return 1;
}
And the errors:

pawn Код:
C:\Users\Axme\Desktop\Freeroam server\gamemodes\Tw.pwn(253) : warning 209: function "cmd_duel" should return a value
C:\Users\Axme\Desktop\Freeroam server\gamemodes\Tw.pwn(254) : error 010: invalid function or declaration
C:\Users\Axme\Desktop\Freeroam server\gamemodes\Tw.pwn(258) : error 010: invalid function or declaration
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


2 Errors.
Thanks for your lil help
Reply
#2

pawn Код:
COMMAND:duel(playerid, params[])
{
    new string[128];
    new TargetID;
    new DuelSenderName[MAX_PLAYER_NAME];
   
    if(sscanf(params, "u", TargetID))
    {
        SendClientMessage(playerid, 0xFFFFAAFF, "Correct Usage: /Duel (PlayerID/PartOfName).");
        SendClientMessage(playerid, 0xFFFFAAFF, "Function: Will send an invite to a player you want to duel.");
        return 1;
    }
    if(!IsPlayerConnected(TargetID)) return ShowPlayerDialog(playerid,2,DIALOG_STYLE_MSGBOX,"{FF0000}Duel Error!","The player you want to duel is not availabe or the ID is wrong.","Exit", "");
    if(playerid != TargetID) return ShowPlayerDialog(playerid,8000,DIALOG_STYLE_MSGBOX,"{FF0000}Duel Error!","You can't duel yourself.","Exit", "");
    {
        GetPlayerName(playerid, DuelSenderName, sizeof(DuelSenderName));
        format(string, sizeof(string), "%s wants to duel with you, Wether accept or cancel.", DuelSenderName);
        ShowPlayerDialog(TargetID, 20000, DIALOG_STYLE_MSGBOX, "{00FF00}Duel Invitation!", string, "Accept", "Cancel");
    }
    else
    {
    ShowPlayerDialog(TargetID,100,DIALOG_STYLE_LIST,"Select Weapon!","Deagle","Start","Exit");
    }
    return 1;
}
Try this
Reply
#3

Alright, now theres only 1 error

pawn Код:
C:\Users\Axme\Desktop\Freeroam server\gamemodes\Tw.pwn(253) : error 029: invalid expression, assumed zero
Reply
#4

At which line?
Reply
#5

pawn Код:
COMMAND:duel(playerid, params[])
{
    new string[128];
    new TargetID;
    new DuelSenderName[MAX_PLAYER_NAME];

    if(sscanf(params, "u", TargetID))
    {
        SendClientMessage(playerid, 0xFFFFAAFF, "Correct Usage: /Duel (PlayerID/PartOfName).");
        SendClientMessage(playerid, 0xFFFFAAFF, "Function: Will send an invite to a player you want to duel.");
        return 1;
    }
    if(!IsPlayerConnected(TargetID)) return ShowPlayerDialog(playerid,2,DIALOG_STYLE_MSGBOX,"{FF0000}Duel Error!","The player you want to duel is not availabe or the ID is wrong.","Exit", "");
    if(!playerid != TargetID) return ShowPlayerDialog(playerid,8000,DIALOG_STYLE_MSGBOX,"{FF0000}Duel Error!","You can't duel yourself.","Exit", "");
    {
        GetPlayerName(playerid, DuelSenderName, sizeof(DuelSenderName));
        format(string, sizeof(string), "%s wants to duel with you, Wether accept or cancel.", DuelSenderName);
        ShowPlayerDialog(TargetID, 20000, DIALOG_STYLE_MSGBOX, "{00FF00}Duel Invitation!", string, "Accept", "Cancel");
    }
    else
    {
        ShowPlayerDialog(TargetID,7,DIALOG_STYLE_LIST,"Select Weapon!","Deagle","Start","Exit");
    }
    return 1;
}
Code is that.

And the error line is

pawn Код:
else
Reply
#6

pawn Код:
CMD:duel(playerid, params[])
{
    new string[128];
    new TargetID;
    new DuelSenderName[MAX_PLAYER_NAME];
    if(sscanf(params, "u", TargetID))
    {
        SendClientMessage(playerid, 0xFFFFAAFF, "Correct Usage: /Duel (PlayerID/PartOfName).");
        SendClientMessage(playerid, 0xFFFFAAFF, "Function: Will send an invite to a player you want to duel.");
        return 1;
    }
    if(!IsPlayerConnected(TargetID)) return ShowPlayerDialog(playerid,2,DIALOG_STYLE_MSGBOX,"{FF0000}Duel Error!","The player you want to duel is not availabe or the ID is wrong.","Exit", "");
    if(playerid != TargetID) return ShowPlayerDialog(playerid,8000,DIALOG_STYLE_MSGBOX,"{FF0000}Duel Error!","You can't duel yourself.","Exit", "");
    {
        GetPlayerName(playerid, DuelSenderName, sizeof(DuelSenderName));
        format(string, sizeof(string), "%s wants to duel with you, Wether accept or cancel.", DuelSenderName);
        ShowPlayerDialog(TargetID, 20000, DIALOG_STYLE_MSGBOX, "{00FF00}Duel Invitation!", string, "Accept", "Cancel");
        return 1;
    }
    ShowPlayerDialog(TargetID,100,DIALOG_STYLE_LIST,"Select Weapon!","Deagle","Start","Exit");
    return 1;
}
ignore the warning .. :/
Reply
#7

sorry for that post add this without warnings and errors
pawn Код:
CMD:duel(playerid, params[])
{
    new string[128];
    new TargetID;
    new DuelSenderName[MAX_PLAYER_NAME];
    if(sscanf(params, "u", TargetID))
    {
        SendClientMessage(playerid, 0xFFFFAAFF, "Correct Usage: /Duel (PlayerID/PartOfName).");
        SendClientMessage(playerid, 0xFFFFAAFF, "Function: Will send an invite to a player you want to duel.");
        return 1;
    }
    if(!IsPlayerConnected(TargetID)) return ShowPlayerDialog(playerid,2,DIALOG_STYLE_MSGBOX,"{FF0000}Duel Error!","The player you want to duel is not availabe or the ID is wrong.","Exit", "");
    if(playerid != TargetID) return ShowPlayerDialog(playerid,8000,DIALOG_STYLE_MSGBOX,"{FF0000}Duel Error!","You can't duel yourself.","Exit", "");
    {
        GetPlayerName(playerid, DuelSenderName, sizeof(DuelSenderName));
        format(string, sizeof(string), "%s wants to duel with you, Wether accept or cancel.", DuelSenderName);
        ShowPlayerDialog(TargetID, 20000, DIALOG_STYLE_MSGBOX, "{00FF00}Duel Invitation!", string, "Accept", "Cancel");
    }
    ShowPlayerDialog(TargetID,100,DIALOG_STYLE_LIST,"Select Weapon!","Deagle","Start","Exit");
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)