Different textdraw for each player
#1

Hi, im trying to show a textdraw for each player, but i can't get it to show the correct value to the correct player... this is what i've done :

at the top :
Code:

new Text:TextDrawsd[MAX_PLAYERS];

and above :
Code:

public OnPlayerConnect(playerid) {
TextDrawsd[playerid] = TextDrawCreate(549.0,310.0," ");
TextDrawShowForPlayer(playerid,TextDrawsd[playerid]);
return 1;
}

public OnPlayerDisconnect(playerid, reason) {
TextDrawDestroy(TextDrawsd[playerid]);
return 1;
}

im updating the textdraw with :
Code:

TextDrawSetString(TextDrawsd[playerid], "Some text here");

But all the textdraw show to the same player and all others players don't see any textdraw. how can i fix this?

Thank you for your help
Reply
#2

Where is that TextDrawSetString ?
Reply
#3

its not what i mean, i want to show info about the player like his position and things like that, so its different for each player
Reply
#4

Its still always the first player that is seeing the textdraw, it is really weird... i think it come from the setplayerstring
pawn Код:
TextDrawSetString(TextDrawsd[playerid], ess);
Reply
#5

player 0 see, for example,how much gas is in his tank, than go to value of player 1's tank, than go back to his.
player 1 see nothing
Reply
#6

yes, it is in a timer... how would i fix it?
Reply
#7

No probleme, i've got to go too after this.

Well, this is the timer function (i know its really not efficient and all, but i wanted to do it with mysql)

pawn Код:
public gaz(vehicleid, playerid) {
    new engine, lights, alarm, doors, bonnet, boot, objective;
    GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
    new query[100];
    format(query, sizeof(query), "SELECT gas FROM `car` WHERE `id` = %i", vehicleid);
    mysql_query(query);
    mysql_store_result();
    new gas = mysql_fetch_int();
    mysql_free_result();
    if(engine == 1) {
        if(gas > 0) {
            if((gas-1) < 1) {
            gas = 0;
            SetVehicleParamsEx(vehicleid,0,lights,alarm,doors,bonnet,boot,objective);
            new query1[100];
            format(query1, sizeof(query1), "UPDATE `car` SET `gas` = %i WHERE `id` = %i;", gas, vehicleid);
            mysql_query(query1);
            }
            else {
                gas = gas-1;
                new query1[100];
                format(query1, sizeof(query1), "UPDATE `car` SET `gas` = %i WHERE `id` = %i;", gas, vehicleid);
                mysql_query(query1);
            }
        }
        else {
            SetVehicleParamsEx(vehicleid,0,lights,alarm,doors,bonnet,boot,objective);
        }
    }
    new ess[15];
    format(ess, sizeof(ess), "Fuel: %i%%", gas);
    TextDrawSetString(TextDrawsd[playerid], ess);
    return 1;
}
Reply
#8

its a onplayerentervehicle, but i might do a loop that go throug all player and check if they are in a vehicle.

where should i put it?
Reply
#9

Show how you set the timer.
Reply
#10

why do you need this? my timer is working and i am transmiting my variable playerid with settimerex
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)