PDA

View Full Version : Any Cmd Opens Dialog


SnG.Scot_MisCuDI
30/12/2011, 05:47 AM
Any command that i type that isnt a working command my dialog box opens up. Here is the script

// This is a comment
// uncomment the line below if you want to write a filterscript
#define FILTERSCRIPT
#define vmenu 2344

#include <a_samp>

#if defined FILTERSCRIPT
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Blank Filterscript by your name here");
print("--------------------------------------\n");
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmdtext, "/attacho", true))
{
ShowPlayerDialog(playerid, vmenu, DIALOG_STYLE_LIST, "Object Attacher By: SnG.Scot_MisCuDi", "Cock \nCock1 \nCock2 \nCock3 \nRemove", "Attach", "Cancel");
return 1;
}
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == vmenu)
{
if(response)
{
if(listitem == 0) // Cock
{
SetPlayerAttachedObject(playerid, 0, 16776, 2, 0.000000, 0.000000, 0.000000, 0.000000, 90.000000, 180.000000, 0.050000, 0.050000, 0.050000);
SetPlayerAttachedObject(playerid, 1, 321, 1, -0.200000, 0.349999, -0.150000, 90.000000, 180.000000, 0.000000, 3.000000, 3.000000, 3.000000);
}
if(listitem == 1) // Cock1
{
SetPlayerAttachedObject(playerid, 0, 16776, 2, 0.000000, 0.000000, 0.000000, 0.000000, 90.000000, 180.000000, 0.050000, 0.050000, 0.050000);
SetPlayerAttachedObject(playerid, 1, 321, 1, -0.200000, 0.349999, -0.150000, 90.000000, 180.000000, 0.000000, 3.000000, 3.000000, 3.000000);
}
if(listitem == 2) // Cock2
{
SetPlayerAttachedObject(playerid, 0, 16776, 2, 0.000000, 0.000000, 0.000000, 0.000000, 90.000000, 180.000000, 0.050000, 0.050000, 0.050000);
SetPlayerAttachedObject(playerid, 1, 321, 1, -0.200000, 0.349999, -0.150000, 90.000000, 180.000000, 0.000000, 3.000000, 3.000000, 3.000000);
}
if(listitem == 3) // Cock3
{
SetPlayerAttachedObject(playerid, 0, 16776, 2, 0.000000, 0.000000, 0.000000, 0.000000, 90.000000, 180.000000, 0.050000, 0.050000, 0.050000);
SetPlayerAttachedObject(playerid, 1, 321, 1, -0.200000, 0.349999, -0.150000, 90.000000, 180.000000, 0.000000, 3.000000, 3.000000, 3.000000);
}
if(listitem == 4) // remove
{
RemovePlayerAttachedObject(playerid, 0);
RemovePlayerAttachedObject(playerid, 1);
}
}
return 1;
}
}
#endif

eеe
30/12/2011, 05:51 AM
define the things after a_samp include

SnG.Scot_MisCuDI
30/12/2011, 05:54 AM
Still the same thing

SnG.Scot_MisCuDI
30/12/2011, 07:01 AM
Now any command at all opens it.. Please help!

[O.z]Caroline
30/12/2011, 07:11 AM
#include <a_samp>


public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmdtext, "/attacho", true))
{
ShowPlayerDialog(playerid, vmenu, DIALOG_STYLE_LIST, "Object Attacher By: SnG.Scot_MisCuDi", "Cock \nCock1 \nCock2 \nCock3 \nRemove", "Attach", "Cancel");
return 1;
}
return 0;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == vmenu)
{
if(response)
{
if(listitem == 0) // Cock
{
SetPlayerAttachedObject(playerid, 0, 16776, 2, 0.000000, 0.000000, 0.000000, 0.000000, 90.000000, 180.000000, 0.050000, 0.050000, 0.050000);
SetPlayerAttachedObject(playerid, 1, 321, 1, -0.200000, 0.349999, -0.150000, 90.000000, 180.000000, 0.000000, 3.000000, 3.000000, 3.000000);
}
if(listitem == 1) // Cock1
{
SetPlayerAttachedObject(playerid, 0, 16776, 2, 0.000000, 0.000000, 0.000000, 0.000000, 90.000000, 180.000000, 0.050000, 0.050000, 0.050000);
SetPlayerAttachedObject(playerid, 1, 321, 1, -0.200000, 0.349999, -0.150000, 90.000000, 180.000000, 0.000000, 3.000000, 3.000000, 3.000000);
}
if(listitem == 2) // Cock2
{
SetPlayerAttachedObject(playerid, 0, 16776, 2, 0.000000, 0.000000, 0.000000, 0.000000, 90.000000, 180.000000, 0.050000, 0.050000, 0.050000);
SetPlayerAttachedObject(playerid, 1, 321, 1, -0.200000, 0.349999, -0.150000, 90.000000, 180.000000, 0.000000, 3.000000, 3.000000, 3.000000);
}
if(listitem == 3) // Cock3
{
SetPlayerAttachedObject(playerid, 0, 16776, 2, 0.000000, 0.000000, 0.000000, 0.000000, 90.000000, 180.000000, 0.050000, 0.050000, 0.050000);
SetPlayerAttachedObject(playerid, 1, 321, 1, -0.200000, 0.349999, -0.150000, 90.000000, 180.000000, 0.000000, 3.000000, 3.000000, 3.000000);
}
if(listitem == 4) // remove
{
RemovePlayerAttachedObject(playerid, 0);
RemovePlayerAttachedObject(playerid, 1);
}
}
}
return 1;
}


in OnPlayerCommandText need this at the end:

return 0;
}

SnG.Scot_MisCuDI
30/12/2011, 07:15 AM
Still opens with any command

