help with SpawnPlayerAtHouse & RentFeeUp - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: help with SpawnPlayerAtHouse & RentFeeUp (
/showthread.php?tid=295430)
help with SpawnPlayerAtHouse & RentFeeUp -
System64 - 06.11.2011
hi all
I have 2 problems again and 'fight' with them 2 days!
First problem is: I have SpawnPlayerAtHouse and it just spawn me in house id 0 if im owner of it
pawn Код:
stock SpawnPlayerAtHouse(playerid)
{
for(new i = 0; i < MAX_HOUSES; i++)
{
if(!strcmp(HouseInfo[i][hOwner], GetName(playerid), false) || !strcmp(HouseInfo[i][hRentUser], GetName(playerid), false))
{
SetPlayerPos(playerid, HouseInfo[i][hExitX], HouseInfo[i][hExitY], HouseInfo[i][hExitZ]);
SetPlayerInterior(playerid, HouseInfo[i][hInterior]);
SetPlayerVirtualWorld(playerid, HouseInfo[i][hVirtualWorld]);
PlayerEnteredHisHouse[playerid] = true;
return i;
}
}
return 1;
}
Second problem: I made script that every one hour (In this case is one minute, just for testing) if player rent house than it takes his money and send into pocket money of house but when I pass 1 min it sends me 148 message: Rent Fee: 0 and it just take money of house that I rent
pawn Код:
SetTimer("RentFeeUp", 60000, 0);
public RentFeeUp()
{
for(new p = 0; p < MAX_PLAYERS; p++)
{
if(!IsPlayerConnected(p)) continue;
for(new i = 0; i < MAX_HOUSES; i++)
{
if(!strcmp(HouseInfo[i][hRentUser], GetName(p), false))
{
printf("Rent user of House ID %d is %s", i, HouseInfo[i][hRentUser]);
GivePlayerMoney(p, -HouseInfo[i][hRentPrice]);
HouseInfo[i][hMoney] += HouseInfo[i][hRentPrice];
format(hstring, sizeof(hstring), "Rent fee: %d", HouseInfo[i][hRentPrice]);
SendClientMessage(p, COLOR_LIME, hstring);
}
}
}
return 1;
}
Re: help with SpawnPlayerAtHouse & RentFeeUp -
Speed - 06.11.2011
pawn Код:
stock SpawnPlayerAtHouse(playerid)
{
for(new i = 0; i < MAX_HOUSES; i++)
{
if(strcmp(HouseInfo[playerid][hOwner], GetName(playerid), true) || strcmp(HouseInfo[playerid][hRentUser], GetName(playerid), true))
{
SetPlayerPos(playerid, HouseInfo[i][hExitX], HouseInfo[i][hExitY], HouseInfo[i][hExitZ]);
SetPlayerInterior(playerid, HouseInfo[i][hInterior]);
SetPlayerVirtualWorld(playerid, HouseInfo[i][hVirtualWorld]);
PlayerEnteredHisHouse[playerid] = true;
return i;
}
}
return 1;
}
try this
Re: help with SpawnPlayerAtHouse & RentFeeUp -
System64 - 06.11.2011
Quote:
Originally Posted by Speed
pawn Код:
stock SpawnPlayerAtHouse(playerid) { for(new i = 0; i < MAX_HOUSES; i++) { if(strcmp(HouseInfo[playerid][hOwner], GetName(playerid), true) || strcmp(HouseInfo[playerid][hRentUser], GetName(playerid), true)) { SetPlayerPos(playerid, HouseInfo[i][hExitX], HouseInfo[i][hExitY], HouseInfo[i][hExitZ]); SetPlayerInterior(playerid, HouseInfo[i][hInterior]); SetPlayerVirtualWorld(playerid, HouseInfo[i][hVirtualWorld]); PlayerEnteredHisHouse[playerid] = true; return i; } } return 1; }
try this
|
nope, I know that would not work because you need !strcmp() or strcmp() == 0, I tried that already
YEY, FIXED!