Need help with dialog response
#1

hey i am back again

i have a problem how do i make a dialog response of this command

Код:
if (strcmp("/weapon", cmdtext, true, 10) == 0)
{
if(IsPlayerInRangeOfPoint(playerid, 7.0, 313.1375,-166.0060,999.6010))
{
ShowPlayerDialog(playerid,253,DIALOG_STYLE_LIST,"Weapons","Silence $500\nAK-47 $2000\nM4 $3000\nDeagle $500\n9mm $200\nMP5 $300\nMicro SMG $200\nCombat Shotgun $500\nRegular Shotgun $400\nSniper Rifle $1500\nOthers","Select","Cancel");
}
else
{
SendClientMessage(playerid,COLOR_PINK2,"You need to be in the Ammunation Checkpoint to buy Weapons");
}
return 1;
}
i know how to do it but i get a error that is

look
i already have a dialog response of another command which is
Код:
if (strcmp("/duty", cmdtext, true, 10) == 0)
{
if(IsPlayerInRangeOfPoint(playerid, 7.0, 255.2998,75.6383,1003.6406))
{
ShowPlayerDialog(playerid,2,DIALOG_STYLE_LIST,"Cop Duty","LSPD Officer\nSFPD Officer\nLVPD Officer","Select","Cancel");
}
else if(IsPlayerInRangeOfPoint(playerid, 7.0, 233.3887,125.0445,1003.2188))
{
ShowPlayerDialog(playerid,1,DIALOG_STYLE_LIST,"Cop Duty","LSPD Officer\nSFPD Officer\nLVPD Officer","Select","Cancel");
}
else if(IsPlayerInRangeOfPoint(playerid,7.0,223.5052,187.4177,1003.0313))
{
ShowPlayerDialog(playerid,1,DIALOG_STYLE_LIST,"Cop Duty","LSPD Officer\nSFPD Officer\nLVPD Officer","Select","Cancel");
}
else
{
SendClientMessage(playerid,COLOR_PINK2,"Not in Changing Room");
}
return 1;
}
and the dialog response of the command /duty is

Код:
switch(dialogid) 
{
case 1:
{
if(!response)
{
SendClientMessage(playerid, 0xFF0000FF, "You Canceled");
return 1; 
}
switch(listitem) 
{
case 0:
{
SetPlayerSkin(playerid,280);
SendClientMessage(playerid,COLOR_SEAGREEN,"Welcome to Duty USPD Officer");
}
case 1:
{
SetPlayerSkin(playerid,281);
SendClientMessage(playerid,COLOR_SEAGREEN,"Welcome to Duty USPD Officer");
}
case 2:
{
SetPlayerSkin(playerid,282);
SendClientMessage(playerid,COLOR_SEAGREEN,"Welcome to Duty USPD Officer");
}
}
}
}
return 0;
}
now the problem is i dont know how do i make a dialog response of the command /weapon and where to put it,i made it but i get errors can anyone make a dialog response and tell me where to put it?
Reply
#2

pawn Код:
switch(dialogid)
{
    case 1:
    {
        if(!response)
        {
            SendClientMessage(playerid, 0xFF0000FF, "You Canceled");
            return 1;
        }
        switch(listitem)
        {
            case 0:
            {
                SetPlayerSkin(playerid,280);
                SendClientMessage(playerid,COLOR_SEAGREEN,"Welcome to Duty USPD Officer");
            }
            case 1:
            {
                SetPlayerSkin(playerid,281);
                SendClientMessage(playerid,COLOR_SEAGREEN,"Welcome to Duty USPD Officer");
            }
            case 2:
            {
                SetPlayerSkin(playerid,282);
                SendClientMessage(playerid,COLOR_SEAGREEN,"Welcome to Duty USPD Officer");
            }
        }
    }
    case 253:
    {
        if(!response)
        {
            SendClientMessage(playerid, 0xFF0000FF, "You Canceled");
            return 1;
        }
        switch(listitem)
        {
            case 0:
            {
                // Silence $500
            }
            case 1:
            {
                // AK-47 $2000
            }
            case 2:
            {
                // M4 $3000
            }
            // add case 3, case 4 etc.
        }
    }
}
Reply
#3

thnaks again for the help
Reply
#4

MadeMan when ever i put code in case 0: i get errors


C:\Users\Sony\Desktop\United States Roleplay\gamemodes\RP.pwn(442) : error 014: invalid statement; not in switch
C:\Users\Sony\Desktop\United States Roleplay\gamemodes\RP.pwn(442) : warning 215: expression has no effect
C:\Users\Sony\Desktop\United States Roleplay\gamemodes\RP.pwn(442) : error 001: expected token: ";", but found ":"
C:\Users\Sony\Desktop\United States Roleplay\gamemodes\RP.pwn(442) : error 029: invalid expression, assumed zero
C:\Users\Sony\Desktop\United States Roleplay\gamemodes\RP.pwn(442) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


4 Errors.

and the code which i inserted was

Код:
 case 253:
    {
        if(!response)
        {
            SendClientMessage(playerid, 0xFF0000FF, "You Canceled");
            return 1;
        }
        switch(listitem)
        {
            case 0:
            {
	    if(GetPlayerMoney(playerid) > 500 )
            {
            GivePlayerWeapon(playerid,23,280);
            SendClientMessage(playerid,COLOR_LAWNGREEN,"You Bought a Silencer with 280 Rounds");
            }
            else
            {
            SendClientMessage(playerid,COLOR_PINK2,"You do not have Enought Money");
            }
            case 1:
            {
                // AK-47 $2000
            }
            case 2:
            {
                // M4 $3000
            }
            
        }
    }
}
i dont know why this happens
Reply
#5

NVM i fixed it
Reply
#6

i need a script which loads back skin '

Ex:i have a commnd /duty when player does it he goes on cop duty with a cop skin now i want when he use /offduty he gets the same skin which he had before going on duty can anyone help me making this?

or can anyone do it for me?
Reply
#7

Quote:
Originally Posted by Domnic Toretto
Посмотреть сообщение
i need a script which loads back skin '

Ex:i have a commnd /duty when player does it he goes on cop duty with a cop skin now i want when he use /offduty he gets the same skin which he had before going on duty can anyone help me making this?

or can anyone do it for me?
pawn Код:
//At top of your script
new oldskin[MAX_PLAYERS];
new bool:onduty[MAX_PLAYERS];
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/duty", cmdtext, true, 10) == 0)
    {
        if(onduty[playerid]) return SendClientMessage(playerid,-1,"You are already on duty");
        oldskin[playerid] = GetPlayerSkin(playerid);
        SetPlayerSkin(playerid,282);
        onduty[playerid] = true;
        return SendClientMessage(playerid,-1,"You are on duty now");
    }
    else if (strcmp("/offduty", cmdtext, true, 10) == 0)
    {
        if(!onduty[playerid]) return SendClientMessage(playerid,-1,"You are not on duty");
        SetPlayerSkin(playerid,oldskin[playerid]);
        onduty[playerid] = false;
        return SendClientMessage(playerid,-1,"You are no more on duty");
    }
    return 0;
}
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)