[O.z]Caroline
30/12/2011, 07:22 AM
oh yes,


#include <a_samp>


public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp(cmdtext, "/attacho", true))
{
ShowPlayerDialog(playerid, vmenu, DIALOG_STYLE_LIST, "Object Attacher By: SnG.Scot_MisCuDi", "Cock \nCock1 \nCock2 \nCock3 \nRemove", "Attach", "Cancel");
return 1;
}
return 0;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == vmenu)
{
if(response)
{
if(listitem == 0) // Cock
{
SetPlayerAttachedObject(playerid, 0, 16776, 2, 0.000000, 0.000000, 0.000000, 0.000000, 90.000000, 180.000000, 0.050000, 0.050000, 0.050000);
SetPlayerAttachedObject(playerid, 1, 321, 1, -0.200000, 0.349999, -0.150000, 90.000000, 180.000000, 0.000000, 3.000000, 3.000000, 3.000000);
}
if(listitem == 1) // Cock1
{
SetPlayerAttachedObject(playerid, 0, 16776, 2, 0.000000, 0.000000, 0.000000, 0.000000, 90.000000, 180.000000, 0.050000, 0.050000, 0.050000);
SetPlayerAttachedObject(playerid, 1, 321, 1, -0.200000, 0.349999, -0.150000, 90.000000, 180.000000, 0.000000, 3.000000, 3.000000, 3.000000);
}
if(listitem == 2) // Cock2
{
SetPlayerAttachedObject(playerid, 0, 16776, 2, 0.000000, 0.000000, 0.000000, 0.000000, 90.000000, 180.000000, 0.050000, 0.050000, 0.050000);
SetPlayerAttachedObject(playerid, 1, 321, 1, -0.200000, 0.349999, -0.150000, 90.000000, 180.000000, 0.000000, 3.000000, 3.000000, 3.000000);
}
if(listitem == 3) // Cock3
{
SetPlayerAttachedObject(playerid, 0, 16776, 2, 0.000000, 0.000000, 0.000000, 0.000000, 90.000000, 180.000000, 0.050000, 0.050000, 0.050000);
SetPlayerAttachedObject(playerid, 1, 321, 1, -0.200000, 0.349999, -0.150000, 90.000000, 180.000000, 0.000000, 3.000000, 3.000000, 3.000000);
}
if(listitem == 4) // remove
{
RemovePlayerAttachedObject(playerid, 0);
RemovePlayerAttachedObject(playerid, 1);
}
}
}
return 1;
}


Use

if(!strcmp(cmdtext,"/command", true))
// OR
if(strcmp(cmdtext,"/command", true) == 0)

AustinJ
30/12/2011, 07:24 AM
Damn I Feel Smart
if(strcmp(cmdtext, "/attacho", true) == 0)

EDIT: Credits to [O.z]Caroline for posting first...

SnG.Scot_MisCuDI
30/12/2011, 07:28 AM
Caroline;1599284']oh yes,


#include <a_samp>


public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp(cmdtext, "/attacho", true))
{
ShowPlayerDialog(playerid, vmenu, DIALOG_STYLE_LIST, "Object Attacher By: SnG.Scot_MisCuDi", "Cock \nCock1 \nCock2 \nCock3 \nRemove", "Attach", "Cancel");
return 1;
}
return 0;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == vmenu)
{
if(response)
{
if(listitem == 0) // Cock
{
SetPlayerAttachedObject(playerid, 0, 16776, 2, 0.000000, 0.000000, 0.000000, 0.000000, 90.000000, 180.000000, 0.050000, 0.050000, 0.050000);
SetPlayerAttachedObject(playerid, 1, 321, 1, -0.200000, 0.349999, -0.150000, 90.000000, 180.000000, 0.000000, 3.000000, 3.000000, 3.000000);
}
if(listitem == 1) // Cock1
{
SetPlayerAttachedObject(playerid, 0, 16776, 2, 0.000000, 0.000000, 0.000000, 0.000000, 90.000000, 180.000000, 0.050000, 0.050000, 0.050000);
SetPlayerAttachedObject(playerid, 1, 321, 1, -0.200000, 0.349999, -0.150000, 90.000000, 180.000000, 0.000000, 3.000000, 3.000000, 3.000000);
}
if(listitem == 2) // Cock2
{
SetPlayerAttachedObject(playerid, 0, 16776, 2, 0.000000, 0.000000, 0.000000, 0.000000, 90.000000, 180.000000, 0.050000, 0.050000, 0.050000);
SetPlayerAttachedObject(playerid, 1, 321, 1, -0.200000, 0.349999, -0.150000, 90.000000, 180.000000, 0.000000, 3.000000, 3.000000, 3.000000);
}
if(listitem == 3) // Cock3
{
SetPlayerAttachedObject(playerid, 0, 16776, 2, 0.000000, 0.000000, 0.000000, 0.000000, 90.000000, 180.000000, 0.050000, 0.050000, 0.050000);
SetPlayerAttachedObject(playerid, 1, 321, 1, -0.200000, 0.349999, -0.150000, 90.000000, 180.000000, 0.000000, 3.000000, 3.000000, 3.000000);
}
if(listitem == 4) // remove
{
RemovePlayerAttachedObject(playerid, 0);
RemovePlayerAttachedObject(playerid, 1);
}
}
}
return 1;
}


Use

if(!strcmp(cmdtext,"/command", true))
// OR
if(strcmp(cmdtext,"/command", true) == 0)

Thanks :)

Gh05t_
30/12/2011, 02:59 PM
define the things after a_samp include

Unless there is no relationship between the macro and the included directive, there is no harm defining it before. Good practise would allow includes and header files to be first upon compilation time, as content within the includes may relate to some of your code.