string changes textdraw for other player -
Stu1 - 01.11.2012
I have never been so baffled in my life so maybe you guys will know?
PHP код:
new pvehiclemodel = GetVehicleModel(GetPlayerVehicleID(playerid));
if (pvehiclemodel == 413 || pvehiclemodel == 482 || pvehiclemodel == 440 || pvehiclemodel == 414)
{
TextDrawHideForPlayer(playerid, NotWorking);
if (IsPlayerInMission[playerid] == 1) return SendClientMessage(playerid, 0xFF0000AA, ">> You are currently in a mission use \"/cancelmission\" to cancel your current mission!"); // prevents them from starting another mission
new string[500];
new rand = random(sizeof(TruckingMissionRandomlv));
IsPlayerInMission[playerid] = 1; // asign it to 1 becuase there in a mission
CreatePlayerMission(playerid, TruckingMissionRandomlv[rand][UseTrailerCheck], TruckingMissionRandomlv[rand][MissionPay], TruckingMissionRandomlv[rand][loadx],TruckingMissionRandomlv[rand][loady], TruckingMissionRandomlv[rand][loadz], TruckingMissionRandomlv[rand][unloadx],TruckingMissionRandomlv[rand][unloady], TruckingMissionRandomlv[rand][unloadz]);
format(string, sizeof(string), "%s", TruckingMissionRandomlv[rand][MissionName]);
SendClientMessage(playerid, 0x00FF00FF, string);
TextDrawSetString(Working,string);
TextDrawShowForPlayer(playerid, Working);
}
else
{
SendClientMessage(playerid, 0xFF0000AA, "You are not in the correct vehicle!");
}
Basically when someone else starts a mission the textdraw for all players changes to their mission
Re: string changes textdraw for other player -
Dusan01 - 01.11.2012
Textdraw define with: exaple:
Код:
new Text:TD1[MAX_PLAYER_NAME];
and creating with:
Код:
TD1[playerid] = TextDrawCreate(........);
and Shows And Hides With:
Код:
TextDrawHideForPlayer(playerid, TD1[playerid]);
To they cant mess up....
Re: string changes textdraw for other player -
Stu1 - 01.11.2012
That didn't work :/
Re: string changes textdraw for other player -
Stu1 - 01.11.2012
Thank you for your response, and I have added what dusan told me to do
here is my code now
my var define..
Код:
new Text:Working[MAX_PLAYER_NAME];
The textdraw..
Код:
for(new playerid=0; playerid<MAX_PLAYER_NAME; playerid++)
{
Working[playerid] = TextDrawCreate(320.000000, 427.000000, " ");
TextDrawBackgroundColor(Working[playerid], 255);
TextDrawFont(Working[playerid], 2);
TextDrawLetterSize(Working[playerid], 0.319999, 1.0100000);
TextDrawColor(Working[playerid], -1);
TextDrawSetOutline(Working[playerid], 1);
TextDrawSetProportional(Working[playerid], 1);
TextDrawAlignment(Working[playerid], 2);
}
and..
PHP код:
new pvehiclemodel = GetVehicleModel(GetPlayerVehicleID(playerid));
if (pvehiclemodel == 413 || pvehiclemodel == 482 || pvehiclemodel == 440 || pvehiclemodel == 414)
{
TextDrawHideForPlayer(playerid, NotWorking);
if (IsPlayerInMission[playerid] == 1) return SendClientMessage(playerid, 0xFF0000AA, ">> You are currently in a mission use \"/cancelmission\" to cancel your current mission!"); // prevents them from starting another mission
new string[500];
new rand = random(sizeof(TruckingMissionRandomls));
IsPlayerInMission[playerid] = 1; // asign it to 1 becuase there in a mission
CreatePlayerMission(playerid, TruckingMissionRandomls[rand][UseTrailerCheck], TruckingMissionRandomls[rand][MissionPay], TruckingMissionRandomls[rand][loadx],TruckingMissionRandomls[rand][loady], TruckingMissionRandomls[rand][loadz], TruckingMissionRandomls[rand][unloadx],TruckingMissionRandomls[rand][unloady], TruckingMissionRandomls[rand][unloadz]);
format(string, sizeof(string), "%s", TruckingMissionRandomls[rand][MissionName]);
SendClientMessage(playerid, 0x00FF00FF, string);
TextDrawSetString(Working[playerid],TruckingMissionRandomlv[rand][MissionName]);
TextDrawShowForPlayer(playerid, Working[playerid]);
}
Re: string changes textdraw for other player -
2KY - 01.11.2012
I recommend doing something like this;
pawn Код:
new
PlayerText: Working [ MAX_PLAYERS ];
stock CreatePlayerTextDraws ( playerid )
{
Working[playerid] = PlayerTextDrawCreate(320.000000, 427.000000, " ");
PlayerTextDrawBackgroundColor(Working[playerid], 255);
PlayerTextDrawFont(Working[playerid], 2);
PlayerTextDrawLetterSize(Working[playerid], 0.319999, 1.0100000);
PlayerTextDrawColor(Working[playerid], -1);
PlayerTextDrawSetOutline(Working[playerid], 1);
PlayerTextDrawSetProportional(Working[playerid], 1);
PlayerTextDrawAlignment(Working[playerid], 2);
return true;
}
Re: string changes textdraw for other player -
Stu1 - 01.11.2012
Hey I tried that, compiled and it still hasnt worked :/
Re: string changes textdraw for other player -
Unte99 - 01.11.2012
Maybe it would be clearer if you would say what isn't working ?
EDIT:
and your'e using it like this:
Maybe the problem is clear to you ?
Re: string changes textdraw for other player -
Stu1 - 01.11.2012
When a player starts a new mission, the textdraw changes the mission for everyone
Re: string changes textdraw for other player -
Unte99 - 01.11.2012
Is it too hard to change from MAX_PLAYER_NAME to MAX_PLAYERS ?
pawn Код:
new Text:Working[MAX_PLAYERS];
for(new playerid=0; playerid<MAX_PLAYERS; playerid++)
{
Working[playerid] = TextDrawCreate(320.000000, 427.000000, " ");
TextDrawBackgroundColor(Working[playerid], 255);
TextDrawFont(Working[playerid], 2);
TextDrawLetterSize(Working[playerid], 0.319999, 1.0100000);
TextDrawColor(Working[playerid], -1);
TextDrawSetOutline(Working[playerid], 1);
TextDrawSetProportional(Working[playerid], 1);
TextDrawAlignment(Working[playerid], 2);
}
Re: string changes textdraw for other player -
Stu1 - 01.11.2012
That is how i had it the first time i tried it, and that didn't work, you're welcome to come on skype and ill show you, my skype is xStuuuu