15.05.2014, 11:07
Well, I've opened a thread regarding loading the houses from the MySQL database. I've solved that issue now. Now I'm facing a weird problem!
1st problem:
- When I use /createhouse in-game, it takes me inside the house and it works perfectly! My system requires me to set the house exit using KEY_FIRE. When I press the fire key, The server says "House Exit has been setted". But, the checkpoint doesn't appear.
But, I used another way and made it like this:
When I use this, it says that the exit is created, but I can't see the checkpoint. Later, I changed it like this:
And yeah, the checkpoint appeared. The problem 2 starts from here
- When I stood on that checkpoint, it spawned me at 0,0,0 (blueberry acres). Even though the entering positions are setted.
Using KEY_FIRE to set the house exit
While entering the checkpoint
1st problem:
- When I use /createhouse in-game, it takes me inside the house and it works perfectly! My system requires me to set the house exit using KEY_FIRE. When I press the fire key, The server says "House Exit has been setted". But, the checkpoint doesn't appear.
But, I used another way and made it like this:
pawn Код:
HouseInfo[ID][OneTimeExit] = CreateDynamicCP(HouseInfo[ID][IntX],HouseInfo[ID][IntY],HouseInfo[ID][IntZ],1.5,HouseInfo[ID][hWorld],-1,-1,50.0);
pawn Код:
HouseInfo[ID][OneTimeExit] = CreateDynamicCP(HouseInfo[ID][IntX],HouseInfo[ID][IntY],HouseInfo[ID][IntZ],1.5,-1,-1,-1,50.0);
- When I stood on that checkpoint, it spawned me at 0,0,0 (blueberry acres). Even though the entering positions are setted.
Using KEY_FIRE to set the house exit
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(newkeys & KEY_FIRE)
{
if(pInfo[playerid][SettingHouseExit] == 1)
{
new Float:x,Float:y,Float:z, ID = HousesCreated;
GetPlayerPos(playerid,x,y,z);
HouseInfo[ID][IntX] = x;
HouseInfo[ID][IntY] = y;
HouseInfo[ID][IntZ] = z;
format(gQuery,sizeof gQuery,"UPDATE `"Houses_Table"` SET `IntX` = '%f', `IntY` = '%f', `IntZ` = '%f' WHERE `HouseID` = '%i'",HouseInfo[ID][IntX],HouseInfo[ID][IntY],HouseInfo[ID][IntZ],ID);
mysql_query(gQuery);
SendClientMessage(playerid,COLOR_BLUE,"[SERVER] "GREEN"House exit has been setted!");
HouseInfo[ID][HouseExitPickup] = CreateDynamicPickup(1273,23,HouseInfo[ID][IntX],HouseInfo[ID][IntY],HouseInfo[ID][IntZ],HouseInfo[ID][hWorld],-1,-1,20);
HouseInfo[ID][OneTimeExit] = CreateDynamicCP(HouseInfo[ID][IntX],HouseInfo[ID][IntY],HouseInfo[ID][IntZ],1.5,-1,-1,-1,50.0);
pInfo[playerid][SettingHouseExit] = 0;
}
}
return 1;
}
pawn Код:
public OnPlayerEnterDynamicCP(playerid,checkpointid)
{
for(new i=0; i<= HousesCreated; i++)
{
if(checkpointid == HouseInfo[i][OneTimeExit])
{
SetPlayerPos(playerid,HouseInfo[i][OutX]+1,HouseInfo[i][OutY]+2,HouseInfo[i][OutZ]+0.5);
SetPlayerInterior(playerid,0);
SetPlayerVirtualWorld(playerid,0);
}
if(IsValidDynamicCP(HouseInfo[i][OneTimeExit]))
{
DestroyDynamicCP(HouseInfo[i][OneTimeExit]);
SetPlayerPos(playerid,HouseInfo[i][OutX]+1,HouseInfo[i][OutY]+2,HouseInfo[i][OutZ]+0.5);
SetPlayerInterior(playerid,0);
SetPlayerVirtualWorld(playerid,0);
}
}
return 1;
}