Pogodno je za RP servere,koristiti cemo komandu /smoke.
1.Includeovi koji ce biti potrebni:
Code:
#include <a_samp>
#include <zcmd>
#include <dini>
#include <sscanf>
Pored toga cemo definisati boje koje cemo koristiti:
Code:
#define red 0xFF0000AA
#define green 0x45E01FFF
Zatim cemo dodati nove varijable:
Code:
new Cig[MAX_PLAYERS];
Sada idite u OnPlayerSpawn i stavite :
Code:
public OnPlayerSpawn(playerid)
{
SetPlayerCheckpoint(playerid, 362.0257, 173.7207, 1008.3828, 1.0);
                            //coord:x   coord:y   coord:z    Size
return 1;
}
Sada idite u OnPlayerEnterCheckpoint i stavite :
Code:
public OnPlayerEnterCheckpoint(playerid)
{
    
    ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "24/7 Shop","Cigerette", "Buy", "Exit");
    return 1;
}
Sada cemo napraviti dialog:
Code:
if(dialogid == 1)
        {
        switch(listitem)
        {
        case 0:{
        if(response == 1)SendClientMessage(playerid, green, "Kupili ste kutiju cigareta!");
        Cig[playerid] = 5;
        if(GetPlayerMoney(playerid) < 25) return SendClientMessage(playerid,red,"Nnemate dovoljno novca,kutija cigareta kosta $25.");
        GivePlayerMoney(playerid, -25);
        }
}
Sada cemo srediti komandu:
Code:
COMMAND:bag(playerid, params[])
{
    SendClientMessage(playerid, Yellow,"-------Bag-------");
    new string[MAX_PLAYERS];
    format(string,sizeof(string),"Ciggerette: %d",Cig[playerid]);
    SendClientMessage(playerid,green,string);
    return 1;
}
Code:
COMMAND:smoke(playerid, params[])
{
    if(Cig[playerid] == 0) return SendClientMessage(playerid,red,"Nemas cigaretu!");
    SetPlayerSpecialAction(playerid, SPECIAL_ACTION_SMOKE_CIGGY);
    SendClientMessage(playerid,green,"Zapalio si cigaretu!");
    Cig[playerid] --;
    return 1;
}