string changes textdraw for other player
#1

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(playeridNotWorking);
            if (
IsPlayerInMission[playerid] == 1) return SendClientMessage(playerid0xFF0000AA">> 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(playeridTruckingMissionRandomlv[rand][UseTrailerCheck], TruckingMissionRandomlv[rand][MissionPay], TruckingMissionRandomlv[rand][loadx],TruckingMissionRandomlv[rand][loady], TruckingMissionRandomlv[rand][loadz], TruckingMissionRandomlv[rand][unloadx],TruckingMissionRandomlv[rand][unloady], TruckingMissionRandomlv[rand][unloadz]);
            
format(stringsizeof(string), "%s"TruckingMissionRandomlv[rand][MissionName]);
            
SendClientMessage(playerid0x00FF00FFstring);
            
TextDrawSetString(Working,string);
            
TextDrawShowForPlayer(playeridWorking);
        }
        else
        {
            
SendClientMessage(playerid0xFF0000AA"You are not in the correct vehicle!");
        } 
Basically when someone else starts a mission the textdraw for all players changes to their mission
Reply
#2

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

That didn't work :/
Reply
#4

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(playeridNotWorking);
            if (
IsPlayerInMission[playerid] == 1) return SendClientMessage(playerid0xFF0000AA">> 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(playeridTruckingMissionRandomls[rand][UseTrailerCheck], TruckingMissionRandomls[rand][MissionPay], TruckingMissionRandomls[rand][loadx],TruckingMissionRandomls[rand][loady], TruckingMissionRandomls[rand][loadz], TruckingMissionRandomls[rand][unloadx],TruckingMissionRandomls[rand][unloady], TruckingMissionRandomls[rand][unloadz]);
            
format(stringsizeof(string), "%s"TruckingMissionRandomls[rand][MissionName]);
            
            
SendClientMessage(playerid0x00FF00FFstring);
            
TextDrawSetString(Working[playerid],TruckingMissionRandomlv[rand][MissionName]);
            
TextDrawShowForPlayer(playeridWorking[playerid]);
        } 
Reply
#5

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

Hey I tried that, compiled and it still hasnt worked :/
Reply
#7

Maybe it would be clearer if you would say what isn't working ?

EDIT:

pawn Код:
Working[MAX_PLAYER_NAME]
and your'e using it like this:

pawn Код:
Working[playerid]
Maybe the problem is clear to you ?
Reply
#8

When a player starts a new mission, the textdraw changes the mission for everyone
Reply
#9

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);
}
Reply
#10

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)