11.03.2011, 21:15
pawn Код:
for(new c = 0; c < MAX_CASAS; c++)
{
format(string, sizeof(string), "/Casas/casa%d.ini", c);
if(dini_Exists(string)){
if(pickupid == dini_Int(string, "Id")){
if(dini_Int(string, "TDono") == 1){
format(STRX, sizeof(STRX), "~b~]Casa]~n~~y~Dono:~w~%s~n~~r~ENTER", dini_Get(string, "Dono"));
GameTextForPlayer(playerid, STRX, 5000, 5);
} else {
format(STRX, sizeof(STRX), "~g~]Casa]~n~~y~Dono:~w~Ninguem~n~~y~Valor:~w~R$%d~n~~g~/comprarcasa~n~~r~ENTER", dini_Int(string, "Preco"));
GameTextForPlayer(playerid, STRX, 5000, 5);
}
}
}
}
pawn Код:
if(strcmp(cmd, "/criarcasa", true) == 0) {
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
if(pAdmin[playerid] == 5 || IsPlayerAdmin(playerid)){
new tmp[256];
new preco, int;
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)){
SendClientMessage(playerid, vclaro, "/criarcasa [preзo] [interiorID]");
return 1;
}
preco = strval(tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)){
SendClientMessage(playerid, vclaro, "/criarcasa [preзo] [interiorID]");
return 1;
}
int = strval(tmp);
format(string, sizeof(string), "/Casas/casa%d.ini", proximacasa);
if(!dini_Exists(string)){
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X, Y, Z);
dini_Create(string);
dini_FloatSet(string, "PosX", X);
dini_FloatSet(string, "PosY", Y);
dini_FloatSet(string, "PosZ", Z);
dini_IntSet(string, "Int", int);
dini_IntSet(string, "Mundo", proximacasa);
dini_IntSet(string, "TDono", 0);
dini_Set(string, "Dono", "Ninguem");
dini_IntSet(string, "Preco", preco);
dini_IntSet(string, "Trancada", 0);
dini_IntSet(string, "TMorador", 0);
dini_Set(string, "Morador", "Ninguem");
new pickupid;
pickupid = CreatePickup(1273, 1, dini_Float(string, "PosX"), dini_Float(string, "PosY"), dini_Float(string, "PosZ"), -1);
dini_IntSet(string, "Id", pickupid);
proximacasa++;
}
}
return 1;
}