TIMERS?!!?
#1

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?
Reply
#2

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.
Reply
#3

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??
Reply
#4

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
Reply
#5

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
Reply
#6

PMing sounds fun.
Reply


Forum Jump:


Users browsing this thread: