13.01.2010, 20:20
pawn Code:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == 1 && response) // If the dialogid is 1 (our dialog) and they pressed 'Purchase'
{
new file[128];
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(file,sizeof(file),"SDM/Accounts/%s.ini",name);
PlayerInfo[playerid][Deathstreak] = dini_Int(file, "Deathstreak");
// We'll use the switch/cases now because we're going to process a few results, not just one. Remember, the first item in the list has id 0.
switch(listitem)
{
case 0:
{
if(PlayerInfo[playerid][Deathstreak] == 2) return GivePlayerWeapon(playerid, 1, 1); SendClientMessage(playerid, COLOR_WHITE, "You have been given some brass knuckles as a death reward."); PlayerInfo[playerid][Deathstreak] = 0;
SendClientMessage(playerid, COLOR_WHITE, "You don't have a high enough deathstreak. Go die some more.");
}
case 1:
{
if(PlayerInfo[playerid][Deathstreak] == 3) return GivePlayerWeapon(playerid, 2, 1); SendClientMessage(playerid, COLOR_WHITE, "You have been given a golf club as a death reward."); PlayerInfo[playerid][Deathstreak] = 0;
SendClientMessage(playerid, COLOR_WHITE, "You don't have a high enough deathstreak. Go die some more.");
}
case 2:
{
if(PlayerInfo[playerid][Deathstreak] == 4) return GivePlayerWeapon(playerid, 3, 1); SendClientMessage(playerid, COLOR_WHITE, "You have been given a night stick as a death reward."); PlayerInfo[playerid][Deathstreak] = 0;
SendClientMessage(playerid, COLOR_WHITE, "You don't have a high enough deathstreak. Go die some more.");
}
}
}
return 1;
}