Quote:
Originally Posted by Cypress
See the screenshot with the mp5...
|
lol, the mp5 is turned, but this is not the real problem:
THIS IS THE PROBLEM: When you switch weapon the old weapon stays.
I have the solution to this bug:
This is your OnDialogResponse
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == weaponmodels)
{
switch(listitem)
{
case 0:
{
SetPlayerAttachedObject( playerid, 0, 2044, 6, 0.100000, 0.000000, 0.000000, 90.000000, 0.000000, 0.000000, 2.500000, 3.20000, 5.00000 ); // CJ_MP5K - Replaces MP5
GivePlayerWeapon(playerid, 29, 500000000); // you could change the amount or even remove this if it doesn't apply to you're gm
}
case 1:
{
SetPlayerAttachedObject( playerid, 0, 2045, 6, 0.039999, 0.000000, 0.250000, 90.000000, 0.000000, 0.000000, 3.800000, 1.300000, 3.800000 ); // CJ_BBAT_NAILS - Replaces Bat
GivePlayerWeapon(playerid, 5, 500000000); // you could change the amount or even remove this if it doesn't apply to you're gm
}
case 2:
{
SetPlayerAttachedObject( playerid, 0, 2036, 6, 0.300000, 0.0000000, 0.020000, 90.000000, 358.000000, 0.000000, 1.000000,1.90000, 3.000000 ); // CJ_psg1 - Replaces ak47
GivePlayerWeapon(playerid, 30, 500000000); // you could change the amount or even remove this if it doesn't apply to you're gm
}
case 3:
{
SetPlayerAttachedObject( playerid, 0, 2976, 6, -0.100000, 0.000000, 0.100000, 0.000000, 80.000000, 0.000000, 1.000000, 1.000000, 1.500000 ); // green_gloop - Replaces Spas
GivePlayerWeapon(playerid, 27, 500000000); // you could change the amount or even remove this if it doesn't apply to you're gm
}
}
}
return 1;
}
Just detach the attached object before SetPlayerAttachedObject:
pawn Код:
RemovePlayerAttachedObject(playerid,0);
Working OnDialogResponse:
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == weaponmodels)
{
switch(listitem)
{
case 0:
{
RemovePlayerAttachedObject(playerid,0);
SetPlayerAttachedObject( playerid, 0, 2044, 6, 0.100000, 0.000000, 0.000000, 90.000000, 0.000000, 0.000000, 2.500000, 3.20000, 5.00000 ); // CJ_MP5K - Replaces MP5
GivePlayerWeapon(playerid, 29, 500000000); // you could change the amount or even remove this if it doesn't apply to you're gm
return 1;
}
case 1:
{
RemovePlayerAttachedObject(playerid,0);
SetPlayerAttachedObject( playerid, 0, 2045, 6, 0.039999, 0.000000, 0.250000, 90.000000, 0.000000, 0.000000, 3.800000, 1.300000, 3.800000 ); // CJ_BBAT_NAILS - Replaces Bat
GivePlayerWeapon(playerid, 5, 500000000); // you could change the amount or even remove this if it doesn't apply to you're gm
return 1;
}
case 2:
{
RemovePlayerAttachedObject(playerid,0);
SetPlayerAttachedObject( playerid, 0, 2036, 6, 0.300000, 0.0000000, 0.020000, 90.000000, 358.000000, 0.000000, 1.000000,1.90000, 3.000000 ); // CJ_psg1 - Replaces ak47
GivePlayerWeapon(playerid, 30, 500000000); // you could change the amount or even remove this if it doesn't apply to you're gm
return 1;
}
case 3:
{
RemovePlayerAttachedObject(playerid,0);
SetPlayerAttachedObject( playerid, 0, 2976, 6, -0.100000, 0.000000, 0.100000, 0.000000, 80.000000, 0.000000, 1.000000, 1.000000, 1.500000 ); // green_gloop - Replaces Spas
GivePlayerWeapon(playerid, 27, 500000000); // you could change the amount or even remove this if it doesn't apply to you're gm
return 1;
}
}
}
return 0;//use return 0 on this callback
}