13.05.2014, 11:06
well im bit confuse in this !
code is blow
i want when play buy a gun ! gun saves in PlayerInfo[ i] [wslot] and ammo in PlayerInfo[ i] [wslotammo]
can anyone tell me how can i do that
code is blow
pawn Код:
#define DIALOG_WEAPONS 91172
CMD:scs( playerid, params[])
{
format(gsString, sizeof(gsString),"Chainsaw (1 Ammo) 5 cookies\n9mm Silenced (300 Ammo) 10 Cookies\nDesert Eagle (300 Ammo) 10 Cookies\nTec9 (300 Ammo) 10 Cookies\nShotgun (300 Ammo) 10 Cookies\nMicro SMG (300 Ammo) 10 Cookies\nSawnoff Shotgun (300 Ammo) 15 Cookies\nCombat Shotgun (300 Ammo) 15 Cookies\nAK47 (300 Ammo) 15 Cookies\nM4 (300 Ammo) 15 Cookies\nFlamethrower (50 Ammo) 15 Cookies\nCountry Rifle (50 Ammo) 15 Cookies\nSniper (50 Ammo) 20 Cookies");
ShowPlayerDialog(playerid, DIALOG_WEAPONS, DIALOG_STYLE_LIST, "YRS Spend Cookies Dialog...",gsString , "Select", "Cancel");
return 1;
}
CMD:spendcookies( playerid, params[])
{
return cmd_scs(playerid, params);
}
if(dialogid == DIALOG_WEAPONS)
{
if(response) // If they clicked 'Select' or double-clicked a weapon
{
// Give them the weapon
switch(listitem)
{
case 0:
{
for (new i = 0; i < 13; i++)
{
GivePlayerWeapon(playerid, 9, 1); // Give them a desert eagle
PlayerInfo[ playerid ][ Cookies ] -= 5;
GetPlayerWeaponData(playerid, 0, PlayerInfo[ i ][ wslot ], PlayerInfo[ i ][ wslotammo ]);
}
}
case 1:
{
for (new i = 0; i < 13; i++)
{
GivePlayerWeapon(playerid, 23, 300); // Give them an AK-47
PlayerInfo[ playerid ][ Cookies ] -= 10;
GetPlayerWeaponData(playerid, 0, PlayerInfo[ i ][ wslot ], PlayerInfo[ i ][ wslotammo ]);
}
}
case 2:
{
for (new i = 0; i < 13; i++)
{
GivePlayerWeapon(playerid, 24, 300); // Give them a Combat Shotgun
PlayerInfo[ playerid ][ Cookies ] -= 10;
GetPlayerWeaponData(playerid, 0, PlayerInfo[ i ][ wslot ], PlayerInfo[ i ][ wslotammo ]);
}
}
case 3:
{
for (new i = 0; i < 13; i++)
{
GivePlayerWeapon(playerid, 32, 300); // Give them a desert eagle
PlayerInfo[ playerid ][ Cookies ] -= 10;
GetPlayerWeaponData(playerid, 0, PlayerInfo[ i ][ wslot ], PlayerInfo[ i ][ wslotammo ]);
}
}
case 4:
{
for (new i = 0; i < 13; i++)
{
GivePlayerWeapon(playerid, 25, 300); // Give them an AK-47
PlayerInfo[ playerid ][ Cookies ] -= 10;
GetPlayerWeaponData(playerid, 0, PlayerInfo[ i ][ wslot ], PlayerInfo[ i ][ wslotammo ]);
}
}
case 5:
{
for (new i = 0; i < 13; i++)
{
GivePlayerWeapon(playerid, 28, 300); // Give them a Combat Shotgun
PlayerInfo[ playerid ][ Cookies ] -= 10;
GetPlayerWeaponData(playerid, 0, PlayerInfo[ i ][ wslot ], PlayerInfo[ i ][ wslotammo ]);
}
}
case 6:
{
for (new i = 0; i < 13; i++)
{
GivePlayerWeapon(playerid, 26 , 300); // Give them a desert eagle
PlayerInfo[ playerid ][ Cookies ] -= 15;
GetPlayerWeaponData(playerid, 0, PlayerInfo[ i ][ wslot ], PlayerInfo[ i ][ wslotammo ]);
}
}
case 7:
{
for (new i = 0; i < 13; i++)
{
GivePlayerWeapon(playerid, 27, 300); // Give them an AK-47
PlayerInfo[ playerid ][ Cookies ] -= 15;
GetPlayerWeaponData(playerid, 0, PlayerInfo[ i ][ wslot ], PlayerInfo[ i ][ wslotammo ]);
}
}
case 8:
{
for (new i = 0; i < 13; i++)
{
GivePlayerWeapon(playerid, 30, 300); // Give them a Combat Shotgun
PlayerInfo[ playerid ][ Cookies ] -= 15;
GetPlayerWeaponData(playerid, 0, PlayerInfo[ i ][ wslot ], PlayerInfo[ i ][ wslotammo ]);
}
}
case 9:
{
for (new i = 0; i < 13; i++)
{
GivePlayerWeapon(playerid, 31, 300); // Give them a desert eagle
PlayerInfo[ playerid ][ Cookies ] -= 15;
GetPlayerWeaponData(playerid, 0, PlayerInfo[ i ][ wslot ], PlayerInfo[ i ][ wslotammo ]);
}
}
case 10:
{
for (new i = 0; i < 13; i++)
{
GivePlayerWeapon(playerid, 37, 50); // Give them an AK-47
PlayerInfo[ playerid ][ Cookies ] -= 15;
GetPlayerWeaponData(playerid, 0, PlayerInfo[ i ][ wslot ], PlayerInfo[ i ][ wslotammo ]);
}
}
case 11:
{
for (new i = 0; i < 13; i++)
{
GivePlayerWeapon(playerid, 33, 50); // Give them a Combat Shotgun
PlayerInfo[ playerid ][ Cookies ] -= 15;
GetPlayerWeaponData(playerid, 0, PlayerInfo[ i ][ wslot ], PlayerInfo[ i ][ wslotammo ]);
}
}
case 12:
{
for (new i = 0; i < 13; i++)
{
GivePlayerWeapon(playerid, 34, 50); // Give them a Combat Shotgun
PlayerInfo[ playerid ][ Cookies ] -= 20;
GetPlayerWeaponData(playerid, 0, PlayerInfo[ i ][ wslot ], PlayerInfo[ i ][ wslotammo ]);
}
}
}
}
return 1; // We handled a dialog, so return 1. Just like OnPlayerCommandText.
}
i want when play buy a gun ! gun saves in PlayerInfo[ i] [wslot] and ammo in PlayerInfo[ i] [wslotammo]
can anyone tell me how can i do that