SA-MP Forums Archive
TIMERS?!!? - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: TIMERS?!!? (/showthread.php?tid=85182)



TIMERS?!!? - coole210 - 06.07.2009

Okay here's some code for my timer for my house system.

pawn Code:
public OnPlayerSpawn(playerid)
{
    SetTimer("GameTextTimer",1000,true);
//blablabla
The timer :

pawn Code:
forward GameTextTimer(playerid);
public GameTextTimer(playerid)
{
    new string[256];
    if(PlayerToPoint(3,playerid,Houses[playerid][EnterX],Houses[playerid][EnterY],Houses[playerid][EnterZ]))
    {
    format(string,sizeof(string),"~w~%s~n~~g~Owner: %s~n~~w~Price: %d~n~Rent: %d",Houses[playerid][Description],Houses[playerid][Owner],Houses[playerid][HousePrice],Houses[playerid][RentCost]);
    GameTextForPlayer(playerid, string, 500, 3);
    }
    return 1;
}

NO WARNINGS, NO GAMETEXT?


Re: TIMERS?!!? - ledzep - 06.07.2009

https://sampwiki.blast.hk/wiki/SetTimerEx
Code:
public OnPlayerSpawn(playerid)
{
	SetTimerEx("GameTextTimer", 1000, true, "i", playerid);
...
Your problem was that you the timer was calling the GameTextTimer, but wasn't supplying the intended playerid to the function.


Re: TIMERS?!!? - coole210 - 06.07.2009

Okay i still need help though.. If i go to ANY house now it always says its house ID 0! I bought ID 0 and EVERY house i go to says i own it. Says its a 1 room house.. How do i fix this??


Re: TIMERS?!!? - ledzep - 06.07.2009

The way you system (as far as I can tell) works right now is that players can only own houses that they have the same ID with.

So a player with ID 0 can only own house ID 0
a player with ID 57 can only own house ID 57
etc...

pawn Code:
Houses[playerid][...]
should be something like:

pawn Code:
Houses[houseid][...]
or if you store the owner variable within the player's stats, it should be something like:

pawn Code:
Player[playerid][houseOwner] // would equal the house ID that playerid owns
But this is merely an assumption.

Post your entire code: www.pastebin.com


Re: TIMERS?!!? - coole210 - 06.07.2009

I'm not going to post my 6k lines GM soon-to-be-24/7 server clean script no warnings no errors on pastebin! Add me on MSN i will show figments of it on pastebin.. coole210@hotmail.com For now i have 2 go though. PM me with you're msn or add me. If you don't have msn we can try Pming O.O


Re: TIMERS?!!? - ledzep - 06.07.2009

PMing sounds fun.