#include <a_samp>
#include <zcmd>
#include <dini>
#include <sscanf>
new pHDD[MAX_PLAYERS];
public OnPlayerConnect(playerid) {
if(!fexist(\"hdd.txt\")) dini_Create(\"hdd.txt\");
if(dini_Isset(\"hdd.txt\", PlayerName(playerid))) pHDD[playerid] = dini_Int(\"hdd.txt\", PlayerName(playerid));
else pHDD[playerid] = 0;
return 1;
}
public OnPlayerDisconnect(playerid, reason) {
dini_IntSet(\"hdd.txt\", PlayerName(playerid), pHDD[playerid]);
return 1;
}
CMD:buyhdd(playerid, params[]) {
new hddid,
hddcash[] = { 0, 500, 2000, 500000 },
string[128];
if(sscanf(params, \"d\", hddid)) return SendClientMessage(playerid, -1, \"/buyhdd [hddid]\");
if(hddid < 1 || hddid < 3) return SendClientMessage(playerid, -1, \"1-3\");
dini_IntSet(\"hdd.txt\", PlayerName(playerid), hddid);
GivePlayerMoney(playerid, - hddcash[hddid]);
pHDD[playerid] = hddid;
format(string, sizeof(string), \"Vettél egy %d tipusú HDD-t!\", hddid);
return SendClientMessage(playerid, -1, string);
}
stock PlayerName(playerid) {
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
return name;
}
megcsinálom. ha nem elõz meg valaki.:rolleyes:
Kabbe, akkor nem fejezem be :D<3
<3
Kabbe, akkor nem fejezem be :D
befejezheted. kiváncsi vagyok rá. :crazy:
[/quote]
Delete. De én dialoggal csináltam :D
<3
Kabbe, akkor nem fejezem be :D
befejezheted. kiváncsi vagyok rá. :crazy:
[/quote]
Delete. De én dialoggal csináltam :D
[/quote]
dafaq.. nem olvastam végig.. mind1. :D
Dialogos
#include <a_samp>
#include <zcmd>
#include <dini>
new pHDD[MAX_PLAYERS];
public OnPlayerConnect(playerid) {
if(!fexist(\"hdd.txt\")) dini_Create(\"hdd.txt\");
if(dini_Isset(\"hdd.txt\", PlayerName(playerid))) pHDD[playerid] = dini_Int(\"hdd.txt\", PlayerName(playerid));
else pHDD[playerid] = 0;
return 1;
}
public OnPlayerDisconnect(playerid, reason) {
dini_IntSet(\"hdd.txt\", PlayerName(playerid), pHDD[playerid]);
return 1;
}
CMD:buyhdd(playerid, params[]) return ShowPlayerDialog(playerid, 1234, DIALOG_STYLE_INPUT, \"HDD Vendor\", \"Írd be milyet szeretnél\\n1\\t 500$\\n2\\t2000$\\n3\\t500000$\", \"Buy\", \"Close\");
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) {
if(dialogid == 1234) {
new hddcash[] = { 0, 500, 2000, 500000 },
string[128];
if(!response) return 1;
if(!strval(inputtext) || strval(inputtext) < 1 || strval(inputtext) > 3) return ShowPlayerDialog(playerid, 1234, DIALOG_STYLE_INPUT, \"HDD Vendor\", \"Elírtad.\\nÍrd be milyet szeretnél\\n1\\t 500$\\n2\\t2000$\\n3\\t500000$\", \"Buy\", \"Close\");
dini_IntSet(\"hdd.txt\", PlayerName(playerid), strval(inputtext));
GivePlayerMoney(playerid, - hddcash[strval(inputtext)]);
pHDD[playerid] = strval(inputtext);
format(string, sizeof(string), \"Vettél egy %d tipusú HDD-t!\", strval(inputtext));
return SendClientMessage(playerid, -1, string);
}
return 0;
}
stock PlayerName(playerid) {
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
return name;
}