Need Help with Attachment -
Vaishnav - 24.07.2014
hi guys,
My problem is pls look at the picture it's showing Slot Slot 0 (used) when I used another slot and it's keep increasing when I use another slots
pic
I just want to print Slot 0 (used), Slot 1 (used)
here is the code
pawn Код:
case DIALOG_HOLD:
{
if ( !response )
return ( 1 );
switch( listitem )
{
case 0:
{
gsString[ 0 ] = EOS;
for ( new o = 0; o < sizeof( ObjectInfo ); o++ )
format( gsString, sizeof( gsString ), "%s\n{FF0000}%d) "W"%s", gsString, o, ObjectInfo[ o ][ o_n ] );
ShowPlayerDialog( playerid, DIALOG_SELECT_HOLD, DIALOG_STYLE_LIST, "{FF9900}Hold - Objects", gsString, "Hold", "Cancel" );
}
case 1:
{
gsString[ 0 ] = EOS;
for ( new x; x < MAX_PLAYER_ATTACHED_OBJECTS; x++ )
{
if ( IsPlayerAttachedObjectSlotUsed( playerid, x ) )
format( gsString, sizeof( gsString ), "{FFA500}Slot {1589FF}%s%d {FF0000}(Used)\n", gsString, x );
else
format( gsString, sizeof( gsString ), "%s%d\n", gsString, x );
}
ShowPlayerDialog( playerid, DIALOG_ATTACH_INDEX_SELECTION, DIALOG_STYLE_LIST, "{FF0000}Create new hold - Index Selection", gsString, "(Select)", "Cancel" );
}
case 2: ShowPlayerDialog( playerid, DIALOG_ATTACH_SETTINGS, DIALOG_STYLE_LIST, "{00FF00}Attachamets Settings", "{00FF00}Show hold on each your spawn\n{FF0000}Remove hold after spawn", "(Select)", "Cancel" );
}
}
Pls someone help
Re: Need Help with Attachment -
Vaishnav - 25.07.2014
pls someone help ...
Re: Need Help with Attachment -
Threshold - 25.07.2014
pawn Код:
case DIALOG_HOLD:
{
if(!response) return 1;
switch(listitem)
{
case 0:
{
new fstr[45];
gsString = EOS; //Global string? Not the best idea.
for(new o = 0; o < sizeof(ObjectInfo); o++)
{
//Check if 'ObjectInfo[o][o_n]' is valid?
//if(!ObjectInfo[o][o_n]) continue;
format(fstr, sizeof(fstr), (!o) ? ("{FF0000}%d) "W"%s") : ("\n{FF0000}%d) "W"%s"), o, ObjectInfo[o][o_n]);
strcat(gsString, fstr);
}
ShowPlayerDialog(playerid, DIALOG_SELECT_HOLD, DIALOG_STYLE_LIST, "{FF9900}Hold - Objects", gsString, "Hold", "Cancel");
}
case 1:
{
gsString = EOS;
new var = MAX_PLAYER_ATTACHED_OBJECTS;
for(new x = 0; x < var; x++)
{
if(IsPlayerAttachedObjectSlotUsed(playerid, x))
format(fstr, sizeof(fstr), (x == (var - 1)) ? ("{FFA500}Slot {1589FF}%d {FF0000}(Used)") : ("{FFA500}Slot {1589FF}%d {FF0000}(Used)\n"), x);
else format(fstr, sizeof(fstr), (x == (var - 1)) ? ("{FFA500}Slot {1589FF}%d") : ("{FFA500}Slot {1589FF}%d\n"), x);
strcat(gsString, fstr);
}
ShowPlayerDialog(playerid, DIALOG_ATTACH_INDEX_SELECTION, DIALOG_STYLE_LIST, "{FF0000}Create new hold - Index Selection", gsString, "(Select)", "Cancel");
}
case 2: ShowPlayerDialog(playerid, DIALOG_ATTACH_SETTINGS, DIALOG_STYLE_LIST, "{00FF00}Attachamets Settings", "{00FF00}Show hold on each your spawn\n{FF0000}Remove hold after spawn", "(Select)", "Cancel");
}
return 1;
}
I don't recommend that you use global strings for this... (Referring to 'gsString')
Re: Need Help with Attachment -
Vaishnav - 25.07.2014
Thank you so much bro
![Smiley](images/smilies/smile.png)
and yea u r right I am not using anymore that Global string thanks for the code and for the suggestion
![Smiley](images/smilies/smile.png)
+repp
Re: Need Help with Attachment -
Threshold - 25.07.2014
Oh yeah, and I am missing a 'new fstr[45];' under 'case 1', but I assume you have already fixed that.