22.05.2013, 17:53
Hey guys, i have put in my gm a House System, i puted it, i entered in game, i went to a house pickup, but when i want to buy it with command /buy, nothing happens, in console appears:
This is my dcmd:buy command:
Help me please.
pawn Код:
[08:40:33] [debug] AMX backtrace:
[08:40:33] [debug] #0 000c4040 in dcmd_buy (playerid=0, params[]=@0x00117448 "") at C:\Users\David\Desktop\RAS-Server. FIXED\gamemodes\RAS_W.pwn:17659
[08:40:33] [debug] #1 000117f0 in public OnPlayerCommandReceived (playerid=0, cmdtext[]=@0x001d2d18 "/buy") at C:\Users\David\Desktop\RAS-Server. FIXED\gamemodes\RAS_W.pwn:2342
[08:40:33] [debug] #2 native CallLocalFunction () [00471e90] from samp-server.exe
[08:40:33] [debug] #3 0000a4a0 in public OnPlayerCommandText (playerid=0, cmdtext[]=@0x001d2d04 "/buy") at C:\Users\David\Desktop\RAS-Server. FIXED\pawno\include\zcmd.inc:85
pawn Код:
dcmd_buy(playerid,params[])
{
#pragma unused params
new str[255],str1[255],pname[24], housenumber;
housenumber = GetHouseID(playerid);
if(housenumber == -1) return SendClientMessage(playerid, c_r, "You are not in a house icon!");
GetPlayerName(playerid, pname, 24);
format(str1, sizeof(str1), "Houses/Users/%s", udb_encode(pname));
if(dini_Exists(str1))
{
if (dini_Int(str1, "Houseid")!=-255) return SendClientMessage(playerid, c_r, "You can only buy one house!");
}
format(str1, sizeof(str1), "Houses/houseid%d", housenumber);
if (strcmp(hInfo[housenumber][Name],"ForSale",true)) return SendClientMessage(playerid, c_r, "This house isn't for sale!");
if(GetPlayerScore(playerid)<hInfo[housenumber][Cost]) return SendClientMessage(playerid, c_r, "{FFF1AF}Nu ai {00C0FF}scor {FFAF00}destul!");
SendClientMessage(playerid, c_y, "You have bought the house!");
format(str, sizeof(str), "%s has bought houseid 0",pname);
print(str);
SetPlayerScore(playerid,GetPlayerScore(playerid)-hInfo[housenumber][Cost]);
dini_Set(str1, "Name", pname);
hInfo[housenumber][Name]=pname;
hInfo[housenumber][Locked] = dini_IntSet(str1,"Locked",0);
format(str1, sizeof(str1), "Houses/Users/%s", udb_encode(pname));
if (!dini_Exists(str1)) dini_Create(str1);
new Float:sy, Float:sx, Float:sz;
dini_IntSet(str1, "Houseid", housenumber);
if(!dini_Isset(str1,"Rentid"))
{
dini_IntSet(str1, "Rentid", -255);
}
GetPlayerPos(playerid, sx,sy,sz);
dini_FloatSet(str1, "SpawnX", sx);
dini_FloatSet(str1, "SpawnY", sy);
dini_FloatSet(str1, "SpawnZ", sz);
dini_IntSet(str1, "SpawnInt", GetPlayerInterior(playerid));
DestroyPickup(HousePickup[housenumber]);
HousePickup[housenumber] = CreatePickup(1272, 23, hInfo[housenumber][iconx], hInfo[housenumber][icony], hInfo[housenumber][iconz]);
return 1;
}