---
title: "PlayerTextDrawSetString | open.mp"
description: "متن یک player textdraw رو تغییر می‌ده."
canonical: https://omp.itsneufox.com/fa/docs/scripting/functions/PlayerTextDrawSetString
language: fa
---

# PlayerTextDrawSetString

## توضیحات

متن یک player textdraw رو تغییر می‌ده.

| نام | توضیحات |
| --- | --- |
| playerid | ID بازیکنی که رشته textdraw اون باید تنظیم بشه |
| PlayerText:textid | ID textdraw که باید تغییر کنه |
| const format\[\] | رشته جدید برای TextDraw |
| OPEN\_MP\_TAGS:... | تعداد نامحدودی از آرگومان‌ها با هر tag. |

## مقدار برگشتی

این تابع هیچ مقدار خاصی برنمی‌گردونه.

## مثال‌ها

```c
new PlayerText:pVehicleHealthTD[MAX_PLAYERS];
new pVehicleHealthTimer[MAX_PLAYERS];

public OnPlayerStateChange(playerid, PLAYER_STATE:newstate, PLAYER_STATE:oldstate)
{
    if (newstate == PLAYER_STATE_DRIVER) // Entered a vehicle as driver
    {
        pVehicleHealthTD[playerid] = CreatePlayerTextDraw(playerid, 320.0, 240.0, " ");
        PlayerTextDrawShow(playerid, pVehicleHealthTD[playerid]);

        // Set a timer to update the textdraw every second
        pVehicleHealthTimer[playerid] = SetTimerEx("UpdateVehicleHealthTextDraw", 1000, true, "i", playerid);
    }
    if (oldstate == PLAYER_STATE_DRIVER)
    {
        KillTimer(pVehicleHealthTimer[playerid]);
        PlayerTextDrawDestroy(playerid, pVehicleHealthTD[playerid]);
    }
    return 1;
}

forward UpdateVehicleHealthTextDraw(playerid);
public UpdateVehicleHealthTextDraw(playerid)
{
    new
        string[32],
        vehicleid = GetPlayerVehicleID(playerid),
        Float:health;

    GetVehicleHealth(vehicleid, health);

    format(string, sizeof(string), "Vehicle Health: %.0f", health);
    PlayerTextDrawSetString(playerid, pVehicleHealthTD[playerid], string); // <<< Update the text to show the vehicle health

    // PRO TIP: You don't need `format` in open.mp
    PlayerTextDrawSetString(playerid, pVehicleHealthTD[playerid], "Vehicle Health: %.0f", health);
    return 1;
}

/*
NOTE: This example is purely for demonstration purposes, it is not guaranteed to work in-game. It is merely to show the usage of the PlayerTextDrawSetString function.
*/
```

## نکات

نکته

لازم نیست دوباره TextDraw رو نمایش بدی تا تغییرات اعمال بشن.

هشدار

برای طول رشته‌های textdraw محدودیت وجود داره! برای اطلاعات بیشتر [Limits](https://omp.itsneufox.com/fa/docs/scripting/resources/limits) رو ببین.

## توابع مرتبط

-   [CreatePlayerTextDraw](https://omp.itsneufox.com/fa/docs/scripting/functions/CreatePlayerTextDraw): ساخت یک player textdraw.
-   [PlayerTextDrawDestroy](https://omp.itsneufox.com/fa/docs/scripting/functions/PlayerTextDrawDestroy): از بین بردن یک player textdraw.
-   [PlayerTextDrawGetString](https://omp.itsneufox.com/fa/docs/scripting/functions/PlayerTextDrawGetString): گرفتن متن یک player textdraw.
-   [PlayerTextDrawColor](https://omp.itsneufox.com/fa/docs/scripting/functions/PlayerTextDrawColor): تنظیم رنگ متن در یک player textdraw.
-   [PlayerTextDrawBoxColor](https://omp.itsneufox.com/fa/docs/scripting/functions/PlayerTextDrawBoxColor): تنظیم رنگ جعبه یک player textdraw.
-   [PlayerTextDrawBackgroundColor](https://omp.itsneufox.com/fa/docs/scripting/functions/PlayerTextDrawBackgroundColor): تنظیم رنگ پس‌زمینه یک player textdraw.
-   [PlayerTextDrawAlignment](https://omp.itsneufox.com/fa/docs/scripting/functions/PlayerTextDrawAlignment): تنظیم تراز یک player textdraw.
-   [PlayerTextDrawFont](https://omp.itsneufox.com/fa/docs/scripting/functions/PlayerTextDrawFont): تنظیم فونت یک player textdraw.
-   [PlayerTextDrawLetterSize](https://omp.itsneufox.com/fa/docs/scripting/functions/PlayerTextDrawLetterSize): تنظیم اندازه حروف متن در یک player textdraw.
-   [PlayerTextDrawTextSize](https://omp.itsneufox.com/fa/docs/scripting/functions/PlayerTextDrawTextSize): تنظیم اندازه جعبه player textdraw (یا منطقه قابل کلیک برای PlayerTextDrawSetSelectable).
-   [PlayerTextDrawSetOutline](https://omp.itsneufox.com/fa/docs/scripting/functions/PlayerTextDrawSetOutline): فعال/غیرفعال کردن outline روی یک player textdraw.
-   [PlayerTextDrawSetShadow](https://omp.itsneufox.com/fa/docs/scripting/functions/PlayerTextDrawSetShadow): تنظیم سایه روی یک player textdraw.
-   [PlayerTextDrawSetProportional](https://omp.itsneufox.com/fa/docs/scripting/functions/PlayerTextDrawSetProportional): مقیاس کردن فاصله متن در یک player textdraw به نسبت متناسب.
-   [PlayerTextDrawUseBox](https://omp.itsneufox.com/fa/docs/scripting/functions/PlayerTextDrawUseBox): فعال/غیرفعال کردن جعبه روی یک player textdraw.
-   [PlayerTextDrawShow](https://omp.itsneufox.com/fa/docs/scripting/functions/PlayerTextDrawShow): نمایش یک player textdraw.
-   [PlayerTextDrawHide](https://omp.itsneufox.com/fa/docs/scripting/functions/PlayerTextDrawHide): مخفی کردن یک player textdraw.
