21.04.2014, 20:57
pawn Code:
//...
if(dialogid == dinputdepositoweed)
{
if(response)
{
for(new i = 0; i < MAX_CASE; i++)
{
for(new j = 0; j < MAX_PLAYERS; j++)
{
new hfile[34];
format(hfile,34,casafile,i);
if(fexist(hfile))
{
new Weed;
sscanf(inputtext[playerid],"i",Weed);
if(Weed > pinfo[j][weed]) return SendClientMessage(playerid,-1,"[SERVER] You havent the ammount that you have typed");
if(strlen(inputtext[playerid]) > 7) return SendClientMessage(playerid,-1,"[SERVER] Error.");
if(strlen(inputtext[playerid]) < 1) return SendClientMessage(playerid,-1,"[SERVER] Error.");
if(strval(inputtext[playerid]) > 99999999) return SendClientMessage(playerid,-1,"[SERVER] Error.");
new INI:file = INI_Open(hfile);
INI_WriteInt(file,"Weed",cinfo[i][weed] + Weed);
INI_Close(file);
cinfo[i][weed] = cinfo[i][weed] + Weed;
pinfo[j][weed] = pinfo[j][weed] - Weed;
SendClientMessage(playerid,-1,"[SERVER] You have deposited your weed");
new stringa[128];
format(stringa,128,"Your weed: %i",cinfo[i][weed]);
ShowPlayerDialog(playerid,9005,DIALOG_STYLE_INPUT,stringa,"Type ammount of grams that you want deposit in your house","Done!","Quit");
return 0;
}
}
}
}
}
if(dialogid == dinputritiroweed)
{
if(response)
{
for(new i = 0; i < MAX_CASE; i++)
{
for(new j = 0; j < MAX_PLAYERS; j++)
{
new hfile[34];
format(hfile,34,casafile,i);
if(fexist(hfile))
{
new Weed;
sscanf(inputtext[playerid],"i",Weed);
if(Weed > cinfo[i][weed]) return SendClientMessage(playerid,-1,"[SERVER] You havent the ammount that you have typed");
if(strlen(inputtext[playerid]) > 7) return SendClientMessage(playerid,-1,"[SERVER] Error.");
if(strlen(inputtext[playerid]) < 1) return SendClientMessage(playerid,-1,"[SERVER] Error.");
if(strval(inputtext[playerid]) > 99999999) return SendClientMessage(playerid,-1,"[SERVER] Error.");
new INI:file = INI_Open(hfile);
INI_WriteInt(file,"Weed",cinfo[i][weed] - Weed);
INI_Close(file);
cinfo[i][weed] = cinfo[i][weed] - Weed;
pinfo[j][weed] = pinfo[j][weed] + Weed;
SendClientMessage(playerid,-1,"[SERVER] You have withdraw your weed");
new stringa[128];
format(stringa,128,"Your weed: %i",cinfo[i][weed]);
ShowPlayerDialog(playerid,9006,DIALOG_STYLE_INPUT,stringa,"Type ammount of grams that you want withdraw from your house","Done!","Quit");
return 0;
}
}
}
}
}
if(dialogid == dinputdepositoseeds)
{
if(response)
{
for(new i = 0; i < MAX_CASE; i++)
{
for(new j = 0; j < MAX_PLAYERS; j++)
{
new hfile[34];
format(hfile,34,casafile,i);
if(fexist(hfile))
{
new Seeds;
sscanf(inputtext[playerid],"i",Seeds);
if(Seeds > pinfo[j][seeds]) return SendClientMessage(playerid,-1,"[SERVER] You havent the ammount that you have typed");
if(strlen(inputtext[playerid]) > 7) return SendClientMessage(playerid,-1,"[SERVER] Error.");
if(strlen(inputtext[playerid]) < 1) return SendClientMessage(playerid,-1,"[SERVER] Error.");
if(strval(inputtext[playerid]) > 99999999) return SendClientMessage(playerid,-1,"[SERVER] Error.");
new INI:file = INI_Open(hfile);
INI_WriteInt(file,"Seeds",cinfo[i][seeds] + Seeds);
INI_Close(file);
cinfo[i][seeds] = cinfo[i][seeds] + Seeds;
pinfo[j][seeds] = pinfo[j][seeds] - Seeds;
SendClientMessage(playerid,-1,"[SERVER] You have deposited your Seeds");
new stringa[128];
format(stringa,128,"Your seeds: %i",cinfo[i][seeds]);
ShowPlayerDialog(playerid,9007,DIALOG_STYLE_INPUT,stringa,"Type ammount of seeds that you want withdraw from your house","Done!","Quit");
return 0;
}
}
}
}
}
if(dialogid == dinputritiroseeds)
{
if(response)
{
for(new i = 0; i < MAX_CASE; i++)
{
for(new j = 0; j < MAX_PLAYERS; j++)
{
new hfile[34];
format(hfile,34,casafile,i);
if(fexist(hfile))
{
new Seeds;
sscanf(inputtext[playerid],"i",Seeds);
if(Seeds > cinfo[i][seeds]) return SendClientMessage(playerid,-1,"[SERVER] You havent the ammount that you have typed");
if(strlen(inputtext[playerid]) > 7) return SendClientMessage(playerid,-1,"[SERVER] Error.");
if(strlen(inputtext[playerid]) < 1) return SendClientMessage(playerid,-1,"[SERVER] Error.");
if(strval(inputtext[playerid]) > 99999999) return SendClientMessage(playerid,-1,"[SERVER] Error.");
new INI:file = INI_Open(hfile);
INI_WriteInt(file,"Seeds",cinfo[i][seeds] - Seeds);
INI_Close(file);
cinfo[i][seeds] = cinfo[i][seeds] - Seeds;
pinfo[j][seeds] = pinfo[j][seeds] + Seeds;
SendClientMessage(playerid,-1,"[SERVER] You have withdraw your seeds");
new stringa[128];
format(stringa,128,"Your seeds: %i",cinfo[i][seeds]);
ShowPlayerDialog(playerid,9008,DIALOG_STYLE_INPUT,stringa,"Type ammount of seeds that you want withdraw from your house","Done!","Quit");
return 0;
}
}
}
}
}
return 0;
}