Different textdraw for each player -
gagnier91 - 09.12.2011
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
Re: Different textdraw for each player -
MadeMan - 09.12.2011
Where is that TextDrawSetString ?
Re : Different textdraw for each player -
gagnier91 - 09.12.2011
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
Re : Different textdraw for each player -
gagnier91 - 09.12.2011
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);
Re : Different textdraw for each player -
gagnier91 - 09.12.2011
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
Re : Different textdraw for each player -
gagnier91 - 09.12.2011
yes, it is in a timer... how would i fix it?
Re : Different textdraw for each player -
gagnier91 - 09.12.2011
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;
}
Re : Different textdraw for each player -
gagnier91 - 10.12.2011
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?
Re: Different textdraw for each player -
MadeMan - 10.12.2011
Show how you set the timer.
Re : Different textdraw for each player -
gagnier91 - 10.12.2011
why do you need this? my timer is working and i am transmiting my variable playerid with settimerex