SA-MP Forums Archive
Simple help :) Click here - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Simple help :) Click here (/showthread.php?tid=273111)



Simple help :) Click here - Davz*|*Criss - 31.07.2011

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


Re: Simple help :) Click here - Wesley221 - 31.07.2011

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


Re: Simple help :) Click here - Davz*|*Criss - 31.07.2011

Alright, now theres only 1 error

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



Re: Simple help :) Click here - Wesley221 - 31.07.2011

At which line?


Re: Simple help :) Click here - Davz*|*Criss - 31.07.2011

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



Re: Simple help :) Click here - Rafa - 31.07.2011

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 .. :/


Re: Simple help :) Click here - Rafa - 31.07.2011

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;
}