26.02.2013, 23:20
(
Последний раз редактировалось IGp; 27.02.2013 в 10:39.
)
Jб tem varios post desse , mas vou te ajudar !
Qual quer duvida so fala !
pawn Код:
if(strcmp(cmd, "/criarcasa", true) == 0)
{
if(IsPlayerAdmin(playerid)) {
for(new c = 0; c < MAX_CASAS; c++) {
new preco, int;
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, Vermelho, "/criarcasa [preзo] [interiorID]");
return 1;
}
preco = strval(tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, Vermelho, "/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_Set(string,"Mensagemc","Nenhuma");
dini_IntSet(string, "Preco", preco);
dini_IntSet(string, "Trancada", 0);
new pickupid;
pickupid = CreatePickup(1273, 1, dini_Float(string, "PosX"), dini_Float(string, "PosY"), dini_Float(string, "PosZ"), -1);
dini_IntSet(string, "Id", pickupid);
new Casa2[128];
format(Casa2, sizeof(Casa2),"Casa ID %d", proximacasa);
CasaTxT[c] = Create3DTextLabel(Casa2,-1,dini_Float(string, "PosX"), dini_Float(string, "PosY"), dini_Float(string, "PosZ")+0.75,20.0,0,1);
new string2[256];
format(string2, sizeof(string2),"| INFO | Vocк criou uma casa! ID da casa: %d / Preзo: %d / Interior: %d.",proximacasa, preco, int);
SendClientMessage(playerid,0xFFFFFFAA,string2);
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, x, y, z);
SetPlayerMapIcon( playerid, 21, x, y, z, 31, 0, MAPICON_GLOBAL );
}
proximacasa++;
}
}
return 1;
}
pawn Код:
if(strcmp(cmdtext, "/comprarcasa", true) == 0)
{
for(new c = 0; c < MAX_CASAS; c++) {
format(string, sizeof(string), "/Casas/casa%d.ini", c);
if(dini_Exists(string)) {
if(IsPlayerInRangeOfPoint(playerid, 2.0, dini_Float(string, "PosX"), dini_Float(string, "PosY"), dini_Float(string, "PosZ"))) {
if(dini_Int(string, "TDono") == 0) {
if(GetPlayerGrana(playerid) >= dini_Int(string, "Preco")) {
if(GetCasas(playerid) < 1) {
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
dini_IntSet(string, "TDono", 1);
dini_Set(string, "Dono", pname);
GivePlayerGrana(playerid, -dini_Int(string, "Preco"));
new pickupid;
DestroyPickup(dini_Int(string, "Id"));
pickupid = CreatePickup(1272, 1, dini_Float(string, "PosX"), dini_Float(string, "PosY"), dini_Float(string, "PosZ"), -1);
dini_IntSet(string, "Id", pickupid);
new str[128];
format(str, sizeof(str), "| CASAS | O jogador %s comprou a casa ID %d.", pname, c);
SendClientMessageToAll(0xC0C0C0AA, str);
GameTextForPlayer(playerid,"~w~Casa comprada!", 2000, 1);
new Casa2[128];
format(Casa2, sizeof(Casa2), "Casa ID %d",c);
Update3DTextLabelText(CasaTxT[c],-1, Casa2);
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
SetPlayerMapIcon( playerid, 12, x, y, z, 32, 0, MAPICON_GLOBAL );
OnPlayerCommandText(playerid, "/nascercasa");
}
else {
SendClientMessage(playerid, Vermelho, "| ERRO | Vocк sу pode ter uma casa!");
}
}
else {
SendClientMessage(playerid, Vermelho, "| ERRO | Vocк nгo tem dinheiro!");
}
}
else {
SendClientMessage(playerid, Vermelho, "| ERRO | Esta casa nгo estб a venda!");
}
}
else {
}
}
}
return 1;
}
pawn Код:
if(strcmp(cmdtext, "/vendercasa", true) == 0)
{
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
format(file, sizeof(file), P_CONTAS, pname);
for(new c = 0; c < MAX_CASAS; c++) {
format(string, sizeof(string), "/Casas/casa%d.ini", c);
if(dini_Exists(string)) {
if(IsPlayerInRangeOfPoint(playerid, 2.0, dini_Float(string, "PosX"), dini_Float(string, "PosY"), dini_Float(string, "PosZ"))) {
if(dini_Int(string, "TDono") == 1) {
if(strcmp(dini_Get(string, "Dono"), pname, true) == 0 || IsAdmin[playerid] == 1 || IsPlayerAdmin(playerid)) {
if(strcmp(dini_Get(string, "Dono"), pname, true) == 0) {
dini_FloatSet(file,"CasaX",Float:1410.5046);
dini_FloatSet(file,"CasaY",Float:-1789.7197);
dini_FloatSet(file,"CasaZ",Float:13.8285);
}
dini_IntSet(string, "TDono", 0);
dini_Set(string, "Dono", "Ninguem");
GivePlayerGrana(playerid, dini_Int(string, "Preco"));
new pickupid;
DestroyPickup(dini_Int(string, "Id"));
pickupid = CreatePickup(1273, 1, dini_Float(string, "PosX"), dini_Float(string, "PosY"), dini_Float(string, "PosZ"), -1);
dini_IntSet(string, "Id", pickupid);
new Casa[128];
new str[128];
format(Casa, sizeof(Casa),"Casa ID %d", c);
Update3DTextLabelText(CasaTxT[c],-1, Casa);
format(str, sizeof(str), "| CASAS | O jogador %s vendeu a casa ID %d.", pname, c);
SendClientMessageToAll(0xC0C0C0AA, str);
GameTextForPlayer(playerid,"~w~Casa vendida!", 2000, 1);
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
SetPlayerMapIcon( playerid, 31, x, y, z, 31, 0, MAPICON_GLOBAL );
//}
}
else {
SendClientMessage(playerid, Vermelho, "| ERRO | Esta casa nгo й sua.");
}
}
else {
SendClientMessage(playerid, Vermelho, "| ERRO | Esta casa jб estб a venda !");
}
}
else {
}
}
}
return 1;
}