dialog_style_list problem.
#1

Hello again , so this time I am trying to create a weapon shop, but I am not willing to create a simple one, which will take the player money state to negative (-). I want to create a good weapon shop which will check if the player has enough money on him, to buy a weapon, if so he will be able to purchase if no he will recive a message that he can't afford that weapon etc...

And another question is, how to give player money on every kill he makes? And to make the score raise by 1.
P.S. - It shall show the killers name aswell.

Thanks in advance, sorry if it's a bit complicated I will not forget to +rep .
Reply
#2

First question:
pawn Код:
if(GetPlayerMoney(playerid) < 5000)        // Checks if the player has less than required (This case $5000)
return SendClientMessage(playerid, -1, "You don't have enough money to buy this weapon!");
// Sends message and does NOT give the weapon to the player (Notice the "return").
// If the player has the money, proceed with this code.
GivePlayerMoney(playerid, -5000);
GivePlayerWeapon(playerid, 23, 500);
SendClientMessage(playerid, -1, "You have bought a Silenced Pistol for $5000.");
Second question:
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    SendDeathMessage(killerid, playerid, reason);      // Shows on the right side of your screen the info with killer's name, killed player's name and a small picture of the weapon used to kill.
    if(killerid != INVALID_PLAYER_ID)  // Checks if the killer is connected.
    {
        GivePlayerMoney(killerid, 500); // Gives the killer $500.
        SetPlayerScore(killerid, GetPlayerScore(killerid) + 1); // Gives the killer 1 score.
    }
    return 1;
}
Note: This is easily found by searching...
Reply
#3

Quote:
Originally Posted by Dragonsaurus
Посмотреть сообщение
First question:
pawn Код:
if(GetPlayerMoney(playerid) < 5000)        // Checks if the player has less than required (This case $5000)
return SendClientMessage(playerid, -1, "You don't have enough money to buy this weapon!");
// Sends message and does NOT give the weapon to the player (Notice the "return").
// If the player has the money, proceed with this code.
GivePlayerMoney(playerid, -5000);
GivePlayerWeapon(playerid, 23, 500);
SendClientMessage(playerid, -1, "You have bought a Silenced Pistol for $5000.");
Second question:
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    SendDeathMessage(killerid, playerid, reason);      // Shows on the right side of your screen the info with killer's name, killed player's name and a small picture of the weapon used to kill.
    if(killerid != INVALID_PLAYER_ID)  // Checks if the killer is connected.
    {
        GivePlayerMoney(killerid, 500); // Gives the killer $500.
        SetPlayerScore(killerid, GetPlayerScore(killerid) + 1); // Gives the killer 1 score.
    }
    return 1;
}
Note: This is easily found by searching...
Thanks and I was really trying to find something like that but all I found is simple filterscripts without any tutorials, and as I said I am new to scripting and I am trying to learn every function to see what does that mean..
Anyways thanks again this was helpful.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)