text stringlengths 1 2.83M | id stringlengths 16 152 | metadata dict | __index_level_0__ int64 0 949 |
|---|---|---|---|
---
title: SetPlayerVelocity
description: Postavi brzinu igrača na X, Y i Z osama.
tags: ["player"]
---
## Deskripcija
Postavi brzinu igrača na X, Y i Z osama.
| Ime | Deskripcija |
| -------- | ---------------------------- |
| playerid | Igrač za primijeniti brzinu. |
| Float:X | Brzina na X osi. |
| Float:Y | Brzina na Y osi. |
| Float:Z | Brzina nae Z osi. |
## Returns
1: Funkcija uspješno izvršena.
0: Funkcija neuspješno izvršena. Ovo znači da igrač nije konektovan.
## Primjeri
```c
public OnPlayerCommandText(playerid, cmdtext[])
{
if (!strcmp("/jump", cmdtext))
{
SetPlayerVelocity(playerid, 0.0, 0.0, 0.2); // Forsira igrača da skoči (Z brzina + 0.2)
return 1;
}
return 0;
}
```
## Srodne Funkcije
- [GetPlayerVelocity](GetPlayerVelocity): Dobij brzinu igrača.
- [SetVehicleVelocity](SetVehicleVelocity): Postavi brzinu vozila.
- [GetVehicleVelocity](GetVehicleVelocity): Dobij brzinu vozila.
| openmultiplayer/web/docs/translations/bs/scripting/functions/SetPlayerVelocity.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/SetPlayerVelocity.md",
"repo_id": "openmultiplayer",
"token_count": 464
} | 350 |
---
title: SetVehicleParamsCarWindows
description: Dozvoljava ti da otvoriš i zatvoriš prozore vozila.
tags: ["vehicle"]
---
:::warning
Ova funkcija je dodana u SA-MP 0.3.7 i ne radi u nižim verzijama!
:::
## Deskripcija
Dozvoljava ti da otvoriš i zatvoriš prozore vozila.
| Ime | Deskripcija |
| --------- | ------------------------------------------------------------------------------- |
| vehicleid | ID vozila za postaviti stanje prozora. |
| driver | Stanje vozačevog prozora. 0 za otvoriti, 1 za zatvoriti. |
| passenger | Stanje suvozačevog prozora. 0 za otvoriti, 1 za zatvoriti. |
| backleft | Stanje lijevog pozadi prozora (ako je dostupno). 0 za otvoriti, 1 za zatvoriti. |
| backright | Stanje desnog pozadi prozora (ako je dostupno). 0 za otvoriti, 1 za zatvoriti. |
## Returns
[edit]
## Srodne Funkcije
- [SetVehicleParamsCarDoors](SetVehicleParamsCarDoors): Otvori i zatvori vrata vozila.
- [GetVehicleParamsCarDoors](GetVehicleParamsCarDoors): Doznaj trenutno stanje vrata od vozila
- [GetVehicleParamsCarWindows](GetVehicleParamsCarWindows): Doznaj trenutno stanje prozora vozila.
| openmultiplayer/web/docs/translations/bs/scripting/functions/SetVehicleParamsCarWindows.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/SetVehicleParamsCarWindows.md",
"repo_id": "openmultiplayer",
"token_count": 601
} | 351 |
---
title: SpawnPlayer
description: (Re)Spawnuje igrača.
tags: ["player"]
---
## Deskripcija
(Re)Spawnuje igrača.
| Ime | Deskripcija |
| -------- | ------------------------------------ |
| playerid | ID igrača za spawn-ovati (stvoriti). |
## Returns
1: Funkcija uspješno izvršena.
0: Funkcija neuspješno izvršena. Ovo znači da igrač nije konektovan.
## Primjeri
```c
if (strcmp(cmdtext, "/spawn", true) == 0)
{
SpawnPlayer(playerid);
return 1;
}
```
## Zabilješke
:::tip
Ubija igrača ako je u vozilu, a zatim se spawnaju s bocom u ruci.
:::
## Srodne Funkcije
- [SetSpawnInfo](SetSpawnInfo): Postavi postavke spawnovanja za igrača.
- [AddPlayerClass](AddPlayerClass): Dodaj klasu.
- [OnPlayerSpawn](../callbacks/OnPlayerSpawn): Pozvano kada se igrač stvori.
| openmultiplayer/web/docs/translations/bs/scripting/functions/SpawnPlayer.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/SpawnPlayer.md",
"repo_id": "openmultiplayer",
"token_count": 360
} | 352 |
---
title: TextDrawLetterSize
description: Postavlja širinu i visinu slova.
tags: ["textdraw"]
---
## Deskripcija
Postavlja širinu i visinu slova.
| Ime | Deskripcija |
| ------- | ----------------------- |
| text | TextDraw za izmijeniti. |
| Float:x | Širina karaktera. |
| Float:y | Visina karaktera. |
## Returns
Ova funkcija ne returna (vraća) nikakve posebne vrijednosti.
## Primjeri
```c
new Text: gMyTextdraw;
public OnGameModeInit()
{
gMyTextdraw = TextDrawCreate(100.0, 33.0,"Primjer Textdrawa");
TextDrawLetterSize(gMyTextdraw, 3.2 ,5.1);
return 1;
}
```
## Zabilješke
:::tip
Kada ovu funkciju koristite čisto da biste utjecali na box TextDrawa, pomnožite 'Y' s 0,135 da biste pretvorili u mjerenja nalik TextDrawTextSize. Savjet: Lakše je i izuzetno precizno koristiti LD_SPAC:white sprit za samo crtanje boxa, TextDrawTextSize će imati redovite pomake.
:::
:::tip
Ukoliko želite promijeniti veličinu slova textdrawa koji je već prikazan, ne morate ga ponovno kreirati. Prosto koristite TextDrawShowForPlayer/TextDrawShowForAll nakon uređivanja i promjena će biti vidljiva. Fontovi izgledaju najbolje sa X naprema Y rastojanju od 1 do 4 (npr. ako je x 0.5 onda bi y trebao biti 2).
:::
## Srodne Funkcije
- [TextDrawCreate](TextDrawCreate): Kreiraj textdraw.
- [TextDrawDestroy](TextDrawDestroy): Uništi textdraw.
- [TextDrawColor](TextDrawColor): Postavi boju teksta u textdrawu.
- [TextDrawBoxColor](TextDrawBoxColor): Postavi boju boxa u textdrawu.
- [TextDrawBackgroundColor](TextDrawBackgroundColor): Postavi boju pozadine textdrawa.
- [TextDrawAlignment](TextDrawAlignment): Postavi poravnanje textdrawa.
- [TextDrawFont](TextDrawFont): Postavi font textdrawa.
- [TextDrawTextSize](TextDrawTextSize): Postavi veličinu boxa u textdrawu.
- [TextDrawSetOutline](TextDrawSetOutline): Odluči da li da tekst ima outline.
- [TextDrawSetShadow](TextDrawSetShadow): Uključi/isključi sjene (shadows) na textdrawu.
- [TextDrawSetProportional](TextDrawSetProportional): Razmjestite razmak između teksta u texstdrawu na proporcionalni omjer.
- [TextDrawUseBox](TextDrawUseBox): Uključite ili isključite da li textdraw koristi box ili ne.
- [TextDrawSetString](TextDrawSetString): Postavi tekst u već postojećem textdrawu.
- [TextDrawShowForPlayer](TextDrawShowForPlayer): Prikaži textdraw za određenog igrača.
- [TextDrawHideForPlayer](TextDrawHideForPlayer): Sakrij textdraw za određenog igrača.
- [TextDrawShowForAll](TextDrawShowForAll): Prikaži textdraw za sve igrače.
- [TextDrawHideForAll](TextDrawHideForAll): Sakrij textdraw za sve igrače.
| openmultiplayer/web/docs/translations/bs/scripting/functions/TextDrawLetterSize.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/TextDrawLetterSize.md",
"repo_id": "openmultiplayer",
"token_count": 1052
} | 353 |
---
title: TogglePlayerSpectating
description: Uključite ili isključite da li je igrač u režimu spectatora/gledatelja.
tags: ["player"]
---
## Deskripcija
Uključite ili isključite da li je igrač u režimu spectatora/gledatelja. Dok je u spectator režimu igrač može gledati ostale igrače i vozila. Nakon korištenja ove funkcije ili PlayerSpectatePlayer ili PlayerSpectateVehicle mora biti korišten.
| Ime | Deskripcija |
| -------- | ----------------------------------------------------- |
| playerid | ID koji bi trebao gledati |
| toggle | 1 da uključite spectate-anje/gledanje 0 da isključite |
## Returns
1: Funkcija uspješno izvršena.
0: Funkcija neuspješno izvršena. Igrač ne postoji.
## Primjeri
```c
public OnPlayerDeath(playerid, killerid, WEAPON:reason)
{
TogglePlayerSpectating(playerid, 1);
PlayerSpectatePlayer(playerid, killerid);
return 1;
}
```
## Zabilješke
:::tip
Kada je režim gledatelja onemogućen, automatski će se pozvati OnPlayerSpawn, ako želite vratiti stanje igrača u stanje prije gledanja, morat ćete to riješiti u OnPlayerSpawn. Takođe imajte na umu da taj igrač također može ići na odabir klase prije nego što je koristio F4 za vrijeme gledanja, igrač također MOŽE umrijeti u režimu spektakularnosti zbog različitih kvarova.
:::
:::tip
Kada je igrač u spectate načinu rada, njegov HUD je skriven, što ga čini korisnim za postavljanje igračeve kamere bez HUD-a. Također će se usmjeravati objekti u blizini kamere igrača, što ovo čini korisnim za interpolaciju kamera.
:::
:::warning
Ako igrač nije učitan prije postavljanja statusa spectatora na 0, konekcija se može neočekivano prekinuti.
:::
## Srodne Funkcije
- [PlayerSpectatePlayer](PlayerSpectatePlayer): Nadgledaj igrača.
- [PlayerSpectateVehicle](PlayerSpectateVehicle): Nadgledaj vozilo.
| openmultiplayer/web/docs/translations/bs/scripting/functions/TogglePlayerSpectating.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/TogglePlayerSpectating.md",
"repo_id": "openmultiplayer",
"token_count": 842
} | 354 |
---
title: fblockread
description: Ova funkcija vam omogućuje čitanje podataka iz datoteke, bez kodiranja i završetaka linije.
tags: []
---
:::warning
Ova funkcija započinje malim slovom.
:::
## Deskripcija
Ova funkcija vam omogućuje čitanje podataka iz datoteke, bez kodiranja i završetaka linije.
| Ime | Deskripcija |
| -------------------- | ----------------------------------------------------- |
| handle | Upravitelj datoteke za upotrebu, otvorila je fopen () |
| buffer | Upremnik za spremanje pročitanih podataka. |
| size = sizeof buffer | Broj ćelija za čitanje. |
## Returns
Broj pročitanih ćelija. Nula, ako je dostignut kraj datoteke.
## Primjeri
```c
// Definiraj "some_enum" (neki enum)
enum _:some_enum
{
some_data1,
some_data2[20],
Float:some_data3
}
// Deklariši "some_data" (neke podatke)
new some_data[some_enum];
// ...
// Otovri "file.bin" u "read only" modu (samo čitanje)
new File:handle = fopen("file.bin", io_write)
// Deklariši "file_len"
file_len;
// Provjeri ako je "file.bin" otvoren
if (handle)
{
// Uspješno
// Nabavimo dužinu datoteke "file.bin"
file_len = flength(handle);
// Ako je datoteka jednako velika od niza
if (file_len == (some_enum*4))
{
// Uspješno
// Čitanje iz "file.bin" u "some_data" (neke podatke)
fblockread(handle, some_data);
}
else
{
// Error
print("\"file.bin\" nije kompatibilan s nizom.");
}
// Zatvori "file.bin"
fclose(handle);
}
else
{
// Error
print("Nesupješno otvaranje \"file.bin\".");
}
```
## Zabilješke
:::warning
Korištenje nevaljanog upravitelja srušit će vaš server! Nabavite važeći upravitelj pomoću fopen ili ftemp.
:::
## Srodne Funkcije
| openmultiplayer/web/docs/translations/bs/scripting/functions/fblockread.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/fblockread.md",
"repo_id": "openmultiplayer",
"token_count": 934
} | 355 |
---
title: floatround
description: Zaokružite broj s pomičnom zarezom na cijelu vrijednost.
tags: []
---
:::warning
Ova funkcija započinje malim slovom.
:::
## Deskripcija
Zaokružite broj s pomičnom zarezom na cijelu vrijednost.
| Ime | Deskripcija |
| ------------------------------------ | --------------------------------- |
| value | Vrijednost koju treba zaokružiti. |
| [mode](../resources/floatroundmodes) | Režim plutanja koji se koristi. |
## Returns
Zaokružena vrijednost kao cijeli broj.
## Primjeri
```c
floatround(3.3, floatround_ceil);
```
## Srodne Funkcije
- [float](float): Pretvorite cjelobrojni broj u float.
- [floatstr](floatstr): Konvertuj string u float.
| openmultiplayer/web/docs/translations/bs/scripting/functions/floatround.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/floatround.md",
"repo_id": "openmultiplayer",
"token_count": 373
} | 356 |
---
title: getarg
description: Dobij argument koji je proslijeđen funkciji.
tags: []
---
<LowercaseNote />
## Deskripcija
Dobij argument koji je proslijeđen funkciji.
| Ime | Deskripcija |
| ----- | ------------------------------------------------------- |
| arg | Redni broj argumenta. Koristite 0 za prvi argument. |
| index | Indeks (u slučaju da je argument array / niz). |
## Returns
Vrijednost argumenta.
## Primjeri
```c
SomeFunc(...)
{
printf("%i", getarg(3));
}
public OnFilterScriptInit()
{
SomeFunc(1, 3, 3, 7);
}
// Output: 7. Četvrti argument (indeks 3) je 7.
```
## Srodne Funkcije
- [numargs](numargs): Returna (Vraća) broj argumenata.
- [setarg](setarg): Postavlja argument.
| openmultiplayer/web/docs/translations/bs/scripting/functions/getarg.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/getarg.md",
"repo_id": "openmultiplayer",
"token_count": 342
} | 357 |
---
title: sendpacket
description: .
tags: []
---
:::warning
Ova funkcija započinje malim slovom.
:::
| openmultiplayer/web/docs/translations/bs/scripting/functions/sendpacket.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/sendpacket.md",
"repo_id": "openmultiplayer",
"token_count": 45
} | 358 |
---
title: toupper
description: Ova funkcija mijenja jedan znak u veliko slovo.
tags: []
---
:::warning
Ova funkcija započinje malim slovom.
:::
## Deskripcija
Ova funkcija mijenja jedan znak u veliko slovo.
| Ime | Deskripcija |
| --- | ----------------------------------- |
| c | Znak za promijeniti u veliko slovo. |
## Returns
Vrijednost ASCII znaka, ali velikim slovima.
## Primjeri
```c
public OnPlayerText(playerid, text[])
{
text[0] = toupper(text[0]);
//Ovo postavlja prvi znak u veliko slovo
return 1;
}
```
## Srodne Funkcije
- [tolower](tolower): Ova funkcija mijenja jedan znak u malo slovo.
| openmultiplayer/web/docs/translations/bs/scripting/functions/toupper.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/toupper.md",
"repo_id": "openmultiplayer",
"token_count": 299
} | 359 |
---
title: Port Forward-ovanje
description: Tutorial za Port Forward-ovanje servera.
---
**Dobrodošli u tutorijal za Port Forward-ovanje!**
Dakle, stigli ste do tutoriala za Port Forward-ovanje, koji je napravio Leopard.
Sve što vam treba je samp-server ili omp-server i ruter. Ako nemate ruter, onda ne trebate port forward-ovati!
## Početak
Ok, evo početka, počnite pronalaženjem svog **gateway-a**. Pretpostavimo da imate vista. Kliknite na start, kliknite na polje za pretragu i napišite **cmd**. Tada se pojavljuje crna kutija. Unesite sljedeće; **ipconfig**. Sačekajte da se tekst učita, a zatim ga pogledajte. Nastavite tražiti dok ne pronađete _**gateway**_, i ne zatvarajte crnu kutiju!
Kada ga pronađete, otvorite svoj omiljeni web pretraživač. Kada se učita, idite na adresnu traku i unesite vrijednost _**gateway**_ (primjer: 192.168.0.1/192.168.1.1). Pritisnite enter.
## Konfiguracija Rutera
Bravo, stigli ste do konfiguracijske stranice rutera. Ono što nam preostaje je da sada port forward-ujemo.
Dakle... postoji kategorija na toj stranici koja je nazvana jednim od sljedećih;
- Virtuelni server
- Port Forward-ovanje
- Port Kontrola
- Dijeljenje Aplikacija
- Sve što ima `port` u svom imenu.
Ako ste ga pronašli, kliknite na njega. Zatim kliknite na dugme 'Dodaj novi', 'Novi port' ili neko drugo dugme koje će preklopiti otvaranje novog porta.
Unesite sljedeće detalje:
```
Port: TVOJ_PORT (standard: 7777)
Port Tip: UDP
Omogućeno: Da
**IP: Nastavite sa 3. korakom**
```
Sada morate znati IP adresu vašeg računara.
## Dobivanje IP adrese, nastavak
Sada povećajte crnu kutiju i ponovo pogledajte tekst dok ne vidite _IPv4_. Trebao bi biti u formatu poput ovog: **192.168.0.100**. Kopirajte, i eto ga! Nastavite sa informacijama na početnoj stranici rutera. Na primjer, moj IP je 192.168.0.100
```
Port: TVOJ_PORT (standard: 7777)
Port Tip: UDP
Omogućeno: Da
IP: 192.168.0.100
```
I pritisnite **sačuvaj**. Onda si gotov. I! Ne zaboravite **prosljeđivati port u Windows zaštitnom zidu**. Ovo je mali tutorijal;
Idite na početni meni, unesite "firewall" u polje za pretragu i odaberite "Windows Firewall". Otvorite ga i kliknite na _Promijeni postavke_. Novi iskačući prozor. Kliknite na karticu _Izuzeci_, kliknite na _Dodaj port.._ i zatim popunite ove informacije;
```
Ime: SA-MP Server (nazovite kako god želite)
Port Broj: YOUR_PORT (standard: 7777)
Protokol: UDP
```
Onda ste gotovi! Kliknite OK i zatvorite ga. Pokrenite server i vidite da li radi. Ako jeste, idite na svog SA-MP klijenta i unesite: localhost:TVOJ_PORT(standard: 7777). Ako se ping promijeni, vaš server radi u potpunosti. Sada samo trebate otići na:
[WhatIsMyIP.COM](http://whatismyip.com).
## Završetak
Kada ste tamo, pronađite ip koji je na vašem ekranu. Idite ponovo na svoj SA-MP klijent, dodajte taj IP u svoje favorite i dodajte TVOJ_PORT (standard: 7777) na kraju. ako radi,
**ČESTITAM**! _ Imate proslijeđen port _!
| openmultiplayer/web/docs/translations/bs/tutorials/PortForwarding.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/tutorials/PortForwarding.md",
"repo_id": "openmultiplayer",
"token_count": 1285
} | 360 |
---
title: DestroyPickup
description: Löscht ein mit CreatePickup erstelltes Pickup.
tags: []
---
## Beschreibung
Löscht ein mit CreatePickup erstelltes Pickup.
| Name | Beschreibung |
| ------ | ----------------------------------------------------------- |
| pickup | Die ID des Pickups, dass gelöscht wird (Rückgabewert bei CreatePickup). |
## Rückgabe(return value)
Diese Funktion hat keinen Rückgabewert.
## Beispiel
```c
// Erstelle ein Pickup für Armor (Rüstung). ID wird in pickup_armor gespeichert.
pickup_armour = CreatePickup ( 1242, 2, 1503.3359, 1432.3585, 10.1191 );
//Lösche das Pickup über die gespeicherte ID wieder...
DestroyPickup(pickup_armour);
```
## Ähnliche Funktionen
- [CreatePickup](CreatePickup): Erstelle ein Pickup.
- [OnPlayerPickUpPickup](../callbacks/OnPlayerPickUpPickup): Wird aufgerufen wenn ein Spieler ein Pickup aufhebt.
| openmultiplayer/web/docs/translations/de/scripting/functions/DestroyPickup.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/de/scripting/functions/DestroyPickup.md",
"repo_id": "openmultiplayer",
"token_count": 382
} | 361 |
---
título: OnGameModeExit
descripción: Este callback es llamado cuando un gamemode termina, ya sea mediante 'gmx', cuando el servidor se apaga, o cuando se usa GameModeExit.
tags: []
---
## Descripción
Este callback es llamado cuando un gamemode termina, ya sea mediante 'gmx', cuando el servidor se apaga, o cuando se usa GameModeExit.
## Ejemplos
```c
public OnGameModeExit()
{
print("Gamemode terminado.");
return 1;
}
```
## Notas
:::tip
Esta función también puede ser usada en un filterscript para detectar si el gamemode cambia, con comandos RCON como 'changemode' o 'gmx', ya que cambiando el gamemode no recarga un filterscript. Cuando usamos OnGameModeExit en conjunto con el comando de consola 'rcon gmx' tener en cuenta que hay una potencial posibilidad de que ocurran bugs en el cliente. Un ejemplo de esto son las excesivas llamadas a RemoveBuildingForPlayer durante OnGameModeInit, lo que podría causar un crash en el cliente. Este callback NO será llamado si el servidor crashea o el proceso es finalizado por otros medios, como usando el comando de Linux 'kill' o presionando el botón cerrar en la consola de Windows.
:::
## Funciones Relacionadas
- [GameModeExit](../functions/GameModeExit): Salir del gamemode actual.
| openmultiplayer/web/docs/translations/es/scripting/callbacks/OnGameModeExit.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/es/scripting/callbacks/OnGameModeExit.md",
"repo_id": "openmultiplayer",
"token_count": 443
} | 362 |
---
título: OnPlayerEnterRaceCheckpoint
descripción: Este callback se llama cuando un jugador entra en un checkpoint de carrera.
tags: ["player", "checkpoint", "racecheckpoint"]
---
## Descripción
Este callback se llama cuando un jugador entra en un checkpoint de carrera.
| Nombre | Descripción |
| -------- | ------------------------------------------------------- |
| playerid | El ID del jugador que entró a un checkpoint de carrera. |
## Devoluciones
Siempre se llama primero en filterscripts.
## Ejemplos
```c
public OnPlayerEnterRaceCheckpoint(playerid)
{
printf("El jugador %d entró a un checkpoint de carreras!", playerid);
return 1;
}
```
## Notas
<TipNPCCallbacksES />
## Funciones Relacionadas
- [SetPlayerCheckpoint](../functions/SetPlayerCheckpoint): Crea un checkpoint a un jugador.
- [DisablePlayerCheckpoint](../functions/DisablePlayerCheckpoint): Desactiva el checkpoint actual de un jugador.
- [IsPlayerInCheckpoint](../functions/IsPlayerInCheckpoint): Comprueba si un jugador está en un checkpoint.
- [SetPlayerRaceCheckpoint](../functions/SetPlayerRaceCheckpoint): Crea un checkpoint de carrera a un jugador.
- [DisablePlayerRaceCheckpoint](../functions/DisablePlayerRaceCheckpoint): Desactiva el checkpoint de carrera actual del jugador.
- [IsPlayerInRaceCheckpoint](../functions/IsPlayerInRaceCheckpoint): Comprueba si el jugador está en un checkpoint de carrera.
| openmultiplayer/web/docs/translations/es/scripting/callbacks/OnPlayerEnterRaceCheckpoint.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/es/scripting/callbacks/OnPlayerEnterRaceCheckpoint.md",
"repo_id": "openmultiplayer",
"token_count": 472
} | 363 |
---
título: OnPlayerSelectObject
descripción: Este callback se llama cuando un jugador selecciona un objeto después de que SelectObject fue usado.
tags: ["player"]
---
## Descripción
Este callback se llama cuando un jugador selecciona un objeto después de que SelectObject fue usado.
| Nombre | Descripción |
| -------- | ----------------------------------------------------------------- |
| playerid | El ID del jugador que seleccionó un objeto. |
| type | El [tipo](../resources/selectobjecttypes) de objeto seleccionado. |
| objectid | El ID del objeto seleccionado. |
| modelid | El modelo del objeto seleccionado. |
| Float:fX | La posición X del objeto seleccionado. |
| Float:fY | La posición Y del objeto seleccionado. |
| Float:fZ | La posición Z del objeto seleccionado. |
## Devoluciones
1 - Prevendrá a otros filterscripts de recibir este callback.
0 - Indica que este callback será pasado al siguiente filterscript.
Siempre se llama primero en filterscripts.
## Ejemplos
```c
public OnPlayerSelectObject(playerid, type, objectid, modelid, Float:fX, Float:fY, Float:fZ)
{
printf("El jugador %d seleccionó el objeto %d", playerid, objectid);
if (type == SELECT_OBJECT_GLOBAL_OBJECT)
{
EditObject(playerid, objectid);
}
else
{
EditPlayerObject(playerid, objectid);
}
SendClientMessage(playerid, 0xFFFFFFFF, "Ahora estás habilitado para poder editar el objeto!");
return 1;
}
```
## Funciones Relacionadas
- [SelectObject](../functions/SelectObject): Seleccionar un objeto.
| openmultiplayer/web/docs/translations/es/scripting/callbacks/OnPlayerSelectObject.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/es/scripting/callbacks/OnPlayerSelectObject.md",
"repo_id": "openmultiplayer",
"token_count": 769
} | 364 |
---
título: OnVehicleDeath
descripción: Este callback se llama cuando un vehículo es destruido - ya sea explotando o siendo sumergido en el agua.
tags: ["vehicle"]
---
## Descripción
Este callback se llama cuando un vehículo es destruido - ya sea explotando o siendo sumergido en el agua.
| Nombre | Descripción |
| --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| vehicleid | El ID del vehículo destruido. |
| killerid | El ID del jugador que informó (sincronizó) la destrucción del vehículo (el nombre es engañoso). Generalmente el conductor o un pasajero (si lo hay) o el jugador más cercano. |
## Devoluciones
Siempre se llama primero en filterscripts.
## Ejemplos
```c
public OnVehicleDeath(vehicleid, killerid)
{
new string[64];
format(string, sizeof(string), "El vehículo %i fue destruido. Reportado por el jugador %i.", vehicleid, killerid);
SendClientMessageToAll(0xFFFFFFFF, string);
return 1;
}
```
## Notas
:::tip
Este callback también se llamará cuando un vehículo entre en el agua, pero el vehículo se puede salvar de la destrucción mediante la teletransportación o sacándolo manejando (si solo está parcialmente sumergido). El callback no se llamará por segunda vez y el vehículo puede desaparecer cuando el conductor salga o después de un breve período de tiempo.
:::
## Funciones Relacionadas
- [SetVehicleHealth](../functions/SetVehicleHealth): Establecer la salud de un vehículo.
| openmultiplayer/web/docs/translations/es/scripting/callbacks/OnVehicleDeath.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/es/scripting/callbacks/OnVehicleDeath.md",
"repo_id": "openmultiplayer",
"token_count": 789
} | 365 |
---
id: OnDialogResponse
title: OnDialogResponse
description: این کالبک زمانی که بازیکن با "ShowPlayerDialog" از طریق کلیک روی دکمه یا فشردن دکمه ESC/ENTER یا کلیک بر روی آیتم(در صورتی که نوع دیالوگ لیست باشد) پاسخ بدهد فرا خوانده میشود
tags: []
---
<div dir="rtl" style={{ textAlign: "right" }}>
## توضیحات
این کالبک زمانی که بازیکن با "ShowPlayerDialog" از طریق کلیک روی دکمه یا فشردن دکمه ESC/ENTER یا کلیک بر روی آیتم(در صورتی که نوع دیالوگ لیست باشد) پاسخ بدهد فرا خوانده میشود
| اسم | توضیح |
| ----------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
| playerid | شناسه بازیکن مورد نظر |
| dialogid | شناسه دیالوگی که برای بازیکن نمایش داده میشود |
| response | 1 در حالتی که به آن پاسخ داده باشد و 0 اگه بازیکن آن را کنسل کرده باشد |
| lisitem | شناسه موردی که بازیکن انتخاب کرده (از 0 شروع میشود) ) (فقط در صورتی که سبک دیالوگ لیست باشد، در غیر این صورت این مورد -1 خواهد بود). |
| inputtext[] | متنی که بازیکن درون قسمت ورودی وارد کرده یا متن موردی که بازیکن انتخاب کرده است |
## مثال ها
</div>
```c
// Tarif kardane id dialog ke mikhahim ejra shavad
#define DIALOG_RULES 1
// Dar yek dastoor
ShowPlayerDialog(playerid, DIALOG_RULES, DIALOG_STYLE_MSGBOX, "Server Rules", "- No Cheating\n- No Spamming\n- Respect Admins\n\nDo you agree to these rules?", "Bale", "Kheyr");
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == DIALOG_RULES)
{
if(response) // Agar bar rooye "Bale" click kard
{
SendClientMessage(playerid, COLOR_GREEN, "Thank you for agreeing to the server rules!");
}
else // Agar dokme ESC ra zad ya rooye "Kheyr" click kard
{
Kick(playerid);
}
return 1; // Ma yek dialog ra residegi kardim pas bayad return 1 konim, melse OnPlayerCommandText.
}
return 0; // Bayad inja return 0 konid, mesle OnPlayerCommandText
}
#define DIALOG_LOGIN 2
// Dar yek dastoor
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, "Login", "Please enter your password:", "Login", "Cancel");
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == DIALOG_LOGIN)
{
if(!response) // Agar rooye "Cancel" click kard ya dokme ESC ra zad
{
Kick(playerid);
}
else // Agar rooye dokme "Login" click kard ya dokme ENTER ra zad
{
if(CheckPassword(playerid, inputtext))
{
SendClientMessage(playerid, COLOR_RED, "Shoma vared shodid!");
}
else
{
SendClientMessage(playerid, COLOR_RED, "LOGIN FAILED.");
// Re-show the login dialog
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, "Login", "Please enter your password:", "Login", "Cancel");
}
}
return 1; // Ma yek dialog ra residegi kardim pas bayad return 1 konim, melse OnPlayerCommandText.
}
return 0; // Bayad inja return 0 konid, mesle OnPlayerCommandText
}
#define DIALOG_WEAPONS 3
// Dar yek dastoor
ShowPlayerDialog(playerid, DIALOG_WEAPONS, DIALOG_STYLE_LIST, "Weapons", "Desert Eagle\nAK-47\nCombat Shotgun", "Select", "Close");
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == DIALOG_WEAPONS)
{
if(response) // If they clicked 'Select' or double-clicked a weapon
{
// Give them the weapon
switch(listitem)
{
case 0: GivePlayerWeapon(playerid, WEAPON_DEAGLE, 14); // Give them a desert eagle
case 1: GivePlayerWeapon(playerid, WEAPON_AK47, 120); // Give them an AK-47
case 2: GivePlayerWeapon(playerid, WEAPON_SHOTGSPA, 28); // Give them a Combat Shotgun
}
}
return 1; // Ma yek dialog ra residegi kardim pas bayad return 1 konim, melse OnPlayerCommandText.
}
return 0; // Bayad inja return 0 konid, mesle OnPlayerCommandText
}
#define DIALOG_WEAPONS 3
// Dar yek dastoor
ShowPlayerDialog(playerid, DIALOG_WEAPONS, DIALOG_STYLE_LIST, "Weapons",
"Weapon\tAmmo\tPrice\n\
M4\t120\t500\n\
MP5\t90\t350\n\
AK-47\t120\t400",
"Select", "Close");
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == DIALOG_WEAPONS)
{
if(response) // Agar rooye 'Select' click kard ya dokme ENTER ra zad
{
// Dadane aslahe be bazikon
switch(listitem)
{
case 0: GivePlayerWeapon(playerid, WEAPON_M4, 120); // Give them an M4
case 1: GivePlayerWeapon(playerid, WEAPON_MP5, 90); // Give them an MP5
case 2: GivePlayerWeapon(playerid, WEAPON_AK47, 120); // Give them an AK-47
}
}
return 1; // Ma yek dialog ra residegi kardim pas bayad return 1 konim, melse OnPlayerCommandText.
}
return 0;// Bayad inja return 0 konid, mesle OnPlayerCommandText
}
```
<div dir="rtl" style={{ textAlign: "right" }}>
## نکته ها
:::tip
مقدار ها بر اثاث نوع استایل دیالوگ میتوانند محتوای متفاوتی داشته باشند
:::
:::tip
اگر تعداد دیالوگ ها زیاد است بهتر است از شناسه دیالوگ های مختلفی استفاده کنید
:::
:::warning
دیالوگ بعد از ری استارت شدن سرور برای بازیکن ها پنهان نمیشود و اگر بازیکن به دیالوگ پاسخ بدهد "Warning: PlayerDialogResponse PlayerId: 0 dialog ID doesn't match last sent dialog ID" در کنسول نمایش داده میشود.
:::
## تابع های مرتبط
</div>
- [ShowPlayerDialog](../functions/ShowPlayerDialog.md)
| openmultiplayer/web/docs/translations/fa/scripting/callbacks/OnDialogResponse.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/fa/scripting/callbacks/OnDialogResponse.md",
"repo_id": "openmultiplayer",
"token_count": 3414
} | 366 |
---
title: Contributing
description: How to contribute to the SA-MP Wiki and open.mp documentation for PH.
---
Kung gusto mong makatulong sa pag gawa ng documents tungkol sa scripting ay kelangan marunong ka magtagalog syempre kelangan mo dito ng konting kaalamaan tungkol sa git kasi kelangan natin ng magandang documentation para dito kasi alam mo naman ang mga pilipino. Eto ang [Github](https://github.com/openmultiplayer/web) ng openmultiplayer kung gusto mo magfork galing sakanila (Hindi updated to mag pupush ako ng mga bagong gawa don sa aking forked version ng github nila) kasi di naman sila aktibong nag aaccept ng pull request naming mga contributors kaya kung gusto mo makatulong dito eto ang [Github](https://github.com/CnRXoMoX/web) na galing saakin **REKOMENDADO KO DITO KAYO TUMULONG PARA UPDATED LAHAT NG FILES PARA SA PH DIRECTORY**
## Maglalagay ng mga bagong Content
Meron tayong dalawang paraan para mag add ng bagong Content
### GitHub Interface
Pag ikaw ay nagbrobrowse ng directory sa Github, meron kang makikitang Add file button sa kaliwang bahagi doon sa taas ng file list.

Pwede kang mag upload ng Markdown file `.md` na sinulat mo or pwede kang dumirecta sa GitHub text editor.
Yung file ay merong dapat `.md` extension at naglalaman ng Markdown. Addition information para sa Markdown, tignan mo itong [guide](https://guides.github.com/features/mastering-markdown/) na to
Pag tapos na pindutin lang ang "Propose new file" at gumawa ng Pull Request and titignan ko ito para ma merge natin ito sa forked version ng openmp documentation at pag ready na ito pwede na akong mag pull request para makita mo na ito sa website ng Openmp documentation
### Git
Kung gusto mo gumamit ng Git, ang gagawin mo lang ay icloclone ang forked version ng openmp documentation ko
`git clone https://github.com/CnRXoMoX/web.git`
Buksan ito sa gusto mong editor, Nirerekomenda ko gumamit ng [Visual Studio Code](https://code.visualstudio.com/) kasi pwede mo dito makita ang output ng ineedit mong .md file ginagamit ko din ito sa pag gawa ng mga documentation (Me XomoX)

Eto ang mga nirerekomenda kong extensions para dito
* [markdownlint](https://marketplace.visualstudio.com/items?itemName=DavidAnson.vscode-markdownlint) by David Anson - Eto ay makakatulong sayo para malaman mo kung tama ang pagkakaformat ng Markdown mo. Nag preprevent ito ng syntactic at sementic na pagkakamali. Hindi lahat ng warnings ay importante, pero yung iba nakakatulong para mabasa natin ng maayos and mga ginagawa nating markdown files. Ask mo lang ako sa discord kung meron kang tanong XomoX#8227
* [Prettier]() by Prettier.js Team - eto ay formatter na automatic na mafoformat ang Markdown files mo para magamit nila ang mga consistent style. Merong settings ang Wiki repository sa `package.json` na ang extension na to ay automatic na magagamit. Siguraduhing naka enable ang "Format On Save" sa editor settings mo para yung mga Markdown files mo ay automatic na mafoformat sa tuwing isasave mo ito.
## Notes, Tips and Conventions
### Internal Links
Wag gumamit ng absolute URLs para sa inter-site links. Gumamit ng relative paths
- ❌
```md
Pwedeng gamitin dito ang [OnPlayerClickPlayer](https://www.open.mp/docs/scripting/callbacks/OnPlayerClickPlayer)
```
- ✔
```md
Pwedeng gamitin dito ang [OnPlayerClickPlayer](../callbacks/OnPlayerClickPlayer)
```
Meaning ng `../` ay "go up one directory" kung yung file na iniedit mo ay nasa loob ng `functions` directory at gusto mong pumunta sa `callbacks` gumamit ng `../` para pumunta sa `scripting/` at `callbacks/` para mapunta ka sa `callbacks` directory, pagtapos yung filename (Wala ang `.md`) ng nais mong pumunta.
### Images
Lahat ng images ay dapat mapunta sa loob ng `/static/images`. At kung gusto mong mapakita ito sa isang .md file `![]()` gumamit lang ng `/images/` para sa base file (Di na kelangan ng `static` para sa repository lang yon)
Kung gusto mo masigurado, mag basa ka ng ibang page na ginagamit ang image na to at copyahin kung paano ginawa
### Metadata
Ang pinaka una sa *lahat* ng document dito ay dapat merong metadata:
```mdx
---
title: My Documentation
description: Ito ay para saaking documentation mula sa samp at open.mp
---
```
Lahat ng page ay dapat merong title at description.
Para sa lahat ng pwede nating ilagay sa gitna ng `---`, tignang etong [Docusaurus documentation](https://v2.docusaurus.io/docs/markdown-features/#markdown-headers)
## Headings
Wag ka gumawa ng level 1 heading (`<h1>`) na merong `#` eto ay automatic na naggegenerate. yung first heading mo dapat ay palaging `##`
- ❌
```md
# My Title
Ang documentation na ito ay para sa ...
# Sub-Section
```
- ✔
```md
Ang documentation na ito ay para sa ...
## Sub-Section
```
## Gumamit ng `Code` snippets para sa Technical References
Pag nagsusulat ng paragraph na naglalaman ng function names, numbers, expressions or kahit ano na hindi standard written language, paligiran sila ng \`backticks\` ganto. Nagpapadalit eto sa pag hiwalay ng language para idescribe ang mga bagay galing sa references to technical elements katulad ng function names at pirapirasong code.
- ❌
> Yung fopen function ay magbabalik ng values na may tag of type File:, wala namang problema sa linyang to, dapat ang ibabalik na value neto ay naka store sa variable na merong tag na File: (note ang cases are parepareho). Gayunpaman sa kasunod na linya ang value ay 4 ay madadagdag doon sa file handle. ang 4 ay walang tag [...]
- ✔
> Yung `fopen` function ay magbabalik ng values na may tag of type `File:`, wala namang problema sa linyang to, dapat ang ibabalik na value neto ay naka store sa variable na merong tag na `File:` (note ang cases are parepareho). Gayunpaman sa kasunod na linya ang value ay `4` ay madadagdag doon sa file handle. ang `4` ay walang tag [...]
Ang example sa taas, `fopen` ay function name, hindi English word, so palibutan ito ng `code` snippet marker para makatulog makilala eto sa ibang content
At, kung ang paragraph ay nagrerefer sa block of example code, eto ay makakatulong sa nagbabasa na maiugnay ang mga salita galing don sa example.
## Tables
Kung ang table ay walang headings, it ay mapupunta sa taas na parte.
- ❌
```md
| | |
| ------- | ------------------------------------ |
| Health | Engine Status |
| 650 | Undamaged |
| 650-550 | White Smoke |
| 550-390 | Grey Smoke |
| 390-250 | Black Smoke |
| < 250 | On fire (Sasabog mamaya maya) |
```
- ✔
```md
| Health | Engine Status |
| ------- | ------------------------------------ |
| 650 | Undamaged |
| 650-550 | White Smoke |
| 550-390 | Grey Smoke |
| 390-250 | Black Smoke |
| < 250 | On fire (Sasabog mamaya maya) |
```
## Migrating from SA-MP Wiki
Halos lahat ng mga nilalaman ay nalipat na, pero kung may nakita kang page sa wiki na walang laman, heto ang gabay para sa pag convert ng mga nilalaman sa Markdown.
### Getting the HTML
1. Pindutin ang button na ito.
(Firefox)

(Chrome)

2. I tutok sa kaliwang bahagi ng main wiki page, sa kaliwang margin o sa sulok hanggang makita mo ang `#content`

Or search for `<div id=content>`

3. I-Copy ang inner HTML ng element na iyon.

Ngayon ay nasayo na ang HTML code para sa aktwal na _nilalaman_ ng page, mga bagay na importante, at maaari mo itong i-convert sa Markdown.
### Converting HTML to Markdown
Para sa pag convert ng basic HTML (no tables) sa Markdown gamitin ang:
https://domchristie.github.io/turndown/

^^ Tignan, nasira ang table dito...
### HTML Tables to Markdown Tables
Dahil ang ginamit na paraan sa taas ay hindi nag susupport ng tables, sa halip, gamitin ang tool na ito:
https://jmalarcon.github.io/markdowntables/
At i-copy lang ang `<table>` na element sa:

### Cleaning Up
Ang pag convert ay hindi perpekto. Kaya kailangan mong mag-adjust para luminis ang tingin nito. Ang formatting extensions na naka lista sa taas ay maaaring makatulong sa iyo upang mabawasan ang trabaho.
Kung wala kang oras, wag magalala! I submit mo lang ang hindi mo pa tapos na trabaho bilang draft upang ituloy ng iba!
## License Agreement
All open.mp projects have a [Contributor License Agreement](https://cla-assistant.io/openmultiplayer/homepage). This basically just means you agree to let us use your work, and put it under an open-source license. When you open a Pull Request for the first time, the CLA-Assistant bot will post a link where you can sign the agreement.
Dito na magtatapos ang Contributing page
| openmultiplayer/web/docs/translations/fil/meta/contributing.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/fil/meta/contributing.md",
"repo_id": "openmultiplayer",
"token_count": 3342
} | 367 |
---
title: OnNPCEnterVehicle
description: Ang callback na ito ay tinatawag kapag ang isang NPC ay sumakay sa isang sasakyan.
tags: ["npc"]
---
## Description
Ang callback na ito ay tinatawag kapag ang isang NPC ay sumakay sa isang sasakyan.
| Name | Description |
| ------------ | ------------------------------------------------------- |
| vehicleid | Ang vehicle id na sinakyan ng NPC |
| seatid | Ang seatid na ginamit ng NPC |
## Examples
```c
public OnNPCEnterVehicle(vehicleid, seatid)
{
printf("OnNPCEnterVehicle ID: %d Seat: %d", vehicleid, seatid);
return 1;
}
```
## Related Callbacks
Maaaring maging kapaki-pakinabang ang mga sumusunod na callback, dahil nauugnay ang mga ito sa callback na ito sa isang paraan o iba pa.
- [OnNPCExitVehicle](OnNPCExitVehicle): Ang callback na ito ay tinatawag kapag ang isang NPC ay umalis sa isang Sasakyan. | openmultiplayer/web/docs/translations/fil/scripting/callbacks/OnNPCEnterVehicle.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/fil/scripting/callbacks/OnNPCEnterVehicle.md",
"repo_id": "openmultiplayer",
"token_count": 413
} | 368 |
---
title: OnPlayerExitVehicle
description: This callback is called when a player starts to exit a vehicle.
tags: []
---
<VersionWarn name='callback' version='SA-MP 0.3.7' />
## Paglalarawan
Ang callback na ito ay natatawag kapag ang isang manlalaro ay lumabas sa sasakyan.
| Pangalan | Deskripsyon |
| ----------- | -------------------------------------------------------------- |
| playerid | Ang ID ng manlalaro ng lumalabas sa sasakyan. |
| vehicleid | Ang ID ng sasakyan na kung saan ang manlalaro ay lumalabas. |
## Returns
Lagi itong na tatawag una sa mga filterscript.
## Halimbawa ng Paggamit
```c
public OnPlayerExitVehicle(playerid, vehicleid)
{
new string[35];
format(string, sizeof(string), "INFO: Ikaw ay lumalabas sa sasakyan %i", vehicleid);
SendClientMessage(playerid, 0xFFFFFFFF, string);
return 1;
}
```
## Mga Dapat Unawain
:::warning
- Hindi tinawag kung ang manlalaro ay nahulog mula sa isang bisikleta o inalis mula sa isang sasakyan sa pamamagitan ng iba pang paraan tulad ng paggamit ng [SetPlayerPos](../funcions/SetPlayerPos.md).
- Dapat mong gamitin ang [OnPlayerStateChange](./OnPlayerStateChange) at tingnan kung ang kanilang lumang estado ay PLAYER_STATE_DRIVER o PLAYER_STATE_PASSENGER at ang kanilang bagong estado ay PLAYER_STATE_ONFOOT.
:::
## Mga Kaugnay na Callback
Maaaring maging kapaki-pakinabang din ang mga sumusunod na callback, dahil nauugnay ang mga ito sa callback na ito sa isang paraan o sa iba pa.
- [OnPlayerEnterVehicle:](./OnPlayerEnterVehicle.md): Tinatawag kapag ang manlalaro ay sumakay sa sasakyan.
- [OnPlayerStateChange](./OnPlayerStateChange.md): Tinatawag kapag nagbago ang estado ng manlalaro.
## Mga Kaugnay na Functions
Maaaring maging kapaki-pakinabang ang mga sumusunod na function, dahil nauugnay ang mga ito sa callback na ito sa isang paraan o iba pa.
- [RemovePlayerFromVehicle](../functions/PutPlayerInVehicle.md): Itapon ang isang manlalaro sa labas ng kanilang sasakyan.
- [GetPlayerVehicleSeat](../functions/GetPlayerVehicleSeat.md): Suriin kung saan nakaupo ang isang manlalaro.
| openmultiplayer/web/docs/translations/fil/scripting/callbacks/OnPlayerExitVehicle.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/fil/scripting/callbacks/OnPlayerExitVehicle.md",
"repo_id": "openmultiplayer",
"token_count": 845
} | 369 |
---
title: AddVehicleComponent
description: Nagdaragdag ng 'bahagi' (madalas na tinutukoy bilang 'mod' (pagbabago)) sa isang sasakyan.
tags: ["vehicle"]
---
## Description
Nagdaragdag ng 'bahagi' (madalas na tinutukoy bilang 'mod' (pagbabago)) sa isang sasakyan. Ang mga wastong bahagi ay matatagpuan dito.
| Name | Description |
| --------------------------------------------- | --------------------------------------------------------------------------------- |
| vehicleid | Ang ID ng sasakyan kung saan idaragdag ang bahagi. Hindi dapat malito sa modelid. |
| [componentid](../resources/carcomponentid) | Ang ID ng component na idaragdag sa sasakyan. |
## Returns
0 - Hindi naidagdag ang component dahil wala ang sasakyan.
1 - Ang bahagi ay matagumpay na naidagdag sa sasakyan.
## Examples
```c
new gTaxi;
public OnGameModeInit()
{
gTaxi = AddStaticVehicle(420, -2482.4937, 2242.3936, 4.6225, 179.3656, 6, 1); // Taxi
return 1;
}
public OnPlayerStateChange(playerid, PLAYER_STATE:newstate, PLAYER_STATE:oldstate)
{
if (newstate == PLAYER_STATE_DRIVER && oldstate == PLAYER_STATE_ONFOOT)
{
if (GetPlayerVehicleID(playerid) == gTaxi)
{
AddVehicleComponent(gTaxi, 1010); // Nitro
SendClientMessage(playerid, 0xFFFFFFAA, "Nitro added to the Taxi.");
}
}
return 1;
}
```
## Notes
:::warning
Ang paggamit ng di-wastong component ID ay nag-crash sa laro ng player. Walang mga panloob na pagsusuri para dito.
:::
## Related Functions
- [RemoveVehicleComponent](RemoveVehicleComponent): Alisin ang isang bahagi mula sa isang sasakyan.
- [GetVehicleComponentInSlot](GetVehicleComponentInSlot): Suriin kung anong mga bahagi mayroon ang sasakyan.
- [GetVehicleComponentType](GetVehicleComponentType): Suriin ang uri ng bahagi sa pamamagitan ng ID.
- [OnVehicleMod](../callbacks/OnVehicleMod): Tinatawag kapag ang isang sasakyan ay modded.
- [OnEnterExitModShop](../callbacks/OnEnterExitModShop): Tinatawag kapag pumasok o lumabas ang sasakyan sa isang mod shop. | openmultiplayer/web/docs/translations/fil/scripting/functions/AddVehicleComponent.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/fil/scripting/functions/AddVehicleComponent.md",
"repo_id": "openmultiplayer",
"token_count": 948
} | 370 |
---
title: ChangeVehiclePaintjob
description: Baguhin ang paintjob ng sasakyan (para sa mga payak na kulay tingnan ang ChangeVehicleColor).
tags: ["vehicle"]
---
## Description
Change a vehicle's paintjob (for plain colors see ChangeVehicleColor).
| Name | Description |
| ---------- | -------------------------------------------------------------------------------------- |
| vehicleid | Ang ID ng sasakyan na babaguhin ang paintjob |
| paintjobid | Ang ID ng [Paintjob](../resources/paintjobs) na gagamitin. Gamitin ang 3 para matanggal ang paintjob. |
## Returns
Ang function na ito ay palaging nagbabalik ng 1 (tagumpay), kahit na ang sasakyang dumaan ay hindi nilikha.
:::warning
Kung itim ang kulay ng sasakyan , maaaring hindi makita ang paintjob. Mas mainam na gawing puti ang sasakyan bago ilapat ang painjob sa pamamagitan ng paggamit ng ChangeVehicleColor(vehicleid,1,1);
:::
## Examples
```c
new rand = random(3); // Magiging 0 1 o 2 (lahat ay valid)
ChangeVehicleColor(GetPlayerVehicleID(playerid),1,1); // siguraduhing puti ito para sa mas magandang resulta
ChangeVehiclePaintjob(GetPlayerVehicleID(playerid), rand); // binabago ang paintjob ng kasalukuyang sasakyan ng player sa isang random
```
## Related Functions
- [ChangeVehicleColor](ChangeVehicleColor): I-set ang kulay ng isang sasakyan.
- [OnVehiclePaintjob](../callbacks/OnVehiclePaintjob): Tinatawag kapag binago ang paintjob ng sasakyan. | openmultiplayer/web/docs/translations/fil/scripting/functions/ChangeVehiclePaintjob.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/fil/scripting/functions/ChangeVehiclePaintjob.md",
"repo_id": "openmultiplayer",
"token_count": 594
} | 371 |
---
title: GetObjectModel
description: Kunin ang model ID ng isang object (CreateObject).
tags: []
---
<VersionWarn version='SA-MP 0.3.7' />
## Description
Kunin ang model ID ng isang object (CreateObject).
| Name | Description |
| -------- | ---------------------------------------- |
| objectid | Ang ID ng object na kukunin ang model |
## Returns
Ang model ID ng object.
-1 kung walang object.
## Examples
```c
new objectid = CreateObject(1234, 0, 0, 0, 0, 0, 0);
new modelid = GetObjectModel(objectid);
```
## Related Functions
- [GetPlayerObjectModel](GetPlayerObjectModel): Kunin ang model ID ng isang player-object. | openmultiplayer/web/docs/translations/fil/scripting/functions/GetObjectModel.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/fil/scripting/functions/GetObjectModel.md",
"repo_id": "openmultiplayer",
"token_count": 232
} | 372 |
---
title: SetPlayerScore
description: I-set ang score ng player
tags: ["player"]
---
## Description
I-set ang score ng player. Ang mga player scores ay ipinapakita sa scoreboard (ipinapakita sa pamamagitan ng pagpindot sa TAB key).
| Name | Description |
| -------- | ----------------------------------------- |
| playerid | Ang ID ng player na i-seset ang score. |
| score | Ang value ng score na i-seset sa player |
## Returns
1: Matagumpay na naisakatuparan ang function.
0: Nabigo ang function na isagawa. Nangangahulugan ito na ang tinukoy na manlalaro ay hindi umiiral.
## Examples
```c
public OnPlayerDeath(playerid, killerid, WEAPON:reason)
{
// Magdagdag ng 1 sa score ng killer na ito. Kailangan muna nating suriin kung valid ito.
if (killerid != INVALID_PLAYER_ID)
{
SetPlayerScore(killerid, GetPlayerScore(killerid) + 1);
}
return 1;
}
```
## Related Functions
- [GetPlayerScore](GetPlayerScore): Kunin ang score ng isang player. | openmultiplayer/web/docs/translations/fil/scripting/functions/SetPlayerScore.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/fil/scripting/functions/SetPlayerScore.md",
"repo_id": "openmultiplayer",
"token_count": 383
} | 373 |
---
title: floatadd
description: Nagdaragdag ng dalawang float nang magkasama.
tags: ["math", "floating-point"]
---
<LowercaseNote />
## Description
Nagdaragdag ng dalawang float nang magkasama. Ang function na ito ay kalabisan dahil ang karaniwang operator (+) ay gumagawa ng parehong bagay.
| Name | Description |
| ------------- | ------------- |
| Float:Number1 | Unang float. |
| Float:Number2 | Pangalawang float. |
## Returns
Ang kabuuan ng dalawang binigay na float.
## Examples
```c
public OnGameModeInit()
{
new Float:Number1 = 2, Float:Number2 = 3; //Nagdedeklara ng dalawang float, Number1 (2) at Number2 (3)
new Float:Sum;
Sum = floatadd(Number1, Number2); //Sine-save ang Sum(=2+3 = 5) ng Number1 at Number2 sa float na "Sum"
return 1;
}
```
## Related Functions
- [Floatsub](Floatsub): Nag su-subtract ng dalawang floats.
- [Floatmul](Floatmul): Nag mu-multiply ng dalawang floats.
- [Floatdiv](Floatdiv): Nag di-dive ng isang float sa isa pa. | openmultiplayer/web/docs/translations/fil/scripting/functions/floatadd.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/fil/scripting/functions/floatadd.md",
"repo_id": "openmultiplayer",
"token_count": 388
} | 374 |
# Maintien du wiki SA:MP par open.mp
Bienvenue sur le wiki de SA:MP, qui est aujourd'hui maintenu par l'équipe open.mp et sa communauté _(et, plus généralement, la communauté SA:MP)_.
Cette documentation tend à recenser de la manière la plus exhaustive tout ce qui pourrait être utile aux développeurs. Elle vise à être la plus accessible possible, il est d'ailleurs très facile d'y [contribuer](/meta/Contributing).
## La disparition du wiki SA:MP
Il ne vous aura pas échappé que le wiki et le forum SA:MP ont été mis hors ligne fin septembre 2020. Vous pourrez également remarquer que, désormais, ces deux sites sont inaccessibles via les [webarchives](https://web.archive.org/).
Vous pouvez facilement [contribuer](/docs/meta/Contributing) à maintenir ce wiki et, puisqu'il s'agit de cela, à créer de nouvelles pages / transposer les anciennes pages du wiki SA:MP.
Il n'est pas nécessaire que vous maîtrisez Github, d'abord parce que la contribution est très facile avec open.mp et ensuite parce que vous pouvez toujours poser des questions sur le Discord, sur [le forum](https://forum.open.mp) ou sur les médias de open.mp.
Il convient également de rappeler que la communauté française dispose d'un [forum](http://sa-mp-fr.com/) elle aussi, vous y retrouverez également de l'aide et des ressources.
| openmultiplayer/web/docs/translations/fr/index.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/fr/index.md",
"repo_id": "openmultiplayer",
"token_count": 459
} | 375 |
---
title: OnNPCConnect
description: Ce rappel est appelé lorsqu'un PNJ se connecte avec succès au serveur.
tags: ["npc"]
---
## Description
Ce rappel est appelé lorsqu'un PNJ se connecte avec succès au serveur.
| Nom | Description |
| ------------ | --------------------------------------------------- |
| myplayerid | L'ID du joueur attribué au PNJ |
## Exemples
```c
public OnNPCConnect(myplayerid)
{
printf("J'ai réussi à me connecter au serveur avec l'ID %i !", myplayerid);
}
```
## Rappels Relatives
Les rappels suivants peuvent être utiles, car ils sont liés à ce rappel d'une manière ou d'une autre.
- [OnNPCDisconnect](OnNPCDisconnect): Ce rappel est appelé lorsque le PNJ est déconnecté du serveur.
- [OnPlayerConnect](OnPlayerConnect): Ce rappel est appelé lorsqu'un joueur se connecte au serveur.
- [OnPlayerDisconnect](OnPlayerDisconnect): Ce rappel est appelé lorsqu'un joueur quitte le serveur.
| openmultiplayer/web/docs/translations/fr/scripting/Callbacks/OnNPCConnect.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/fr/scripting/Callbacks/OnNPCConnect.md",
"repo_id": "openmultiplayer",
"token_count": 403
} | 376 |
---
title: OnPlayerConnect
description: This callback is called when a player connects to the server.
tags: ["player"]
---
## Paramètres
Cette callback est appelée quand un joueur se connecte au serveur.
| Nom | Description |
| --------------- | --------------------- |
| `int` playerid | ID du joueur connecté |
## Valeur de retour
Cette callback ne retourne rien, mais doit retourner quelque chose. Autrement dit, `return callback();` ne fonctionnera pas car la callback ne retourne rien, mais un return _(`return 1;` ou `return 0;`)_ doit être effectué dans la callback.
## Exemple
```c
public OnPlayerConnect(playerid)
{
new
string[64],
playerName[MAX_PLAYER_NAME];
/* Message de bienvenue */
GetPlayerName(playerid, playerName, MAX_PLAYER_NAME);
format(string, sizeof string, "[+] %s a rejoint le serveur. Bienvenue à lui !", playerName);
SendClientMessageToAll(0xFFFFFFAA, string);
return 1;
}
```
## Astuces
<TipNPCCallbacks />
## Callback connexe
- [OnPlayerDisconnect](OnPlayerDisonnect) : Quand un joueur se déconnecte du serveur.
| openmultiplayer/web/docs/translations/fr/scripting/Callbacks/OnPlayerConnect.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/fr/scripting/Callbacks/OnPlayerConnect.md",
"repo_id": "openmultiplayer",
"token_count": 428
} | 377 |
---
title: OnPlayerKeyStateChange
description: Cette callback est appelée lorsqu'un joueur appuie / lâche une touche de son clavier (uniquement les touches supportées par SA:MP)
tags: ["player"]
---
## Paramètres
Cette callback est appelée lorsqu'un joueur appuie / lâche une touche de son clavier (uniquement les touches supportées par SA:MP).
| Nom | Description |
| -------------- | ----------------------------------------------------------------------------------- |
| `int` playerid | ID du joueur qui appuie/relâche la touche |
| `int` newkeys | Un [tableau des touches](../resources/keys) est disponible après l'action |
| `int` oldkeys | Un [tableau des touches](../resources/keys) est également disponible avant l'action |
## Valeur de retour
**1** - Autorise la callback à être appelée par un autre script.
**0** - Refuser que la callback soit appelée ailleurs.
Elle est toujours appelée **1**, il faut donc la remplacer par **0** pour que les filterscripts ne s'en occupent pas.
## Astuces
:::info
Cette callback peut aussi être appelée par un NPC.
:::
:::tip
Les touches directionnelles ne fonctionnent pas avec OnPlayerKeyStateChange. Elles ne peuvent être détectées qu'avec [GetPlayerKeys](../functions/GetPlayerKeys) (dans [OnPlayerUpdate](../callbacks/OnPlayerUpdate) ou un timer)
:::
## Fonctions connexes
- [GetPlayerKeys](../functions/GetPlayerKeys): Vérifie quelle touche presse un joueur
## Informations suppleméntaires
### Introduction
Cette callback est appelée indifféremment selon que le joueur presse une touche ou la relâche _(v. [Keys](../resources/keys))_.
Les touches qui sont prises en charge ne sont pas les touches réelles du clavier, mais des touches de fonction attribuées à San Andreas. Cela signifie que, par exemple, vous ne pouvez pas détecter quand quelqu'un appuie sur la barre d'espace, mais ils peuvent détecter le moment où ils pressent leur touche sprint (qui peut, ou pas, être affectée à la barre d'espacement).
### Paramètres
Les paramètres de cette fonction sont une liste de toutes les touches actuellement maintenue enfoncée et toutes les touches enfoncées il y a un instant. La callback est appelée quand l'état d'une touche change _(quand une touche est relâchée ou enfoncée)_ et regarde les états de toutes les touches avant et après ce changement. Cette information peut être utilisée pour voir exactement ce qu'il se passe avec le clavier du joueur, mais les variables ne peuvent pas être utilisées de la même manière que les paramètres d'une autre fonction.
Pour réduire le nombre de variables, un seul BIT est utilisé pour représenter une clé, cela signifie qu'une variable peut contenir plusieurs clés à la fois et la simple comparaison des valeurs ne fonctionnera pas toujours.
### Comment NE PAS vérifier une touche
Présumons que vous voulez détecter quand le joueur presse la touche `KEY_FIRE`, le code devrait être :
```c
if (newkeys == KEY_FIRE)
```
Ce code peut même fonctionner dans vos tests, mais il est incorrect et vos tests sont insuffisants. Essayez de vous accroupir et d'appuyer sur le feu et votre code cessera instantanément de fonctionner. **Pourquoi?** Parce que `newkeys` n'est plus le même que `KEY_FIRE`, c'est le même que `KEY_FIRE` COMBINÉ AVEC `KEY_CROUCH`.
### Comment vérifier une touche
Donc, si la variable peut contenir plusieurs clés à la fois, comment en vérifier une seule ? La réponse est le masquage de bits. Chaque touche a son propre bit dans la variable _(certaines touches ont le même bit, mais ce sont des touches onfoot / incar, donc ne peuvent jamais être pressées en même temps de toute façon)_ et vous devez vérifier juste ce seul bit :
```c
if (newkeys & KEY_FIRE)
```
Notez que le simple **&** est correct - il s'agit d'un ET au niveau du bit, pas d'un ET logique, c'est ainsi que les deux esperluettes sont appelées.
Maintenant, si vous testez ce code, cela fonctionnera que vous soyez accroupi ou debout lorsque vous appuyez sur `KEY_FIRE`. Cependant, il reste un léger problème : il se déclenchera tant que vous maintiendrez la clé. `OnPlayerKeyStateChange` est appelé chaque fois qu'une clé change et ce code est vrai chaque fois que `KEY_FIRE` est maintenue enfoncée. Si vous appuyez `KEY_FIRE`, le code se déclenchera, si cette touche est maintenue et que vous appuyez sur `KEY_CROUCH`, ce code se déclenchera à nouveau parce qu'une touche _(CROUCH)_ a changé et que `KEY_FIRE` est toujours maintenu.
### Comment vérifier une touche qui a été enfoncée
C'est là qu'intervient `oldkeys`. Pour vérifier si une touche vient d'être enfoncée, vous devez d'abord vérifier si elle est définie dans `newkeys` - ce qui signifie qu'elle est maintenue enfoncée, puis vérifier qu'elle n'est PAS dans `oldkeys` - ce qui signifie que c'est juste juste été maintenu. Le code suivant fait cela :
```c
if ((newkeys & KEY_FIRE) && !(oldkeys & KEY_FIRE))
```
Cela ne sera vrai que lorsque `KEY_FIRE` est enfoncée pour la première fois, pas lorsqu'elle est maintenue et qu'une autre touche change.
### Comment vérifier une touche qui a été relâchée
C'est exactement le même principe que ci-dessus, mais inversé :
```c
if ((oldkeys & KEY_FIRE) && !(newkeys & KEY_FIRE))
```
### Comment vérifier plusieurs touches
Si vous voulez vérifier qu'un joueur MAINTIEN `KEY_CROUCH` **et** `KEY_FIRE`, voici le code :
```c
if ((newkeys & KEY_FIRE) && (newkeys & KEY_CROUCH))
```
Cependant, si vous voulez détecter lorsqu'ils appuient pour la première fois sur `KEY_FIRE` et s'accroupissent, le code suivant NE FONCTIONNERA PAS. Cela fonctionnera s'ils parviennent à appuyer sur les deux touches exactement en même temps, mais si les appuis sont partiellement espacés _(bien moins d'une demi-seconde)_, ce ne sera pas le cas:
```c
if ((newkeys & KEY_FIRE) && !(oldkeys & KEY_FIRE) && (newkeys & KEY_CROUCH) && !(oldkeys & KEY_CROUCH))
```
**Pourquoi pas?** Parce que `OnPlayerKeyStateChange` est appelé à chaque fois qu'une seule clé change. Alors ils appuient sur `KEY_FIRE` - `OnPlayerKeyStateChange` est appelé avec `KEY_FIRE` dans `newkeys` et pas dans `oldkeys`, puis ils appuient sur `KEY_CROUCH` - `OnPlayerKeyStateChange` est appelé avec `KEY_CROUCH` et `KEY_FIRE` dans `newkeys`, mais `KEY_FIRE` est maintenant aussi dans `oldkeys` car il a déjà été pressé, donc `! (Oldkeys & KEY_FIRE)` échouera. Heureusement la solution est très simple _(en fait plus simple que le code d'origine)_ :
```c
if ((newkeys & (KEY_FIRE | KEY_CROUCH)) == (KEY_FIRE | KEY_CROUCH) && (oldkeys & (KEY_FIRE | KEY_CROUCH)) != (KEY_FIRE | KEY_CROUCH))
```
Cela peut paraître compliqué, mais cela vérifie que les deux touches sont définies dans `newkeys` et que les deux clés ne sont pas définies dans `oldkeys`, si l'une d'elles était définie dans `oldkeys` cela n'a pas d'importance. Toutes ces choses peuvent être grandement simplifiées avec des définitions.
## Simplifications
### Détecter un maintien de touche
Le define :
```c
// HOLDING(keys)
#define HOLDING(%0) \
((newkeys & (%0)) == (%0))
```
Maintien d'une seule touche :
```c
if (HOLDING( KEY_FIRE ))
```
Maintien de plusieurs touches :
```c
if (HOLDING( KEY_FIRE | KEY_CROUCH ))
```
### Détecter la première pression sur une touche
Le define :
```c
// PRESSED(keys)
#define PRESSED(%0) \
(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
```
Pression d'une seule touche :
```c
if (PRESSED( KEY_FIRE ))
```
Pression de plusieurs touches :
```c
if (PRESSED( KEY_FIRE | KEY_CROUCH ))
```
### Détecter si un joueur enfonce actuellement une touche
Le define :
```c
// PRESSING(keyVariable, keys)
#define PRESSING(%0,%1) \
(%0 & (%1))
```
Enfoncement d'une seule touche :
```c
if (PRESSING( newkeys, KEY_FIRE ))
```
Enfoncement de plusieurs touches :
```c
if (PRESSING( newkeys, KEY_FIRE | KEY_CROUCH ))
```
### Détecter le relâchement d'une touche
Le define :
```c
// RELEASED(keys)
#define RELEASED(%0) \
(((newkeys & (%0)) != (%0)) && ((oldkeys & (%0)) == (%0)))
```
Relâchement d'une seule touche :
```c
if (RELEASED( KEY_FIRE ))
```
Relâchement de plusieurs touches :
```c
if (RELEASED( KEY_FIRE | KEY_CROUCH ))
```
## Exemple
### Super jump
```c
public OnPlayerKeyStateChange(playerid, KEY:newkeys, KEY:oldkeys)
{
if (PRESSED(KEY_JUMP))
{
new
Float:x,
Float:y,
Float:z;
GetPlayerPos(playerid, x, y, z);
SetPlayerPos(playerid, x, y, z + 10.0);
}
return 1;
}
```
| openmultiplayer/web/docs/translations/fr/scripting/Callbacks/OnPlayerKeyStateChange.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/fr/scripting/Callbacks/OnPlayerKeyStateChange.md",
"repo_id": "openmultiplayer",
"token_count": 3332
} | 378 |
---
title: OnPlayerStreamOut
description: Cette fonction est appelée quand un joueur est déchargé (n'est plus visible) pour un joueur.
tags: ["player"]
---
## Paramètres
Cette fonction est appelée quand un joueur est déchargé (n'est plus visible) pour un joueur.
| Nom | Description |
| ----------------- | --------------------------------------- |
| `int` playerid | L'ID de joueur déchargé par le joueur |
| `int` forplayerid | L'ID du joueur qui a déchargé le joueur |
## Valeur de retour
Cette callback ne retourne rien, mais doit retourner quelque chose. Autrement dit, `return callback();` ne fonctionnera pas car la callback ne retourne rien, mais un return _(`return 1;` ou `return 0;`)_ doit être effectué dans la callback.
## Exemple
```c
public OnPlayerStreamOut(playerid, forplayerid)
{
new
string[80];
format(string, sizeof(string), "Le joueur ID %d vient d'être déchargé de votre client.", playerid);
SendClientMessage(forplayerid, 0xFF0000FF, string);
return 1;
}
```
## Astuces
<TipNPCCallbacks />
## Fonctions connexes
| openmultiplayer/web/docs/translations/fr/scripting/Callbacks/OnPlayerStreamOut.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/fr/scripting/Callbacks/OnPlayerStreamOut.md",
"repo_id": "openmultiplayer",
"token_count": 445
} | 379 |
---
title: OnVehicleSirenStateChange
description: Cette callback est appelée lorsque l'état de la sirène d'un véhicule change.
tags: ["vehicle"]
---
<VersionWarn name='callback' version='SA-MP 0.3.7' />
## Paramètres
Cette callback est appelée lorsque l'état de la sirène d'un véhicule change.
| Nom | Description |
| --------------- | ----------------------------------------------------------------------- |
| `int` playerid | L'ID du joueur qui a déclenché la sirène (conducteur) |
| `int` vehicleid | L'ID du véhicule dont l'état de la sirène a changé. |
| `int` newstate | **0** si la sirène a été désactivée, **1** si la sirène a été activée. |
## Valeur de retour
Cette callback ne retourne aucune valeur particulière.
## Exemple
```c
public OnVehicleSirenStateChange(playerid, vehicleid, newstate)
{
if(newstate) GameTextForPlayer(playerid, "~W~Sirene ~G~on", 1000, 3);
GameTextForPlayer(playerid, "~W~Sirene ~r~off", 1000, 3);
return 1;
}
```
## Astuces
:::tip
Cette callback est appelée seulement lorsque l'état de la sirène change, PAS quand la sirène alternative est utilisée (maintenir klaxon).
:::
## Fonctions connexes
- [GetVehicleParamsSirenState](../functions/GetVehicleParamsSirenState): Vérifie si la sirène du véhicule est ON ou OFF.
| openmultiplayer/web/docs/translations/fr/scripting/Callbacks/OnVehicleSirenStateChange.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/fr/scripting/Callbacks/OnVehicleSirenStateChange.md",
"repo_id": "openmultiplayer",
"token_count": 594
} | 380 |
---
title: OnFilterScriptExit
description: Ez a visszahívás egy filterszkript leállása során kerül meghívásra.
tags: []
---
## Leírás
Ez a visszahívás egy filterszkript leállása során kerül meghívásra. Csak abban a filterszkriptben lesz meghívva amelyik éppen leáll.
## Példák
```c
public OnFilterScriptExit()
{
print("\n--------------------------------------");
print("A filterszkript leállt!");
print("--------------------------------------\n");
return 1;
}
```
## Kapcsolodó visszahívások
Ezek a visszahívások hasznosak lehetnek mivel valamilyen módon kapcsolódik ehhez a visszahíváshoz.
- [OnFilterSciptInit](OnFilterScriptInit): Ezt a visszahívást akkor hívja meg amikor egy filterszkript elindul.
- [OnGameModeInit](OnGameModeInit): Ezt a visszahívást akkor hívja meg amikor egy játékmód elindul.
- [OnGameModeExit](OnGameModeExit): Ezt a visszahívást akkor hívja meg amikor egy játékmód leáll.
| openmultiplayer/web/docs/translations/hu/scripting/callbacks/OnFilterScriptExit.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/hu/scripting/callbacks/OnFilterScriptExit.md",
"repo_id": "openmultiplayer",
"token_count": 405
} | 381 |
---
title: OnClientCheckResponse
description: This callback is called when a SendClientCheck request completes
tags: []
---
## Description
This callback is called when a SendClientCheck request completes.
| Name | Description |
| ------------- | --------------------------------- |
| playerid | ID player yang dicek. |
| actionid | Tipe cek yang dilakukan. |
| memaddr | 'address' yang diminta. |
| retndata | Hasil dari cek tersebut. |
## Returns
Selalu terpanggil pertama kali di filterscripts.
## Contoh
```c
public OnPlayerConnect(playerid)
{
SendClientCheck(playerid, 0x48, 0, 0, 2);
return 1;
}
public OnClientCheckResponse(playerid, actionid, memaddr, retndata)
{
if(actionid == 0x48) // or 72
{
print("WARNING: The player doesn't seem to be using a regular computer!");
Kick(playerid);
}
return 1;
}
```
## Catatan
:::warning
Callback ini hanya terpanggil di filterscripts.
:::
## Fungsi Terkait
- [SendClientCheck](../functions/SendClientCheck): Melakukan memory check kepada client.
| openmultiplayer/web/docs/translations/id/scripting/callbacks/OnClientCheckResponse.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/id/scripting/callbacks/OnClientCheckResponse.md",
"repo_id": "openmultiplayer",
"token_count": 454
} | 382 |
---
title: OnPlayerDeath
description: Callback ini akan terpanggil ketika pemain mati, entah itu dengan bunuh diri atau terbunuh oleh pemain lain.
tags: ["player"]
---
## Deskripsi
Callback ini akan terpanggil ketika pemain mati, entah itu dengan bunuh diri atau terbunuh oleh pemain lain.
| Nama | Deskripsi |
|---------------|---------------------------------------------------------------------------------------|
| playerid | ID dari pemain yang mati. |
| killerid | ID dari pemain yang membunuh pemain yang mati, atau INVALID_PLAYER_ID jika tidak ada. |
| WEAPON:reason | ID dari alasan untuk kematian pemain. |
## Returns
0 - Akan melarang filterscript lain untuk menerima callback ini.
1 - Mengindikasikan bahwa callback ini akan dilanjutkan ke filtercript lain.
Selalu terpanggil pertama di filterscripts.
## Contoh
```c
new PlayerDeaths[MAX_PLAYERS];
new PlayerKills[MAX_PLAYERS];
public OnPlayerDeath(playerid, killerid, WEAPON:reason)
{
SendDeathMessage(killerid, playerid, reason); // Menunjukkan metode bunuh di killfeed
// Cek apakah killerid valid sebelum melakukan apapun dengan itu
if(killerid != INVALID_PLAYER_ID)
{
PlayerKills[killerid] ++;
}
// Diluar dari cek, handle sesuatu untuk playerid (ini akan selalu valid)
PlayerDeaths[playerid] ++;
return 1;
}
```
## Catatan
:::tip
Alasan akan mengembalikan nilai 37 (flame thrower) dari jenis api apapun (seperti molotov, 18) Alasan akan mengembalikan nilai 51 dari senjata apapun yang membuat ledakan (seperti RPG, grenade) Anda tidak perlu mengecek apakah killerid valid sebelum menggunakannya di SendDeathMessage. INVALID_PLAYER_ID adalah parameter killer ID yang valid didalam fungsi itu. playerid hanyalah satu-satunya yang dapat memanggil callback. (baik untuk anti fake death)
:::
:::warning
Anda HARUS cek apakah 'killerid' valid (bukan INVALID_PLAYER_ID) sebelum menggunakannya didalam array (atau dimana saja), yang bisa menyebabkan skrip OnPlayerDeath menjadi crash (tidak semua skrip). Ini karena INVALID_PLAYER_ID bernilai 65535, dan ketika sebuah array hanya mempunyai elemen 'MAX_PLAYERS', misalkan 500, Anda akan mencoba mengakses index diatas 499, yang dimana itu luar batas.
:::
## Fungsi Terkait
- [SendDeathMessage](../functions/SendDeathMessage): Menambahkan kematian didalam death list.
- [SetPlayerHealth](../functions/SetPlayerHealth): Mengatur darah pemain.
| openmultiplayer/web/docs/translations/id/scripting/callbacks/OnPlayerDeath.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/id/scripting/callbacks/OnPlayerDeath.md",
"repo_id": "openmultiplayer",
"token_count": 1093
} | 383 |
---
title: OnPlayerUpdate
description: Callback ini akan terpanggil ketika klien/pemain memperbarui server dengan statusnya.
tags: ["player"]
---
## Deskripsi
Callback ini di panggil ketika klien/pemain memperbarui server dengan statusnya. Ini sering digunakan untuk membuat memanggil balik khusus untuk pembaruan klien yang tidak dilacak secara aktif oleh server, seperti pembaruan kesehatan atau baju besi atau pemain yang mengganti senjata.
| Nama | Deskripsi |
| -------- | ------------------------------------------ |
| playerid | ID dari pemain yang mengirim paket pembaruan. |
## Returns
0 - Pembaruan dari pemain ini tidak akan di duplikat ke klien lain.
1 - Menunjukkan bahwa pembaruan ini dapat diproses secara normal dan dikirim ke pemain lain.
Ini selalu di panggil pertama dalam filtersciprt.
## Contoh
```c
public OnPlayerUpdate(playerid)
{
new iCurWeap = GetPlayerWeapon(playerid); // Mengembalikan senjata kepada pemain saat ini
if (iCurWeap != GetPVarInt(playerid, "iCurrentWeapon")) // Jika dia mengganti senjata sejak pembaruan terakhir
{
// Mari kita memanggil balik panggilan bernama OnPlayerChangeWeapon
OnPlayerChangeWeapon(playerid, GetPVarInt(playerid, "iCurrentWeapon"), iCurWeap);
SetPVarInt(playerid, "iCurrentWeapon", iCurWeap);//Memperbarui variabel senjata
}
return 1; // Kirim pembaruan ini ke pemain lain.
}
stock OnPlayerChangeWeapon(playerid, oldweapon, newweapon)
{
new s[128],
oWeapon[24],
nWeapon[24];
GetWeaponName(oldweapon, oWeapon, sizeof(oWeapon));
GetWeaponName(newweapon, nWeapon, sizeof(nWeapon));
format(s, sizeof(s), "Kamu telah mengganti senjata dari %s ke %s!", oWeapon, nWeapon);
SendClientMessage(playerid, 0xFFFFFFFF, s);
}
public OnPlayerUpdate(playerid)
{
new Float:fHealth;
GetPlayerHealth(playerid, fHealth);
if (fHealth != GetPVarFloat(playerid, "faPlayerHealth"))
{
// Darah pemain telah berubah sejak pembaruan terakhir -> server, jadi jelas itu yang diperbarui.
// Mari kita lakukan pemeriksaan lanjutan untuk melihat apakah dia kehilangan atau memperoleh Darah, cheat anti-health? ;)
if (fHealth > GetPVarFloat(playerid, "faPlayerHealth"))
{
/* Dia telah mendapatkan Darah! Cheat? Tulis skrip Anda sendiri di sini untuk mengetahui bagaimana seorang pemain
memperoleh darah! */
}
else
{
/* Dia telah kehilangan darah! */
}
SetPVarFloat(playerid, "faPlayerHealth", fHealth);
}
}
```
## Catatan
<TipNPCCallbacks />
:::warning
Callback ini di panggil, rata-rata, 30 kali per detik, per pemain; hanya di gunakan ketika Anda tahu untuk apa itu (atau lebih penting lagi untuk TIDAK di masukkan). Frekuensi panggilan balik ini untuk setiap pemain bervariasi, tergantung pada apa yang dilakukan pemain. Mengemudi atau menembak akan memicu lebih banyak pembaruan daripada diam.
:::
## Fungsi Terkait
| openmultiplayer/web/docs/translations/id/scripting/callbacks/OnPlayerUpdate.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/id/scripting/callbacks/OnPlayerUpdate.md",
"repo_id": "openmultiplayer",
"token_count": 1263
} | 384 |
---
title: Kick
description: Tendang player dari server. Player harus keluar dari game dan re-connect jika mereka masih ingin lanjut bermain.
tags: ["administration"]
---
## Deskripsi
Tendang player dari server. Player harus keluar dari game dan re-connect jika mereka masih ingin lanjut bermain.
| Nama | Deskripsi |
| -------- | ----------------------------- |
| playerid | ID player yang ingin ditendang. |
## Returns
Fungsi ini selalu me-return 1, walaupun fungsi gagal di eksekusi (tidak ada player tersebut didalam server).
## Catatan
:::warning
Tindakan apa pun yang diambil langsung sebelum Kick() (seperti mengirim pesan dengan SendClientMessage) tidak akan sampai ke player. Timer harus digunakan untuk menunda kick.
:::
## Contoh
```c
// Untuk memunculkan pesan (contoh: alasan) untuk player sebelum koneksi terputus
// Anda harus menggunakan timer untuk membuat sebuah delay. Delay ini hanya membutuhkan beberapa milisekon saja,
// akan tetapi contoh ini menggunakan satu detik penuh hanya untuk berjaga-jaga.
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp(cmdtext, "/kickme", true) == 0)
{
// Tendang player yang menggunakan command ini.
// Pertama, kirim player nya sebuah pesan.
SendClientMessage(playerid, 0xFF0000FF, "You have been Tendanged!");
// Kemudian, buat sebuah timer untuk menunda fungsi Kick selama sedetik
SetTimerEx("DelayedKick", 1000, false, "i", playerid);
return 1;
}
return 0;
}
forward DelayedKick(playerid);
public DelayedKick(playerid)
{
Kick(playerid);
return 1;
}
```
## Fungsi Terkait
- [Ban](Ban): Ban player yang sedang berada di dalam server.
- [BanEx](BanEx): Ban player dengan alasan. | openmultiplayer/web/docs/translations/id/scripting/functions/Kick.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/id/scripting/functions/Kick.md",
"repo_id": "openmultiplayer",
"token_count": 682
} | 385 |
---
title: tolower
description: Fungsi ini mengubah sebuah huruf menjadi huruf besar.
tags: ["string"]
---
<LowercaseNote />
## Deskripsi
Fungsi ini mengubah sebuah huruf menjadi huruf besar.
| Nama | Deskripsi |
| ---- | ------------------------------------------ |
| c | Karakter yang akan diganti ke huruf besar. |
## Returns
Nilai ASCII dari karakter yang telah disediakan menjadi bentuk huruf besar.
## Contoh
```c
public OnPlayerText(playerid, text[])
{
text[0] = toupper(text[0]);
//Ini mengubah karakter utama menjadi huruf besar.
return 1;
}
```
## Fungsi Terkait
- [tolower](tolower): Fungsi ini mengubah sebuah huruf menjadi huruf kecil.
| openmultiplayer/web/docs/translations/id/scripting/functions/toupper.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/id/scripting/functions/toupper.md",
"repo_id": "openmultiplayer",
"token_count": 304
} | 386 |
---
id: startingids
title: ID Permulaan
description: Semuanya, seperti objek, pemain, atau ID kendaraan menggunakan ID. Beberapa ID dimulai dari 0, ada juga yang dimulai dari 1.
sidebar_label: ID Permulaan
---
Semuanya, seperti objek, pemain, atau ID kendaraan menggunakan ID. Beberapa ID dimulai dari 0, ada juga yang dimulai dari 1.
| Tipe | ID Permulaan |
| ------------------------- | ------------ |
| Label Teks 3D | 0 |
| Aktor | 0 |
| File | 0 |
| GangZone | 0 |
| Objek | 1 |
| Pickup | 0 |
| Pemain | 0 |
| Kelas Pemain | 0 |
| TextDraw / PlayerTextDraw | 0 |
| Timer | 1 |
| Kendaraan | 1 |
Yang bisa Anda lihat, kendaraan dan objek dimulai dari 1, bukan 0! Sehingga ketika Anda berencana menggunakan sebuah array untuk menyimpan semua ID, Anda harus menggunakan ID dari CreateObject/CreateVehicle/... dan kurangi 1 untuk mendapatkan ID elemen dari array.
| openmultiplayer/web/docs/translations/id/scripting/resources/startingids.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/id/scripting/resources/startingids.md",
"repo_id": "openmultiplayer",
"token_count": 663
} | 387 |
---
title: Menu Guide
---
Sebuah tutorial pendek yang menjelaskan bagaimana cara menggunakan sistem menu pada game. Sistem menu ini sangat berbeda dengan SA-MP dialog dan lebih mencerminkan UI tradisional dari gim aslinya.
## Menu di dalam SA-MP
Menu kelihatannya sangat rumit dan susah dibuat scriptnya untuk kebanyakan pengguna, namun sebenarnya tidak. Disini saya akan menunjukkan bagaimana cara membuat menu simpel. Dan nantinya kita akan membuat sebuah teleport menu.
## Langkah pertama menu
Pertama kita harus membuat sebuah menu. Prefix sebelumnya adalah `Menu:` ini adalah variable [tag](../scripting/language/tags) yang benar. Terdapat beberapa tipe dari beberapa penggunaan seperti `Float:` `bool:` `Text3D:` dan lain-lain. Buatlah kodenya diposisi paling atas di kode kalian:
```c
new Menu:teleportmenu;
```
Oke, kita sudah membuat variable untuk menaruh menu. Sekarang kita membuat menu dan menetapkan variable yang sudah dibuat ke menu. Ketik ini pada `OnGameModeInit`:
```c
teleportmenu = CreateMenu("Teleportmenu", 2, 200.0, 100.0, 150.0, 150.0);
```
Sedikit penjelasan tentang argumen [CreateMenu](../scripting/functions/CreateMenu).
**Parameters:**
| Parameter | Menentukan |
| --------------- | --------------------------------------------------------------------- |
| title | Judul menu |
| columns | Angka yang menentukan berapa banyak kolom yang digunakan (maksimal 2) |
| Float:x | Untuk menentukan posisi tinggi dari menu pada layar (kiri ke kanan) |
| Float:y | Untuk menentukan lebar dari menu pada layar (atas dan bawah) |
| Float:col1width | Lebar dari kolom pertama |
| Float:col2width | Lebar dari kolom kedua |
## Menambahkan beberapa menu item
Ok, sekarang kita sudah dapat Menu nya, tapi sekarang kita butuh beberapa item, yang dimana dapat dipilih di dalam menu. Kalian dapat menambahkannya di bawah `CreateMenu` yang sebelumnya kita buat.
```c
AddMenuItem(teleportmenu, 0, "LS");
AddMenuItem(teleportmenu, 0, "LS");
AddMenuItem(teleportmenu, 0, "SF");
AddMenuItem(teleportmenu, 0, "SF");
AddMenuItem(teleportmenu, 0, "LV");
AddMenuItem(teleportmenu, 0, "LV");
AddMenuItem(teleportmenu, 1, "Grove Street");
AddMenuItem(teleportmenu, 1, "Starfish Tower");
AddMenuItem(teleportmenu, 1, "Wheel Arch Angels");
AddMenuItem(teleportmenu, 1, "Jizzys");
AddMenuItem(teleportmenu, 1, "4 Dragons");
AddMenuItem(teleportmenu, 1, "Come-a-Lot");
```
Penjelasan mengenai [AddMenuItem](../scripting/functions/AddMenuItem):
| menuid | menuid dari menu yang dimana item akan ditampilkan |
| ------ | -------------------------------------------------- |
| column | Kolom tempat item akan ditampilkan |
| text | Teks dari item |
## Membuat efek pada item
Oke, sekarang kita sudah membuat menu lengkap dengan terdapat item, apa yang harus terjadi jika kalian memilih item? Dalam contoh kami, kami ingin membuat teleportmenu, jadi seharusnya kita bisa teleport ke posisi yang kita pilih. Ketika player memilih sebuah item pada menu, script akan memanggil callback [OnPlayerSelectedMenuRow](../scripting/callbacks/OnPlayerSelectedMenuRow). Cara yang paling bagus untuk dilakukan adalah menggunakan switch, ini seperti beberapa statement if untuk memastikan jika sebuah variable sangat bernilai untuk value tertentu. Tapi pertama kita hanya ingin membuat efek untuk menu yang kita ingin, jadi kita harus membuat variable yang menampung menu ketika menu dilihat oleh player, ini dilakukan dengan `GetPlayerMenu`:
```c
new Menu:CurrentMenu = GetPlayerMenu(playerid);
```
Sekarang, ketika seseorang memilih sesuatu di dalam menu, menuid mereka akan disimpan pada `CurrentMenu`.
Sekarang kita harus memeriksa apakah menu yang mereka pilih adalah menu yang kita inginkan:
```c
public OnPlayerSelectedMenuRow(playerid, row)
{
new Menu:CurrentMenu = GetPlayerMenu(playerid);
if (CurrentMenu == teleportmenu)
{
//stuff
}
return 1;
}
```
Sekarang diantara braket ini adalah tempat `switch` berada, ini memastikan item apa yang pemain pilih atau `row` bisa digunakan dengan statement `if` untuk memeriksa apa benar itu `row`, tapi `switch` adalah cara yang jauh lebih sederhana untuk menulisnya.
```c
if(CurrentMenu == teleportmenu)
{
switch(row)
{
case 0: //Grove Street
{
SetPlayerPos(playerid, 2493.9133, -1682.3986, 13.3382);
SetPlayerInterior(playerid, 0);
SendClientMessage(playerid, 0xFFFFFFFF, "Selamat datang di Grove Street");
}
case 1: //Starfish Tower
{
SetPlayerPos(playerid, 1541.2833, -1362.4741, 329.6457);
SetPlayerInterior(playerid, 0);
SendClientMessage(playerid, 0xFFFFFFFF, "Selamat datang di atas Starfish Tower");
}
case 2: //Wheel Arch Angels
{
SetPlayerPos(playerid, -2705.5503, 206.1621, 4.1797);
SetPlayerInterior(playerid, 0);
SendClientMessage(playerid, 0xFFFFFFFF, "Selamat datang di Wheel Arch Angels tuning-shop");
}
case 3: //Jizzys
{
SetPlayerPos(playerid, -2617.5156, 1390.6353, 7.1105);
SetPlayerInterior(playerid, 0);
SendClientMessage(playerid, 0xFFFFFFFF, "Selamat datang di Jizzy's Nightclub!");
}
case 4: //4Dragons
{
SetPlayerPos(playerid, 2028.5538, 1008.3543, 10.8203);
SetPlayerInterior(playerid, 0);
SendClientMessage(playerid, 0xFFFFFFFF, "Selamat datang di Four Dragons Casino");
}
case 5: //Come-a-Lot
{
SetPlayerPos(playerid, 2169.1838, 1122.5426, 12.6107);
SetPlayerInterior(playerid, 0);
SendClientMessage(playerid, 0xFFFFFFFF, "Selamat datang di Come-a-Lot casino!");
}
}
}
```
## Langkah terakhir
Sekarang kita membutuhkan perintah untuk menampilkan menu. Ini adalah cara yang paling mudah. Dibandingkan dengan `strcmp` dan `ShowMenuForPlayer`. Ini bisa dilakukan dengan `OnPlayerCommandText`. Atau, jika kalian sudah memiliki command processor, gunakanlah itu sebagai ganti dari `ShowMenuForPlayer`.
```c
if(strcmp(cmdtext, "/teleport", true) == 0)
{
ShowMenuForPlayer(teleportmenu,playerid);
return 1;
}
```
Sangat mudah, bukan?
## Kata terakhir
Oke, setelah kalian membaca ini dan memahaminya, cobalah untuk membuat menu kalian sendiri. Seperti yang kalian lihat, ini tidaklah sulit, tapi ini akan membuat pemain di dalam server kamu sangat terkesan. Dan kalian dapat membuatnya lebih keren daripada ini. Ini sangatlah berguna bagi general store dan supermarket untuk membeli sesuatu. Lalu kalian dapat mengurangi uang sebagai efek dan harga yang ditampilkan di kolom lain pada menu. Tapi sekarang, buatlah sesuai kebutuhan kalian.
Kalian dapat menambahkan [TogglePlayerControllable](../scripting/functions/TogglePlayerControllable) dengan `false` setelah `ShowPlayerMenu` dan [TogglePlayerControllable](../scripting/functions/TogglePlayerControllable) dengan `true` pada akhir `OnPlayerSelectedMenuRow`, jadi pemain tidak dapat berpindah ketika memilih sesuatu di dalam menu.
Saya harap kalian dapat mempelajari sesuatu dari tutorial ini. Jika kamu memiliki pertanyaan, silahkan bertanya di forum/discord.
| openmultiplayer/web/docs/translations/id/tutorials/MenuGuide.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/id/tutorials/MenuGuide.md",
"repo_id": "openmultiplayer",
"token_count": 3184
} | 388 |
---
title: AddStaticPickup
description: Ta funkcja dodaje „statyczny” pickup do gry.
tags: []
---
## Opis
Ta funkcja dodaje „statyczny” pickup do gry. Pickupy wspierają bronie, zdrowie, kamizelkę itd. i mogą działać bez konieczności ich dodatkowego kodowania (bronie/życie/kamizelka będą dawane automatycznie).
| Nazwa | Opis |
| ----------------------------------- | ----------------------------------------------------------------------------------------------------------------- |
| [model](../resources/pickupids.md) | Model pickupu. |
| [type](../resources/pickuptypes.md) | Typ pickupu. Decyduje o reakcji pickupu na jego podniesienie. |
| Float:X | Koordynat X, na którym pickup zostanie utworzony. |
| Float:Y | Koordynat Y, na którym pickup zostanie utworzony. |
| Float:Z | Koordynat Z, na którym pickup zostanie utworzony. |
| virtualworld | ID wirtualnego świata, w którym pickup ma zostać umieszczony. Użyj -1, aby pokazać pickup we wszystkich światach. |
## Zwracane wartości
1: Pickup został utworzony pomyślnie.
0: Pickup nie został utworzony.
## Przykłady
```c
public OnGameModeInit()
{
// Tworzy pickup z kamizelką
AddStaticPickup(1242, 2, 1503.3359, 1432.3585, 10.1191, 0);
// Tworzy pickup od życia, tuż obok kamizelki
AddStaticPickup(1240, 2, 1506.3359, 1432.3585, 10.1191, 0);
return 1;
}
```
## Uwagi
:::tip
Ta funkcja nie zwraca ID pickupu, którego możesz użyć na przykład w OnPlayerPickUpPickup. Użyj CreatePickup, jeżeli chcesz przypisać ID.
:::
## Powiązane funkcje
- [CreatePickup](CreatePickup.md): Tworzy pickup.
- [DestroyPickup](DestroyPickup.md): Kasuje pickup.
- [OnPlayerPickUpPickup](../callbacks/OnPlayerPickUpPickup.md): Wywoływane, gdy gracz podnosi pickup.
| openmultiplayer/web/docs/translations/pl/scripting/functions/AddStaticPickup.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/pl/scripting/functions/AddStaticPickup.md",
"repo_id": "openmultiplayer",
"token_count": 1334
} | 389 |
---
title: AttachPlayerObjectToVehicle
description: Przyczepia obiekt gracza do pojazdu.
tags: ["player", "vehicle"]
---
## Opis
Przyczepia obiekt gracza do pojazdu.
| Nazwa | Opis |
| ------------- | ----------------------------------------------------- |
| playerid | ID gracza, dla którego obiekt został stworzony. |
| objectid | ID obiektu, który ma zostać przyczepiony do pojazdu. |
| vehicleid | ID pojazdu, do którego obiekt ma zostać przyczepiony. |
| Float:OffsetX | Pozycja przyczepianego obiektu (koordynat X). |
| Float:OffsetY | Pozycja przyczepianego obiektu (koordynat Y). |
| Float:OffsetZ | Pozycja przyczepianego obiektu (koordynat Z). |
| Float:RotX | Rotacja przyczepianego obiektu (koordynat X). |
| Float:RotY | Rotacja przyczepianego obiektu (koordynat Y). |
| Float:RotZ | Rotacja przyczepianego obiektu (koordynat Z). |
## Zwracane wartości
Ta funkcja nie zwraca żadnych konkretnych wartości.
## Przykłady
```c
public OnPlayerStateChange(playerid, PLAYER_STATE:newstate, PLAYER_STATE:oldstate)
{
if (newstate == PLAYER_STATE_DRIVER) // Jeżeli gracz wsiadł do pojazdu
{
// Przyczepmy potężną krowę.
new cow_object = CreatePlayerObject(playerid, 16442, 0, 0, 0, 0, 0, 0);
AttachPlayerObjectToVehicle(playerid, cow_object, GetPlayerVehicleID(playerid), 0.0, 0.0, 1.0, 0.0, 0.0, 0.0);
}
}
```
## Uwagi
:::tip
Obiekt musi zostać utworzony, zanim spróbujemy przyczepić go do pojazdu.
:::
## Powiązane funkcje
- [CreatePlayerObject](CreatePlayerObject.md): Tworzy obiekt dla konkretnego gracza.
- [DestroyPlayerObject](DestroyPlayerObject.md): Kasuje obiekt gracza.
- [IsValidPlayerObject](IsValidPlayerObject.md): Sprawdza, czy podany obiekt gracza istnieje.
- [MovePlayerObject](MovePlayerObject.md): Przesuwa obiekt gracza.
- [StopPlayerObject](StopPlayerObject.md): Zatrzymuje obiekt gracza.
- [SetPlayerObjectRot](SetPlayerObjectRot.md): Ustawia rotację obiektu gracza.
- [GetPlayerObjectPos](GetPlayerObjectPos.md): Podaje pozycję obiektu gracza.
- [SetPlayerObjectPos](SetPlayerObjectPos.md): Ustawia pozycję obiektu gracza.
- [GetPlayerObjectRot](GetPlayerObjectRot.md): Podaje rotację obiektu gracza.
- [AttachPlayerObjectToPlayer](AttachPlayerObjectToPlayer.md): Przyczepia obiekt gracza do gracza.
- [CreateObject](CreateObject.md): Tworzy obiekt.
- [DestroyObject](DestroyObject.md): Kasuje obiekt.
- [IsValidObject](IsValidObject.md): Sprawdza, czy podany obiekt istnieje.
- [MoveObject](MoveObject.md): Przesuwa obiekt.
- [StopObject](StopObject.md): Zatrzymuje obiekt.
- [SetObjectPos](SetObjectPos.md): Ustawia pozycję obiektu.
- [SetObjectRot](SetObjectRot.md): Ustawia rotację obiektu.
- [GetObjectPos](GetObjectPos.md): Podaje pozycję obiektu.
- [GetObjectRot](GetObjectRot.md): Podaje rotację obiektu.
- [AttachObjectToPlayer](AttachObjectToPlayer.md): Przyczepia obiekt do gracza.
| openmultiplayer/web/docs/translations/pl/scripting/functions/AttachPlayerObjectToVehicle.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/pl/scripting/functions/AttachPlayerObjectToVehicle.md",
"repo_id": "openmultiplayer",
"token_count": 1348
} | 390 |
---
title: OnClientMessage
description: Esta callback é chamada toda vez que um NPC ver uma ClientMessage.
tags: []
---
## Descrição
Essa callback é chamada sempre que um NPC ver uma ClientMessage. Isso acontecerá sempre que uma função SendClientMessageToAll for usada e sempre que uma função SendClientMessage é enviada para um NPC. Esta callback não será chamada quando alguém falar algo. Para este tipo de texto, veja: NPC:OnPlayerText.
| Nome | Descrição |
| ------ | ---------------------------- |
| color | A cor que o ClientMessage é. |
| text[] | A mensagem em sí. |
## Retornos
Esta callback não suporta retornos.
## Exemplos
```c
public OnClientMessage(color, text[])
{
if (strfind(text,"Balanço Bancário: $0") != -1)
{
SendClientMessage(playerid, -1, "Eu sou pobre :(");
}
}
```
## Funções Relacionadas
| openmultiplayer/web/docs/translations/pt-BR/scripting/callbacks/OnClientMessage.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/pt-BR/scripting/callbacks/OnClientMessage.md",
"repo_id": "openmultiplayer",
"token_count": 352
} | 391 |
---
title: OnPlayerClickMap
description: OnPlayerClickMap é chamado quando um jogador pocisiona um ponto no mapa do menu de pausa (clicando com botão direito).
tags: ["player"]
---
## Descrição
OnPlayerClickMap é chamado quando um jogador pocisiona um ponto no mapa do menu de pausa (clicando com botão direito).
| Nome | Descrição |
| -------- | ----------------------------------------------------------------- |
| playerid | O ID do jogador que posicionou o ponto |
| Float:fX | A coordenada X de onde o jogador clicou |
| Float:fY | A coordenada y de onde o jogador clicou |
| Float:fZ | A coordenada z de onde o jogador clicou (impreciso - veja abaixo) |
## Retornos
1 - Irá previnir que outro filterscript receba esta callback.
0 - Indica que esta callback será passada para o próximo filterscript.
Sempre é chamada primeiro em filterscripts.
## Exemplos
```c
public OnPlayerClickMap(playerid, Float:fX, Float:fY, Float:fZ)
{
SetPlayerPosFindZ(playerid, fX, fY, fZ);
return 1;
}
```
## Notas
:::tip
Como o nome da callback diz, é apenas chamada quando o jogador marca o alvo no mapa, e não quandoa tecla é pressionada. O valor Z retornada será 0 (invalido) se a área clicada no mapa estiver muito distante do jogador. Use os plugins MapAndreas ou ColAndreas para receber uma coordenada Z mais precisa.
:::
## Funções Relacionadas
| openmultiplayer/web/docs/translations/pt-BR/scripting/callbacks/OnPlayerClickMap.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/pt-BR/scripting/callbacks/OnPlayerClickMap.md",
"repo_id": "openmultiplayer",
"token_count": 631
} | 392 |
---
title: OnPlayerGiveDamage
description: Esta callback é chamada quando um jogador causa danos a algum jogador.
tags: ["player"]
---
<VersionWarnPT name='callback' version='SA-MP 0.3.d' />
## Descrição
Esta callback é chamada quando um jogador causa danos a algum jogador.
| Nome | Descrição |
|------------------------------------|-------------------------------------|
| playerid | O ID do jogador que causou o dano. |
| damagedid | O ID do jogador que recebeu o dano. |
| Float:amount | A quantidade de dano causado. |
| WEAPON:weaponid | O motivo que causou o dano. |
| [bodypart](../resources/bodyparts) | A parte do corpo que foi atingida. |
## Retorno
1 - Irá previnir que outro filterscript receba esta callback.
0 - Indica que esta callback será passada para o próximo filterscript.
Sempre é chamada primeiro em filterscripts.
## Exemplos
```c
public OnPlayerGiveDamage(playerid, damagedid, Float:amount, WEAPON:weaponid, bodypart)
{
new string[128], victim[MAX_PLAYER_NAME], attacker[MAX_PLAYER_NAME];
new weaponname[24];
GetPlayerName(playerid, attacker, sizeof (attacker));
GetPlayerName(damagedid, victim, sizeof (victim));
GetWeaponName(weaponid, weaponname, sizeof (weaponname));
format(string, sizeof(string), "%s causou %.0f de dano em %s, arma: %s, corpo: %d", attacker, amount, victim, weaponname, bodypart);
SendClientMessageToAll(0xFFFFFFFF, string);
return 1;
}
```
## Notas
:::tip
Mantenha em mente que esta função pode ser imprecisa em alguns casos, Se deseja impedir que um determinado player cause dano a outro use SetPlayerTeam. O weaponid irá retornar 37 (flame thrower) para qualquer fonte que utilize fogo (EX: Molotov). Irá retornar 51 para qualquer fonte que utilize explosões (EX: RPG, granada). A arma sempre irá causar o máximo dano que ele suporta, por exemplo uma Desert Eagle que causa 46.2 de dano, em um pessoa com 100 de vida bastaria 3 tiros para mata-la, porém apesar de após de 2 tiros faltarem apenas 7.6 para mata-lo, a arma ainda causará 46.2 de dano.
:::
| openmultiplayer/web/docs/translations/pt-BR/scripting/callbacks/OnPlayerGiveDamage.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/pt-BR/scripting/callbacks/OnPlayerGiveDamage.md",
"repo_id": "openmultiplayer",
"token_count": 880
} | 393 |
---
title: OnPlayerText
description: Executada quando o Player envia uma mensagem no chat.
tags: ["player"]
---
## Descrição
Executada quando o Player envia uma mensagem no chat.
| Nome | Descrição |
| -------- | ---------------------------------------- |
| playerid | ID do jogador que enviou o texto. |
| text[] | Texto que o jogador enviou. |
## Retornos
Sempre executada primeiro nos filterscripts, ao retornar 0 bloqueia outros scripts de visualizarem a mesma.
## Exemplos
```c
public OnPlayerText(playerid, text[])
{
new pText[144];
format(pText, sizeof (pText), "(%d) %s", playerid, text);
SendPlayerMessageToAll(playerid, pText);
return 0; // Ignora o texto padrão e envia um personalizado.
}
```
## Notas
<TipNPCCallbacksPT />
## Funções Relacionadas
- [SendPlayerMessageToPlayer](../functions/SendPlayerMessageToPlayer): Força um jogador enviar uma mensagem para outro jogador.
- [SendPlayerMessageToAll](../functions/SendPlayerMessageToAll): Força um jogador a mandar uma mensagem visível para todos.
| openmultiplayer/web/docs/translations/pt-BR/scripting/callbacks/OnPlayerText.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/pt-BR/scripting/callbacks/OnPlayerText.md",
"repo_id": "openmultiplayer",
"token_count": 425
} | 394 |
---
title: OnVehicleStreamOut
description: Essa callback é chamada quando um veículo sai da área visível de um jogador.
tags: ["vehicle"]
---
## Descrição
Essa callback é chamada quando um veículo sai da área visível de um jogador.
| Nome | Descrição |
| ----------- | -------------------------------------------------------------- |
| vehicleid | ID do carro que saiu da área visível do jogador. |
| forplayerid | ID do jogador cujo o carro saiu da área visível de um jogador. |
## Retornos
Sempre é chamada primeiro em Filterscripts.
## Exemplos
```c
public OnVehicleStreamOut(vehicleid, forplayerid)
{
new string[48];
format(string, sizeof(string), "O carro de ID %d não está mais na sua área visível.", vehicleid);
SendClientMessage(forplayerid, 0xFFFFFFFF, string);
return 1;
}
```
## Notas
<TipNPCCallbacksPT />
## Funções Relacionadas
| openmultiplayer/web/docs/translations/pt-BR/scripting/callbacks/OnVehicleStreamOut.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/pt-BR/scripting/callbacks/OnVehicleStreamOut.md",
"repo_id": "openmultiplayer",
"token_count": 393
} | 395 |
---
title: Attach3DTextLabelToVehicle
description: Anexa uma Text Label 3D a um veículo específico.
tags: ["vehicle", "3dtextlabel"]
---
## Descrição
Anexa uma Text Label 3D a um veículo específico.
| Nome | Descrição |
| --------- | ---------------------------------------------------------------------------- |
| Text3D:textid | O ID da 3D text label a ser anexada. |
| vehicleid | O ID do veículo ao qual deseja anexar a 3D text label. |
| OffsetX | O deslocamento (offset) da coordenada X do veículo (O veículo é 0.0,0.0,0.0) |
| OffsetY | O deslocamento (offset) da coordenada Y do veículo (O veículo é 0.0,0.0,0.0) |
| OffsetZ | O deslocamento (offset) da coordenada Z do veículo (O veículo é 0.0,0.0,0.0) |
## Retorno
Esta função não retorna nenhum valor específico.
## Exemplos
```c
new
Text3D:gVehicle3dText[MAX_VEHICLES], // Criando a TextLabel para usar depois
gVehicleId;
public OnGameModeInit ( )
{
gVehicleId = CreateVehicle(510, 0.0. 0.0, 15.0, 5, 0, 120); // Criando o veículo.
gVehicle3dText[gVehicleId] = Create3DTextLabel("Exemplo Texto", 0xFF0000AA, 0.0, 0.0, 0.0, 50.0, 0, 1);
Attach3DTextLabelToVehicle(gVehicle3dText[gVehicleId], vehicle_id, 0.0, 0.0, 2.0); // Anexando a TextLabel ao veículo.
}
public OnGameModeExit ( )
{
Delete3DTextLabel(gVehicle3dText[gVehicleId]);
return true;
}
```
## Funções Relacionadas
- [Create3DTextLabel](Create3DTextLabel.md): Cria uma text label 3D.
- [Delete3DTextLabel](Delete3DTextLabel.md): Apaga uma text label 3D.
- [Attach3DTextLabelToPlayer](Attach3DTextLabelToPlayer.md): Anexa uma text label 3D a um jogador.
- [Update3DTextLabelText](Update3DTextLabelText.md): Muda o texto de uma 3D text label 3D.
- [CreatePlayer3DTextLabel](CreatePlayer3DTextLabel.md): Cria uma text label 3D para um jogador.
- [DeletePlayer3DTextLabel](DeletePlayer3DTextLabel.md): Apaga uma text label 3D de um jogador.
- [UpdatePlayer3DTextLabelText](UpdatePlayer3DTextLabelText.md): Muda o texto de uma text label 3D de um jogador.
| openmultiplayer/web/docs/translations/pt-BR/scripting/functions/Attach3DTextLabelToVehicle.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/pt-BR/scripting/functions/Attach3DTextLabelToVehicle.md",
"repo_id": "openmultiplayer",
"token_count": 955
} | 396 |
---
title: GangZoneFlashForPlayer
description: Faz a gangzone piscar para um jogador.
tags: ["player", "gangzone"]
---
## Descrição
Faz a gangzone piscar para um jogador.
| Nome | Descrição |
| ---------- | ------------------------------------------------------------------------------------------------------------- |
| playerid | O ID do jogador para o qual piscar a gangzone. |
| zone | O ID da gangzone a piscar. |
| flashcolor | A cor para piscar na gangzone, pode ser integer ou hex no formato de cor RGBA. Transparência Alpha suportada. |
## Retorno
Esta função não retorna nenhum valor específico.
## Exemplos
```c
new gGangZoneId;
public OnGameModeInit()
{
gGangZoneId = GangZoneCreate(1248.011, 2072.804, 1439.348, 2204.319);
return 1;
}
public OnPlayerSpawn(playerid)
{
GangZoneFlashForPlayer(playerid, gGangZoneId, COLOR_RED);
return 1;
}
```
## Funções Relacionadas
- [GangZoneCreate](GangZoneCreate): Cria uma gangzone.
- [GangZoneDestroy](GangZoneDestroy): Destrói uma gangzone.
- [GangZoneShowForPlayer](GangZoneShowForPlayer): Mostra uma gangzone a um jogador.
- [GangZoneShowForAll](GangZoneShowForAll): Mostra uma gangzone para todos os jogadores.
- [GangZoneHideForPlayer](GangZoneHideForPlayer): Esconde uma gangzone a um jogador.
- [GangZoneHideForAll](GangZoneHideForAll): Esconde uma gangzone para todos os jogadores.
- [GangZoneFlashForAll](GangZoneFlashForAll): Faz uma gangzone piscar para todos os jogadores.
- [GangZoneStopFlashForPlayer](GangZoneStopFlashForPlayer): Pare uma Gangzone de piscar para um jogador.
- [GangZoneStopFlashForAll](GangZoneStopFlashForAll): Pare uma Gangzone de piscar para todos os jogadores.
| openmultiplayer/web/docs/translations/pt-BR/scripting/functions/GangZoneFlashForPlayer.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/pt-BR/scripting/functions/GangZoneFlashForPlayer.md",
"repo_id": "openmultiplayer",
"token_count": 842
} | 397 |
---
title: GetPlayerMenu
description: Obtém o ID do menu que o player está a visualizar no momento (mostrado por ShowMenuForPlayer).
tags: ["player", "menu"]
---
## Descrição
Obtém o ID do menu que o player está a visualizar no momento (mostrado por ShowMenuForPlayer).
| Nome | Descrição |
| -------- | -------------------------------------------------- |
| playerid | O ID do jogador do qual deseja obter o menu atual. |
## Retorno
O ID do menu visualizado no momento pelo jogador, ou INVALID_MENU (255) se nenhum menu for mostrado. O valor retornado é marcado com Menu:.
## Exemplos
```c
new Menu:currentMenu = GetPlayerMenu(playerid); // Armazena o menu atual do jogador em 'CurrentMenu'
```
## Notas
:::tip
Retorna o menu anterior quando nenhum é mostrado.
:::
## Funções Relacionadas
- [ShowMenuForPlayer](ShowMenuForPlayer.md): Mostra um menu a um jogador.
- [HideMenuForPlayer](HideMenuForPlayer.md): Esconde um menu para um jogador.
- [CreateMenu](CreateMenu.md): Cria um menu.
- [DestroyMenu](DestroyMenu.md): Destrói um menu.
- [AddMenuItem](AddMenuItem.md): Adiciona um item a um menu.
- [OnPlayerSelectedMenuRow](../callbacks/OnPlayerSelectedMenuRow.md): É chamado quando o jogador seleciona uma linha de um menu.
- [OnPlayerExitedMenu](../callbacks/OnPlayerExitedMenu.md): É chamado quando um jogador sai de um menu.
| openmultiplayer/web/docs/translations/pt-BR/scripting/functions/GetPlayerMenu.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/pt-BR/scripting/functions/GetPlayerMenu.md",
"repo_id": "openmultiplayer",
"token_count": 507
} | 398 |
---
title: ShowPlayerDialog
description: Mostra um dialog (janela) asíncrono (um único por vez).
tags: ["player"]
---
## Descrição
Mostra um dialog (janela) asíncrono (um único por vez).
| Parâmetro | Descrição |
| --------- | ------------------------------------------------------------------------------------------------------------------------------ |
| playerid | ID do jogador que irá ver o dialog |
| dialogid | ID do dialog (será usado para processar as respostas). ID máximo 32767. Usar valores negativos fechará qualquer dialog aberto. |
| style | The [style](../resources/dialogstyles.md) of the dialog. |
| caption[] | Título mostrado no topo do dialog. O tamanho do caption não deve ultrapassar 64 caracteres, ou será cortado. |
| info[] | Texto que será mostrado no corpo do dialog. Use \n para iniciar uma nova linha e \t para espaço (TAB). |
| button1[] | Texto do botão esquerdo. |
| button2[] | Texto do botão direito. Manter vazio, caso queira ocultar o button2. |
## Retorno
1: A função foi executada corretamente.
0: A função falhou ao executar. Isto significa que o jogador não está conectado.
## Exemplos
```c
// Define os dialogid dentro de uma enum
enum
{
DIALOG_LOGIN,
DIALOG_WELCOME,
DIALOG_WEAPONS
}
// Alternativamente, por meio de macros:
#define DIALOG_LOGIN 1
#define DIALOG_WELCOME 2
#define DIALOG_WEAPONS 3
// Enums são recommendadas, já que você não pode reutilizar IDs. No entanto, enums usam memória para armazenar as definições, enquanto as define são pré-processadas na compilação.
// Exemplo para DIALOG_STYLE_MSGBOX:
ShowPlayerDialog(playerid, DIALOG_WELCOME, DIALOG_STYLE_MSGBOX, "Notice", "You are connected to the server", "Close", "");
// Exemplo para DIALOG_STYLE_INPUT:
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, "Login", "Enter your password below:", "Login", "Cancel");
// Exemplo para DIALOG_STYLE_LIST:
ShowPlayerDialog(playerid, DIALOG_WEAPONS, DIALOG_STYLE_LIST, "Weapons", "AK47\nM4\nSniper Rifle", "Option 1", "Option 2");
// Exemplo para DIALOG_STYLE_PASSWORD:
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Login", "Enter your password below:", "Login", "Cancel");
// Exemplo para DIALOG_STYLE_TABLIST:
ShowPlayerDialog(playerid, DIALOG_WEAPONS, DIALOG_STYLE_TABLIST, "Buy Weapon", "Deagle\t$5000\t100\nSawnoff\t$5000\t100\nPistol\t$1000\t50", "Select", "Cancel");
// Exemplo para DIALOG_STYLE_TABLIST_HEADERS:
ShowPlayerDialog(playerid, DIALOG_WEAPONS, DIALOG_STYLE_TABLIST_HEADERS, "Buy Weapon", "Weapon\tPrice\tAmmo\nDeagle\t$5000\t100\nSawnoff\t$5000\t100\nPistol\t$1000\t50", "Select", "Cancel");
```
## Notas
:::tip
É recomendado usar enumerações (enums - veja abaixo) ou constantes (#define) para determinar quais dialogid's estão sendo usados, para evitar confusões no futuro. Você nunca deve usar números direto, porque isso gera confusões.
:::
:::tip
Use cores embutidas para múltiplas cores no texto. Usando -1 como dialogid fecha todos os dialogs abertos na tela do cliente (jogador).
:::
## Funções relacionadas
- [TextDrawShowForPlayer](TextDrawShowForPlayer.md): Apresenta um textdraw para certo jogador.
- [OnDialogResponse](../callbacks/OnDialogResponse.md): É chamada quando um jogador responde a um dialog.
| openmultiplayer/web/docs/translations/pt-BR/scripting/functions/ShowPlayerDialog.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/pt-BR/scripting/functions/ShowPlayerDialog.md",
"repo_id": "openmultiplayer",
"token_count": 1733
} | 399 |
---
title: Estilos de corte de câmera
---
## Descrição
Para ser usado com [SetPlayerCameraLookAt](../functions/SetPlayerCameraLookAt), [InterpolateCameraPos](../functions/InterpolateCameraPos.md) e [InterpolateCameraLookAt](../functions/InterpolateCameraLookAt.md).
## Estilos de corte
```c
1 - CAMERA_MOVE
2 - CAMERA_CUT
```
| openmultiplayer/web/docs/translations/pt-BR/scripting/resources/cameracutstyles.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/pt-BR/scripting/resources/cameracutstyles.md",
"repo_id": "openmultiplayer",
"token_count": 124
} | 400 |
---
titlu: OnClientMessage
descriere: Acest callback este apelat oricand NPC-ul vede un ClientMessage
tags: []
---
## Descriere
Acest callback este apelat oricand NPC-ul vede un ClientMessage. Acesta va fi de fiecare data cand se utilizeaza functia SendClientMessageToAll si de fiecare data functia SendClientMessage este trimisa spre NPC. Acest callback nu o sa fie folosit cand cineva spune ceva. Pentru o versiune ca asta cu player text, vedem NPC:OnPlayerText.
| Nume | Descriere |
| ------ | ---------------------------- |
| color | Culoarea ClientMessage este. |
| text[] | Mesajul actual |
## Returns
Acest callback nu accepta returns.
## Exemplu
```c
public OnClientMessage(color, text[])
{
if (strfind(text,"Bank Balance: $0") != -1)
{
SendClientMessage(playerid, -1, "I am poor :(");
}
}
```
## Related Functions
| openmultiplayer/web/docs/translations/ro/scripting/callbacks/OnClientMessage.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/ro/scripting/callbacks/OnClientMessage.md",
"repo_id": "openmultiplayer",
"token_count": 326
} | 401 |
---
title: OnPlayerDisconnect
description: Acest callback este apelat atunci când un jucător se deconectează de la server.
tags: ["player"]
---
## Descriere
Acest callback este apelat atunci când un jucător se deconectează de la server.
| Nume | Descriere |
| -------- | -------------------------------------------------- |
| playerid | ID-ul jucătorului care s-a deconectat. |
| reason | Motivul deconectarii. Vezi tabelul de mai jos. |
## Returnări
0 - Va împiedica alte filterscript-uri să primească acest callback.
1 - Indică faptul că acest callback va fi transmis următorului filterscript.
Este întotdeauna numit primul în filterscript-uri.
## Motive
| ID | Motiv | Detalii |
| -- | ------------- | -------------------------------------------------------------------------------------------------------- |
| 0 | Timeout/Crash | Conexiunea jucătorului a fost pierdută. Fie jocul lor s-a prăbușit, fie rețeaua lor a avut o defecțiune. |
| 1 | Quit | Jucătorul a renunțat intenționat, fie folosind comanda /quit (/q), fie prin meniul de pauză. |
| 2 | Kick/Ban | Jucătorul a fost dat afara sau interzis de server. |
## Example
```c
public OnPlayerDisconnect(playerid, reason)
{
new
szString[64],
playerName[MAX_PLAYER_NAME];
GetPlayerName(playerid, playerName, MAX_PLAYER_NAME);
new szDisconnectReason[3][] =
{
"Timeout/Crash",
"Quit",
"Kick/Ban"
};
format(szString, sizeof szString, "%s a iesit de pe server, (%s).", playerName, szDisconnectReason[reason]);
SendClientMessageToAll(0xC4C4C4FF, szString);
return 1;
}
```
## Note
:::tip
Este posibil ca unele funcții să nu funcționeze corect atunci când sunt utilizate în acest apel invers, deoarece playerul este deja deconectat atunci când este apelat. Aceasta înseamnă că nu puteți obține informații clare din funcții precum GetPlayerIp și GetPlayerPos.
:::
## Funcții similare | openmultiplayer/web/docs/translations/ro/scripting/callbacks/OnPlayerDisconnect.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/ro/scripting/callbacks/OnPlayerDisconnect.md",
"repo_id": "openmultiplayer",
"token_count": 1024
} | 402 |
---
title: OnPlayerPickUpPickup
description: Apelat atunci când un jucător preia un pick-up creat cu CreatePickup.
tags: ["player"]
---
## Descriere
Apelat atunci când un jucător preia un pick-up creat cu CreatePickup.
| Nume | Descriere |
| -------- | ----------------------------------------------- |
| playerid | ID-ul jucătorului care a ridicat pickup-ul. |
| pickupid | ID-ul ridicării, returnat de CreatePickup. |
## Returnări
Este întotdeauna numit primul în modul de joc.
## Exemple
```c
new pickup_Cash;
new pickup_Health;
public OnGameModeInit()
{
pickup_Cash = CreatePickup(1274, 2, 0.0, 0.0, 9.0);
pickup_Health = CreatePickup(1240, 2, 0.0, 0.0, 9.0);
return 1;
}
public OnPlayerPickUpPickup(playerid, pickupid)
{
if (pickupid == pickup_Cash)
{
GivePlayerMoney(playerid, 1000);
}
else if (pickupid == pickup_Health)
{
SetPlayerHealth(playerid, 100.0);
}
return 1;
}
```
## Funcții similare
- [CreatePickup](../functions/CreatePickup): Creați o ridicare.
- [DestroyPickup](../functions/DestroyPickup): Distrugeți un pickup. | openmultiplayer/web/docs/translations/ro/scripting/callbacks/OnPlayerPickUpPickup.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/ro/scripting/callbacks/OnPlayerPickUpPickup.md",
"repo_id": "openmultiplayer",
"token_count": 498
} | 403 |
---
title: OnRecordingPlaybackEnd
description: Acest callback este apelat atunci când un fișier înregistrat care este reprodus cu NPCStartRecordingPlayback a ajuns la final.
tags: []
---
## Descriere
Acest callback este apelat atunci când un fișier înregistrat care este reprodus cu NPCStartRecordingPlayback a ajuns la final.
## Exemple
```c
public OnRecordingPlaybackEnd()
{
StartRecordingPlayback(PLAYER_RECORDING_TYPE_DRIVER, "all_around_lv_bus"); //Acest lucru ar porni din nou fișierul înregistrat odată ce se termină reproducerea.
}
``` | openmultiplayer/web/docs/translations/ro/scripting/callbacks/OnRecordingPlaybackEnd.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/ro/scripting/callbacks/OnRecordingPlaybackEnd.md",
"repo_id": "openmultiplayer",
"token_count": 203
} | 404 |
---
title: AddSimpleModel
description: Adaugă un nou model de obiect simplu personalizat pentru descărcare.
tags: []
---
<VersionWarn version='SA-MP 0.3.DL R1' />
## Descriere
Adaugă un nou model de obiect simplu personalizat pentru descărcare. Fișierele model vor fi stocate în documentele playerului \ GTA San Andreas User Files \ SAMP \ cache sub folderul Server IP și Port într-un nume de fișier CRC.
| Nume | Descriere |
| ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
| virtualworld | ID-ul lumii virtuale pentru a face modelul disponibil la. Folosiți -1 pentru toate lumile. |
| baseid | ID-ul modelului de obiect de bază de utilizat (obiectul original de utilizat atunci când descărcarea eșuează). |
| newid | ID-ul noului model de obiect a variat de la -1000 la -30000 (29000 de sloturi) pentru a fi utilizat ulterior cu CreateObject sau CreatePlayerObject. |
| dffname | Numele fișierului de coliziune a modelului .dff situat în dosarul serverului de modele în mod implicit (setare artpath) |
| txdname | Numele fișierului de textură model .txd situat în dosarul serverului modele în mod implicit (setare artpath). |
## Se intoarce
1: Funcția executată cu succes.
0: Funcția nu a putut fi executată.
## Exemple
```c
public OnGameModeInit()
{
AddSimpleModel(-1, 19379, -2000, "wallzzz.dff", "wallzzz.txd");
return 1;
}
```
```c
AddSimpleModel(-1, 19379, -2000, "wallzzz.dff", "wallzzz.txd");
```
## Note
:::tip
`Useartwork` trebuie să fie activat mai întâi în setările serverului pentru ca acesta să funcționeze Când virtualworld este setat, modelele vor fi descărcate odată ce jucătorul intră în lumea specifică
:::
:::warning
În prezent, nu există restricții cu privire la momentul în care puteți apela această funcție, dar rețineți că, dacă nu le apelați în OnFilterScriptInit / OnGameModeInit, aveți riscul ca unii jucători, care sunt deja pe server, să nu fi descărcat modelele.
:::
## Funcții conexe
- [OnPlayerFinishedDownloading](../callbacks/OnPlayerFinishedDownloading.md): Apelat când un jucător termină de descărcat modele personalizate.
| openmultiplayer/web/docs/translations/ro/scripting/functions/AddSimpleModel.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/ro/scripting/functions/AddSimpleModel.md",
"repo_id": "openmultiplayer",
"token_count": 1189
} | 405 |
---
title: "Compensarea intarzierii"
descripion: Explicație de compensare a întârzierii.
---
Compensarea întârzierii pentru gloanțele declanșate este activată implicit pe serverele SA-MP de la 0.3z. Poate fi comutat utilizând variabila server `lagcompmode` din [server.cfg] (server.cfg). Setarea la 0 va dezactiva complet compensarea întârzierii și jucătorii vor trebui să conducă loviturile lor (aruncate înaintea țintelor).
Dezactivarea compensării întârzierii va preveni [OnPlayerWeaponShot](../../callbacks/OnPlayerWeaponShot) sa fie apelat.
Această variabilă poate fi setată numai în [server.cfg](server.cfg).
| openmultiplayer/web/docs/translations/ro/server/LagCompensation.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/ro/server/LagCompensation.md",
"repo_id": "openmultiplayer",
"token_count": 258
} | 406 |
---
title: OnFilterScriptInit
description: Ta "callback" imenuje se, ko je "filterscript" začne.
tags: []
---
## Opis
Ta "callback" imenuje se, ko je "filterscript" začne.. Kliče se samo znotraj "filterscript" v katerem se začne.
## Primeri
```c
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Moj "filterscript" se začne");
print("--------------------------------------\n");
return 1;
}
```
## Povezane Funkcijo
| openmultiplayer/web/docs/translations/sl/scripting/callbacks/OnFilterScriptInit.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/sl/scripting/callbacks/OnFilterScriptInit.md",
"repo_id": "openmultiplayer",
"token_count": 176
} | 407 |
---
title: ConnectNPC
description: Poveze NPC-a na server.
tags: ["npc"]
---
## Opis
Poveze NPC-a na server.
| Ime | Opis |
| -------- | ----------------------------------------------------------------------------- |
| name[] | Ime sa kojim se NPC poveze. Mora da prati ista pravila kao i normalni igraci. |
| script[] | NPC ime u skripti koje se nalazi u npcmodes folderu (bez .amx nastavka). |
## Vraca
Ova funkcija uvek vraca 1.
## Primeri
```c
public OnGameModeInit()
{
ConnectNPC("[BOT]Pilot", "pilot");
return 1;
}
```
## Beleske
:::tip
NPC nema nametag. Ovo moze da se napravi preko Attach3DTextLabelToPlayer.
:::
## Srodne Funkcije
- [IsPlayerNPC](IsPlayerNPC.md): Proverava da li je igrac NPC ili pravi igrac.
- [OnPlayerConnect](../callbacks/OnPlayerConnect.md): Poziva se kada se igrac poveze na server.
| openmultiplayer/web/docs/translations/sr/scripting/functions/ConnectNPC.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/sr/scripting/functions/ConnectNPC.md",
"repo_id": "openmultiplayer",
"token_count": 414
} | 408 |
---
title: OnDialogResponse
description: Callback นี้ถูกเรียกเมื่อผู้เล่นตอบสนองกับกล่องโต้ตอบที่แสดงโดยใช้ ShowPlayerDialog ไม่ว่าจะ คลิกปุ่ม, กด ENTER/ESC หรือดับเบิลคลิกที่รายการไอเทม (หากใช้กล่องโต้ตอบแบบรายการ)
tags: []
---
## คำอธิบาย
Callback นี้ถูกเรียกเมื่อผู้เล่นตอบสนองกับกล่องโต้ตอบที่แสดงโดยใช้ ShowPlayerDialog ไม่ว่าจะ คลิกปุ่ม, กด ENTER/ESC หรือดับเบิลคลิกที่รายการไอเท(หากใช้กล่องโต้ตอบแบบรายการ)
| ชื่อ | คำอธิบาย |
| ----------- | -------------------------------------------------------------------------------------------------- |
| playerid | ไอดีของผู้เล่นที่ตอบสนองกับกล่องโต้ตอบ |
| dialogid | ไอดีของกล่องโต้ตอบที่ผู้เล่นตอบสนองที่มาจาก ShowPlayerDialog |
| response | 1 สำหรับปุ่มซ้าย และ 0 จากปุ่มขวา (หากมีแค่ปุ่มเดียว จะเป็น 1 เสมอ) |
| listitem | ไอดีของรายการไอเทมที่ถูกเลือกโดยผู้เล่น (เริ่มจาก 0) (แค่กล่องโต้ตอบรูปแบบรายการ นอกนั้นจะเป็น -1) |
| inputtext[] | ข้อความที่ถูกป้อนเข้ามาโดยผู้เล่นหรือรายการไอเทมที่ถูกเลือก |
## ส่งคืน
จะถูกเรียกใน Filterscripts ก่อนเป็นอันดับแรกเสมอ ดังนั้นการส่งค่าคืนเป็น 1 จะบล็อกไม่ให้ Filterscripts อื่น ๆ ได้เห็น
## ตัวอย่าง
```c
// กำหนดไอดีกล่องโต้ตอบ เพื่อให้เราสามารถควบคุมการตอบสนองได้
#define DIALOG_RULES 1
// คำสั่งประมาณนี้
ShowPlayerDialog(playerid, DIALOG_RULES, DIALOG_STYLE_MSGBOX, "กฎของเซิร์ฟเวอร์", "- ห้ามโกง\n- ห้ามสแปม\n- เคราพแอดมิน\n\nคุณยอมรับกฎเหล่านี้ไหม?", "ยอมรับ", "ไม่ยอมรับ");
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if (dialogid == DIALOG_RULES)
{
if (response) // หากพวกเขาคลิก 'ยอมรับ' หรือกด enter
{
SendClientMessage(playerid, COLOR_GREEN, "Thank you for agreeing to the กฎของเซิร์ฟเวอร์!");
}
else // กด ESC หรือคลิกยกเลิก
{
Kick(playerid);
}
return 1; // เราได้จัดการกล่องโต้ตอบนี้เรียบร้อยแล้วดังนั้นส่งค่าคืน 1 เหมือนกับ OnPlayerCommandText
}
return 0; // คุณต้องส่งค่าคืนเป็น 0 ตรงนี้! เหมือนกับ OnPlayerCommandText
}
#define DIALOG_LOGIN 2
// คำสั่งประมาณนี้
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, "เข้าสู่ระบบ", "โปรดป้อนรหัสผ่านของคุณ:", "เข้าสู่ระบบ", "ยกเลิก");
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if (dialogid == DIALOG_LOGIN)
{
if (!response) // หากพวกเขาคลิก 'ยกเลิก' หรือกด esc
{
Kick(playerid);
}
else // กด ENTER หรือคลิกปุ่ม 'เข้าสู่ระบบ'
{
if (CheckPassword(playerid, inputtext))
{
SendClientMessage(playerid, COLOR_RED, "ตอนนี้คุณได้เข้าสู่ระบบเรียบร้อยแล้ว!");
}
else
{
SendClientMessage(playerid, COLOR_RED, "เข้าสู่ระบบล้มเหลว");
// แสดงกล่องล็อกอินอีกครั้ง
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, "เข้าสู่ระบบ", "โปรดป้อนรหัสผ่านของคุณ:", "เข้าสู่ระบบ", "ยกเลิก");
}
}
return 1; // เราได้จัดการกล่องโต้ตอบนี้เรียบร้อยแล้วดังนั้นส่งค่าคืน 1 เหมือนกับ OnPlayerCommandText
}
return 0; // คุณต้องส่งค่าคืนเป็น 0 ตรงนี้! เหมือนกับ OnPlayerCommandText
}
#define DIALOG_WEAPONS 3
// คำสั่งประมาณนี้
ShowPlayerDialog(playerid, DIALOG_WEAPONS, DIALOG_STYLE_LIST, "อาวุธ", "Desert Eagle\nAK-47\nCombat Shotgun", "เลือก", "ปิด");
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if (dialogid == DIALOG_WEAPONS)
{
if (response) // หากพวกเขาคลิก 'เลือก' หรือดับเบิลคลิกที่อาวุธ
{
// ให้อาวุธพวกเขา
switch(listitem)
{
case 0: GivePlayerWeapon(playerid, WEAPON_DEAGLE, 14); // ให้ desert eagle พวกเขา
case 1: GivePlayerWeapon(playerid, WEAPON_AK47, 120); // ให้ AK-47 พวกเขา
case 2: GivePlayerWeapon(playerid, WEAPON_SHOTGSPA, 28); // ให้ Combat Shotgun พวกเขา
}
}
return 1; // เราได้จัดการกล่องโต้ตอบนี้เรียบร้อยแล้วดังนั้นส่งค่าคืน 1 เหมือนกับ OnPlayerCommandText
}
return 0; // คุณต้องส่งค่าคืนเป็น 0 ตรงนี้! เหมือนกับ OnPlayerCommandText
}
#define DIALOG_WEAPONS 3
// คำสั่งประมาณนี้
ShowPlayerDialog(playerid, DIALOG_WEAPONS, DIALOG_STYLE_LIST, "อาวุธ",
"อาวุธ\tกระสุน\tราคา\n\
M4\t120\t500\n\
MP5\t90\t350\n\
AK-47\t120\t400",
"เลือก", "ปิด");
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if (dialogid == DIALOG_WEAPONS)
{
if (response) // หากพวกเขาคลิก 'เลือก' หรือดับเบิลคลิกที่อาวุธ
{
// ให้อาวุธพวกเขา
switch(listitem)
{
case 0: GivePlayerWeapon(playerid, WEAPON_M4, 120); // ให้ M4 พวกเขา
case 1: GivePlayerWeapon(playerid, WEAPON_MP5, 90); // ให้ MP5 พวกเขา
case 2: GivePlayerWeapon(playerid, WEAPON_AK47, 120); // ให้ AK-47 พวกเขา
}
}
return 1; // เราได้จัดการกล่องโต้ตอบนี้เรียบร้อยแล้วดังนั้นส่งค่าคืน 1 เหมือนกับ OnPlayerCommandText
}
return 0; // คุณต้องส่งค่าคืนเป็น 0 ตรงนี้! เหมือนกับ OnPlayerCommandText
}
```
## บันทึก
:::tip
พารามิเตอร์สามารถมีค่าที่แตกต่างกันได้ ขึ้นอยู่กับรูปแบบของกล่องโต้ตอบ ([คลิกเพื่อดูตัวอย่างเพิ่มเติม](../resources/dialogstyles.md)).
:::
:::tip
It is appropriate to switch through different dialogids, if you have many.
:::
:::warning
กล่องโต้ตอบของผู้เล่นจะไม่ถูกซ่อนเมื่อเกมโหมดรีสตาร์ท ทำให้เซิร์ฟเวอร์ปริ้นท์ "Warning: PlayerDialogResponse PlayerId: 0 dialog ID doesn't match last sent dialog ID" หากผู้เล่นตอบสนองกับกล่องโต้ตอบนี้หลังจากรีสตาร์ท
:::
## ฟังก์ชั่นที่เกี่ยวข้องกัน
- [ShowPlayerDialog](../../scripting/functions/ShowPlayerDialog.md): แสดงกล่องโต้ตอบกับผู้เล่น
| openmultiplayer/web/docs/translations/th/scripting/callbacks/OnDialogResponse.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/th/scripting/callbacks/OnDialogResponse.md",
"repo_id": "openmultiplayer",
"token_count": 6055
} | 409 |
---
title: OnPlayerEditAttachedObject
description: This callback is called when a player ends attached object edition mode.
tags: ["player"]
---
## คำอธิบาย
This callback is called when a player ends attached object edition mode.
| Name | Description |
|------------------------|---------------------------------------------------------------|
| playerid | The ID of the player that ended edition mode |
| EDIT_RESPONSE:response | 0 if they cancelled (ESC) or 1 if they clicked the save icon. |
| index | The index of the attached object (0-9) |
| modelid | The model of the attached object that was edited |
| boneid | The bone of the attached object that was edited |
| Float:fOffsetX | The X offset for the attached object that was edited |
| Float:fOffsetY | The Y offset for the attached object that was edited |
| Float:fOffsetZ | The Z offset for the attached object that was edited |
| Float:fRotX | The X rotation for the attached object that was edited |
| Float:fRotY | The Y rotation for the attached object that was edited |
| Float:fRotZ | The Z rotation for the attached object that was edited |
| Float:fScaleX | The X scale for the attached object that was edited |
| Float:fScaleY | The Y scale for the attached object that was edited |
| Float:fScaleZ | The Z scale for the attached object that was edited |
## ส่งคืน
1 - Will prevent other scripts from receiving this callback.
0 - Indicates that this callback will be passed to the next script.
มันถูกเรียกในฟิลเตอร์สคริปต์ก่อนเสมอ
## ตัวอย่าง
```c
enum attached_object_data
{
Float:ao_x,
Float:ao_y,
Float:ao_z,
Float:ao_rx,
Float:ao_ry,
Float:ao_rz,
Float:ao_sx,
Float:ao_sy,
Float:ao_sz
}
new ao[MAX_PLAYERS][MAX_PLAYER_ATTACHED_OBJECTS][attached_object_data];
// The data should be stored in the above array when attached objects are attached.
public OnPlayerEditAttachedObject(playerid, EDIT_RESPONSE:response, index, modelid, boneid, Float:fOffsetX, Float:fOffsetY, Float:fOffsetZ, Float:fRotX, Float:fRotY, Float:fRotZ, Float:fScaleX, Float:fScaleY, Float:fScaleZ)
{
if (response)
{
SendClientMessage(playerid, COLOR_GREEN, "Attached object edition saved.");
ao[playerid][index][ao_x] = fOffsetX;
ao[playerid][index][ao_y] = fOffsetY;
ao[playerid][index][ao_z] = fOffsetZ;
ao[playerid][index][ao_rx] = fRotX;
ao[playerid][index][ao_ry] = fRotY;
ao[playerid][index][ao_rz] = fRotZ;
ao[playerid][index][ao_sx] = fScaleX;
ao[playerid][index][ao_sy] = fScaleY;
ao[playerid][index][ao_sz] = fScaleZ;
}
else
{
SendClientMessage(playerid, COLOR_RED, "Attached object edition not saved.");
new i = index;
SetPlayerAttachedObject(playerid, index, modelid, boneid, ao[playerid][i][ao_x], ao[playerid][i][ao_y], ao[playerid][i][ao_z], ao[playerid][i][ao_rx], ao[playerid][i][ao_ry], ao[playerid][i][ao_rz], ao[playerid][i][ao_sx], ao[playerid][i][ao_sy], ao[playerid][i][ao_sz]);
}
return 1;
}
```
## บันทึก
:::warning
Editions should be discarded if response was '0' (cancelled). This must be done by storing the offsets etc. in an array BEFORE using EditAttachedObject.
:::
## ฟังก์ชั่นที่เกี่ยวข้องกัน
- [EditAttachedObject](../functions/EditAttachedObject): Edit an attached object.
- [SetPlayerAttachedObject](../functions/SetPlayerAttachedObject): Attach an object to a player
| openmultiplayer/web/docs/translations/th/scripting/callbacks/OnPlayerEditAttachedObject.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/th/scripting/callbacks/OnPlayerEditAttachedObject.md",
"repo_id": "openmultiplayer",
"token_count": 1733
} | 410 |
---
title: OnPlayerRequestClass
description: Called when a player changes class at class selection (and when class selection first appears).
tags: ["player"]
---
## คำอธิบาย
Called when a player changes class at class selection (and when class selection first appears).
| Name | Description |
| -------- | ---------------------------------------------------------------------- |
| playerid | The ID of the player that changed class. |
| classid | The ID of the current class being viewed (returned by AddPlayerClass). |
## ส่งคืน
มันถูกเรียกในฟิลเตอร์สคริปต์ก่อนเสมอ
## ตัวอย่าง
```c
public OnPlayerRequestClass(playerid,classid)
{
if (classid == 3 && !IsPlayerAdmin(playerid))
{
SendClientMessage(playerid, COLOR_RED, "This skin is only for admins!");
return 0;
}
return 1;
}
```
## บันทึก
:::tip
This callback is also called when a player presses F4.
:::
## ฟังก์ชั่นที่เกี่ยวข้องกัน
- [AddPlayerClass](../../scripting/functions/AddPlayerClass.md): Add a class.
| openmultiplayer/web/docs/translations/th/scripting/callbacks/OnPlayerRequestClass.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/th/scripting/callbacks/OnPlayerRequestClass.md",
"repo_id": "openmultiplayer",
"token_count": 553
} | 411 |
---
title: OnTrailerUpdate
description: This callback is called when a player sent a trailer update.
tags: []
---
## คำอธิบาย
This callback is called when a player sent a trailer update.
| Name | Description |
| --------- | ---------------------------------------------- |
| playerid | The ID of the player who sent a trailer update |
| vehicleid | The Trailer being updated |
## ส่งคืน
0 - Cancels any trailer updates from being sent to other players. Update is still sent to the updating player.
1 - Processes the trailer update as normal and synchronizes it between all players.
มันถูกเรียกในฟิลเตอร์สคริปต์ก่อนเสมอ
## ตัวอย่าง
```c
public OnTrailerUpdate(playerid, vehicleid)
{
DetachTrailerFromVehicle(GetPlayerVehicleID(playerid));
return 0;
}
```
## บันทึก
:::warning
This callback is called very frequently per second per trailer. You should refrain from implementing intensive calculations or intensive file writing/reading operations in this callback.
:::
## ฟังก์ชั่นที่เกี่ยวข้องกัน
- [GetVehicleTrailer](../../scripting/functions/GetVehicleTrailer.md): Check what trailer a vehicle is pulling.
- [IsTrailerAttachedToVehicle](../../scripting/functions/IsTrailerAttachedToVehicle.md): Check if a trailer is attached to a vehicle.
- [AttachTrailerToVehicle](../../scripting/functions/AttachTrailerToVehicle.md): Attach a trailer to a vehicle.
- [DetachTrailerFromVehicle](../../scripting/functions/DetachTrailerFromVehicle.md): Detach a trailer from a vehicle.
| openmultiplayer/web/docs/translations/th/scripting/callbacks/OnTrailerUpdate.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/th/scripting/callbacks/OnTrailerUpdate.md",
"repo_id": "openmultiplayer",
"token_count": 630
} | 412 |
---
title: AttachObjectToVehicle
description: Attach an object to a vehicle.
tags: ["vehicle"]
---
## คำอธิบาย
Attach an object to a vehicle.
| Name | Description |
| ------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
| objectid | The ID of the object to attach to the vehicle. Note that this is an object ID, not a model ID. The object must be CreateObject created first. |
| vehicleid | The ID of the vehicle to attach the object to. |
| Float:OffsetX | The X axis offset from the vehicle to attach the object to. |
| Float:OffsetY | The Y axis offset from the vehicle to attach the object to. |
| Float:OffsetZ | The Z axis offset from the vehicle to attach the object to. |
| Float:RotX | The X rotation offset for the object. |
| Float:RotY | The Y rotation offset for the object. |
| Float:RotZ | The Z rotation offset for the object. |
## ส่งคืน
This function does not return any specific values.
## ตัวอย่าง
```c
new objectid = CreateObject(...);
new vehicleid = GetPlayerVehicleID(playerid);
AttachObjectToVehicle(objectid, vehicleid, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0);
```
## บันทึก
:::tip
The object must be created first.
:::
:::warning
When the vehicle is destroyed or respawned, the attached objects won't be destroyed with it; they will remain stationary at the position the vehicle disappeared and be reattached to the next vehicle to claim the vehicle ID that the objects were attached to.
:::
## ฟังก์ชั่นที่เกี่ยวข้องกัน
- [AttachObjectToPlayer](../../scripting/functions/AttachObjectToPlayer.md): Attach an object to a player.
- [AttachObjectToObject](../../scripting/functions/AttachObjectToObject.md): Attach an object to an object.
- [AttachPlayerObjectToPlayer](../../scripting/functions/AttachPlayerObjectToPlayer.md): Attach a player object to a player.
- [CreateObject](../../scripting/functions/CreateObject.md): Create an object.
- [DestroyObject](../../scripting/functions/DestroyObject.md): Destroy an object.
- [IsValidObject](../../scripting/functions/IsValidObject.md): Checks if a certain object is vaild.
- [MoveObject](../../scripting/functions/MoveObject.md): Move an object.
- [StopObject](../../scripting/functions/StopObject.md): Stop an object from moving.
- [SetObjectPos](../../scripting/functions/SetObjectPos.md): Set the position of an object.
- [SetObjectRot](../../scripting/functions/SetObjectRot.md): Set the rotation of an object.
- [GetObjectPos](../../scripting/functions/GetObjectPos.md): Locate an object.
- [GetObjectRot](../../scripting/functions/GetObjectRot.md): Check the rotation of an object.
- [CreatePlayerObject](../../scripting/functions/CreatePlayerObject.md): Create an object for only one player.
- [DestroyPlayerObject](../../scripting/functions/DestroyPlayerObject.md): Destroy a player object.
- [IsValidPlayerObject](../../scripting/functions/IsValidPlayerObject.md): Checks if a certain player object is vaild.
- [MovePlayerObject](../../scripting/functions/MovePlayerObject.md): Move a player object.
- [StopPlayerObject](../../scripting/functions/StopPlayerObject.md): Stop a player object from moving.
- [SetPlayerObjectPos](../../scripting/functions/SetPlayerObjectPos.md): Set the position of a player object.
- [SetPlayerObjectRot](../../scripting/functions/SetPlayerObjectRot.md): Set the rotation of a player object.
- [GetPlayerObjectPos](../../scripting/functions/GetPlayerObjectPos.md): Locate a player object.
- [GetPlayerObjectRot](../../scripting/functions/GetPlayerObjectRot.md): Check the rotation of a player object.
| openmultiplayer/web/docs/translations/th/scripting/functions/AttachObjectToVehicle.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/th/scripting/functions/AttachObjectToVehicle.md",
"repo_id": "openmultiplayer",
"token_count": 1913
} | 413 |
---
title: Create3DTextLabel
description: Creates a 3D Text Label at a specific location in the world.
tags: ["3dtextlabel"]
---
## คำอธิบาย
Creates a 3D Text Label at a specific location in the world
| Name | Description |
| ------------ | --------------------------------------------------------------------- |
| text[] | The initial text string. |
| color | The text Color, as an integer or hex in RGBA color format |
| x | X-Coordinate |
| y | Y-Coordinate |
| z | Z-Coordinate |
| DrawDistance | The distance from where you are able to see the 3D Text Label |
| VirtualWorld | The virtual world in which you are able to see the 3D Text |
| testLOS | 0/1 Test the line-of-sight so this text can't be seen through objects |
## ส่งคืน
The ID of the newly created 3D Text Label, or INVALID_3DTEXT_ID if the 3D Text Label limit (MAX_3DTEXT_GLOBAL) was reached.
## ตัวอย่าง
```c
public OnGameModeInit()
{
Create3DTextLabel("I'm at the coordinates:\n30.0, 40.0, 50.0", 0x008080FF, 30.0, 40.0, 50.0, 40.0, 0, 0);
return 1;
}
```
## บันทึก
:::tip
drawdistance seems to be a lot smaller when spectating.
:::
:::tip
Use color embedding for multiple colors in the text.
:::
:::warning
If text[] is empty, the server/clients next to the text might crash! If the virtualworld is set as -1 the text will not appear.
:::
## ฟังก์ชั่นที่เกี่ยวข้องกัน
- [Delete3DTextLabel](../../scripting/functions/Delete3DTextLabel.md): Delete a 3D text label.
- [Attach3DTextLabelToPlayer](../../scripting/functions/Attach3DTextLabelToPlayer.md): Attach a 3D text label to a player.
- [Attach3DTextLabelToVehicle](../../scripting/functions/Attach3DTextLabelToVehicle): Attach a 3D text label to a vehicle.
- [Update3DTextLabelText](../../scripting/functions/Update3DTextLabelText.md): Change the text of a 3D text label.
- [CreatePlayer3DTextLabel](../../scripting/functions/CreatePlayer3DTextLabel.md): Create A 3D text label for one player.
- [DeletePlayer3DTextLabel](../../scripting/functions/DeletePlayer3DTextLabel.md): Delete a player's 3D text label.
- [UpdatePlayer3DTextLabelText](../../scripting/functions/UpdatePlayer3DTextLabelText.md): Change the text of a player's 3D text label.
| openmultiplayer/web/docs/translations/th/scripting/functions/Create3DTextLabel.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/th/scripting/functions/Create3DTextLabel.md",
"repo_id": "openmultiplayer",
"token_count": 1161
} | 414 |
---
title: DestroyMenu
description: Destroys the specified menu.
tags: ["menu"]
---
## คำอธิบาย
Destroys the specified menu.
| Name | Description |
| ------ | ---------------------- |
| menuid | The menu ID to destroy |
## ส่งคืน
True if the destroying was successful, otherwise false
## ตัวอย่าง
```c
new Menu:examplemenu;
examplemenu = CreateMenu("Your Menu", 2, 200.0, 100.0, 150.0, 150.0);
// ...
DestroyMenu(examplemenu);
```
## ฟังก์ชั่นที่เกี่ยวข้องกัน
- [CreateMenu](../../scripting/functions/CreateMenu.md): Create a menu.
- [SetMenuColumnHeader](../../scripting/functions/SetMenuColumnHeader.md): Set the header for one of the columns in a menu.
- [AddMenuItem](../../scripting/functions/AddMenuItem.md): Add an item to a menu.
- [OnPlayerSelectedMenuRow](../../scripting/callbacks/OnPlayerSelectedMenuRow.md): Called when a player selected a row in a menu.
- [OnPlayerExitedMenu](../../scripting/callbacks/OnPlayerExitedMenu.md): Called when a player exits a menu.
| openmultiplayer/web/docs/translations/th/scripting/functions/DestroyMenu.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/th/scripting/functions/DestroyMenu.md",
"repo_id": "openmultiplayer",
"token_count": 405
} | 415 |
---
title: EnablePlayerCameraTarget
description: Toggle camera targeting functions for a player.
tags: ["player"]
---
:::warning
ฟังก์ชั่นนี้ถูกเพิ่มใน SA-MP 0.3.7 และจะไม่ทำงานในเวอร์ชั่นก่อนหน้านี้!
:::
## คำอธิบาย
Toggle camera targeting functions for a player. Disabled by default to save bandwidth.
| Name | Description |
| -------- | -------------------------------------------------------------- |
| playerid | The ID of the player to toggle camera targeting functions for. |
| enable | 1 to enable camera targeting functions and 0 to disable them. |
## ส่งคืน
1: The function executed successfully.
0: The function failed to execute. The player is not connected.
## ตัวอย่าง
```c
public OnPlayerConnect(playerid)
{
EnablePlayerCameraTarget(playerid, 1);
return 1;
}
```
## ฟังก์ชั่นที่เกี่ยวข้องกัน
- [GetPlayerCameraTargetVehicle](../functions/GetPlayerCameraTargetVehicle): Get the ID of the vehicle a player is looking at.
- [GetPlayerCameraTargetPlayer](../functions/GetPlayerCameraTargetPlayer): Get the ID of the player a player is looking at.
- [GetPlayerCameraFrontVector](../functions/GetPlayerCameraFrontVector): Get the player's camera front vector
| openmultiplayer/web/docs/translations/th/scripting/functions/EnablePlayerCameraTarget.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/th/scripting/functions/EnablePlayerCameraTarget.md",
"repo_id": "openmultiplayer",
"token_count": 559
} | 416 |
---
title: GangZoneHideForAll
description: GangZoneHideForAll hides a gangzone from all players.
tags: ["gangzone"]
---
## คำอธิบาย
GangZoneHideForAll hides a gangzone from all players.
| Name | Description |
| ---- | ----------------- |
| zone | The zone to hide. |
## ส่งคืน
This function does not return any specific values.
## ตัวอย่าง
```c
new gangzone;
gangzone = GangZoneCreate(1248.011, 2072.804, 1439.348, 2204.319);
GangZoneHideForAll(gangzone);
```
## ฟังก์ชั่นที่เกี่ยวข้องกัน
- [GangZoneCreate](../functions/GangZoneCreate): Create a gangzone.
- [GangZoneDestroy](../functions/GangZoneDestroy): Destroy a gangzone.
- [GangZoneShowForPlayer](../functions/GangZoneShowForPlayer): Show a gangzone for a player.
- [GangZoneShowForAll](../functions/GangZoneShowForAll): Show a gangzone for all players.
- [GangZoneHideForPlayer](../functions/GangZoneHideForPlayer): Hide a gangzone for a player.
- [GangZoneFlashForPlayer](../functions/GangZoneFlashForPlayer): Make a gangzone flash for a player.
- [GangZoneFlashForAll](../functions/GangZoneFlashForAll): Make a gangzone flash for all players.
- [GangZoneStopFlashForPlayer](../functions/GangZoneStopFlashForPlayer): Stop a gangzone flashing for a player.
- [GangZoneStopFlashForAll](../functions/GangZoneStopFlashForAll): Stop a gangzone flashing for all players.
| openmultiplayer/web/docs/translations/th/scripting/functions/GangZoneHideForAll.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/th/scripting/functions/GangZoneHideForAll.md",
"repo_id": "openmultiplayer",
"token_count": 510
} | 417 |
---
title: GetGravity_FR
description: Permets d'obtenir la valeur de la gravité.
tags: []
---
## คำอธิบาย
Permets d'obtenir la valeur de la gravité.
| Name | Description |
| ---- | ----------- |
## ตัวอย่าง
```c
#if !defined GetGravity
native Float:GetGravity();
#endif
printf("Gravité actuelle: %f", GetGravity());
```
## บันทึก
:::warning
Cette fonction n'est pas définie par défaut. Ajouté 'native GetGravity();' juste en dessous de l'include a_samp.inc pour pouvoir l'utiliser.
:::
## ฟังก์ชั่นที่เกี่ยวข้องกัน
| openmultiplayer/web/docs/translations/th/scripting/functions/GetGravity_FR.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/th/scripting/functions/GetGravity_FR.md",
"repo_id": "openmultiplayer",
"token_count": 292
} | 418 |
---
title: GetPlayerCameraAspectRatio
description: Retrieves the aspect ratio of a player's camera.
tags: ["player"]
---
## คำอธิบาย
Retrieves the aspect ratio of a player's camera.
| Name | Description |
| -------- | ------------------------------------------------------- |
| playerid | The ID of the player to get the camera aspect ratio of. |
## ส่งคืน
The aspect ratio of the player's camera, as a float. The aspect ratio can be one of three values: 4:3 (1.3333334, Float:0x3FAAAAAB) when widescreen is turned off, 5:4 (1.2470589, Float:0x3F9F9FA0) when letterbox mode is turned on, and 16:9 (1.7764707, Float:0x3FE36364) when widescreen is turned on regardless of the letterbox mode.
## ตัวอย่าง
```c
new szString[144];
format(szString, sizeof(szString), "Your aspect ratio: %f", GetPlayerCameraAspectRatio(playerid));
SendClientMessage(playerid, -1, szString);
```
## บันทึก
:::tip
The return value of this function represents the value of the "widescreen" option in the game's display settings, not the actual aspect ratio of the player's display.
:::
## ฟังก์ชั่นที่เกี่ยวข้องกัน
- [GetPlayerCameraZoom](../functions/GetPlayerCameraZoom): Get the zoom level of a player's camera.
- [GetPlayerCameraPos](../functions/GetPlayerCameraPos): Find out where the player's camera is.
- [GetPlayerCameraFrontVector](../functions/GetPlayerVameraFrontVector): Get the player's camera front vector
| openmultiplayer/web/docs/translations/th/scripting/functions/GetPlayerCameraAspectRatio.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/th/scripting/functions/GetPlayerCameraAspectRatio.md",
"repo_id": "openmultiplayer",
"token_count": 564
} | 419 |
---
title: GetPlayerHealth
description: The function GetPlayerHealth allows you to retrieve the health of a player.
tags: ["player"]
---
## คำอธิบาย
The function GetPlayerHealth allows you to retrieve the health of a player. Useful for cheat detection, among other things.
| Name | Description |
| ------------- | ------------------------------------------- |
| playerid | The ID of the player. |
| &Float:health | Float to store health, passed by reference. |
## ส่งคืน
1 - success
0 - failure (i.e. player not connected).
The player's health is stored in the specified variable.
## ตัวอย่าง
```c
// Sets players health to 50 if it was lower than
// 50 before, as soon as he typed /doctor
if (strcmp(cmdtext, "/doctor", true) == 0)
{
new Float:health;
GetPlayerHealth(playerid,health);
if (health < 50.0)
{
SetPlayerHealth(playerid, 50.0);
}
return 1;
}
```
## บันทึก
:::warning
Even though the health can be set to near infinite values on the server side, the individual clients will only report values up to 255. Anything higher will wrap around; 256 becomes 0, 257 becomes 1, etc. Health is obtained rounded to integers: set 50.15, but get 50.0
:::
## ฟังก์ชั่นที่เกี่ยวข้องกัน
- [SetPlayerHealth](../functions/SetPlayerHealth): Set a player's health.
- [GetVehicleHealth](../functions/GetVehicleHealth): Check the health of a vehicle.
- [GetPlayerArmour](../functions/GetPlayerArmour): Find out how much armour a player has.
| openmultiplayer/web/docs/translations/th/scripting/functions/GetPlayerHealth.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/th/scripting/functions/GetPlayerHealth.md",
"repo_id": "openmultiplayer",
"token_count": 597
} | 420 |
---
title: GetPlayerScore
description: This function returns a player's score as it was set using SetPlayerScore.
tags: ["player"]
---
## คำอธิบาย
This function returns a player's score as it was set using SetPlayerScore
| Name | Description |
| -------- | ------------------------------- |
| playerid | The player to get the score of. |
## ส่งคืน
The player's score.
## ตัวอย่าง
```c
public OnPlayerCommandText(playerid,text[])
{
if (!strcmp(cmdtext,"/score",true))
{
new string[128];
format(string, sizeof(string), "Score: %i",GetPlayerScore(playerid));
SendClientMessage(playerid, COLOR_ORANGE, string);
return 1;
}
return 0;
}
```
## ฟังก์ชั่นที่เกี่ยวข้องกัน
- SetPlayerScore: Set the score of a player.
- GetPlayerPing: Get the ping of a player.
| openmultiplayer/web/docs/translations/th/scripting/functions/GetPlayerScore.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/th/scripting/functions/GetPlayerScore.md",
"repo_id": "openmultiplayer",
"token_count": 383
} | 421 |
---
title: GetPlayerWeapon
description: Returns the ID of the weapon a player is currently holding.
tags: ["player"]
---
## คำอธิบาย
Returns the ID of the weapon a player is currently holding.
| Name | Description |
| -------- | --------------------------------------------------------- |
| playerid | The ID of the player to get the currently held weapon of. |
## ส่งคืน
The ID of the player's current weapon. Returns -1 if the player specified does not exist.
## ตัวอย่าง
```c
public OnPlayerDeath(playerid, killerid, WEAPON:reason)
{
// Check if the killerid is not an invalid player (which means is connected).
if (killerid != INVALID_PLAYER_ID)
{
// The WEAPON_MINIGUN constant is pre-defined in the standard library and is equal to 38.
if (GetPlayerWeapon(killerid) == WEAPON_MINIGUN)
{
//Ban if they have a minigun
Ban(killerid);
}
}
return 1;
}
```
## บันทึก
:::tip
When the player state is PLAYER_STATE_DRIVER or PLAYER_STATE_PASSENGER this function returns the weapon held by the player before they entered the vehicle. If a cheat is used to spawn a weapon inside a vehicle, this function will not report it.
:::
:::warning
Sometimes the result can be -1 which is an invalid weapon ID. Circumstances of this are not yet known, but it is best to discard information when returned weapon is -1.
:::
## ฟังก์ชั่นที่เกี่ยวข้องกัน
- GetPlayerWeaponData: Find out information about weapons a player has.
- GivePlayerWeapon: Give a player a weapon.
- ResetPlayerWeapons: Remove all weapons from a player.
| openmultiplayer/web/docs/translations/th/scripting/functions/GetPlayerWeapon.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/th/scripting/functions/GetPlayerWeapon.md",
"repo_id": "openmultiplayer",
"token_count": 635
} | 422 |
---
title: GetVehicleDamageStatus
description: Retrieve the damage statuses of a vehicle.
tags: ["vehicle"]
---
## คำอธิบาย
Retrieve the damage statuses of a vehicle.
| Name | Description |
| --------------------------- | ------------------------------------------------------------------ |
| vehicleid | The ID of the vehicle to get the damage statuses of. |
| VEHICLE_PANEL_STATUS:panels | A variable to store the panel damage data in, passed by reference. |
| VEHICLE_DOOR_STATUS:doors | A variable to store the door damage data in, passed by reference. |
| VEHICLE_LIGHT_STATUS:lights | A variable to store the light damage data in, passed by reference. |
| VEHICLE_TYRE_STATUS:tyres | A variable to store the tire damage data in, passed by reference. |
## ส่งคืน
**1** - The function was executed successfully.
**0** - The function failed to execute. This means the vehicle specified does not exist.
## ตัวอย่าง
```c
new
VEHICLE_PANEL_STATUS:panels,
VEHICLE_DOOR_STATUS:doors,
VEHICLE_LIGHT_STATUS:lights,
VEHICLE_TYRE_STATUS:tyres;
GetVehicleDamageStatus(vehicleid, panels, doors, lights, tyres);
printf("Vehicle Status: [Panels]: %d - [Doors]: %d - [Lights]: %d - [Tyres]: %d", panels, doors, lights, tyres);
```
## บันทึก
:::tip
The stored values are bit masks. Bitwise operators will allow you to use the values.
:::
:::tip
For some useful functions for working with vehicle damage values, see here.
:::
## ฟังก์ชั่นที่เกี่ยวข้องกัน
- [UpdateVehicleDamageStatus](UpdateVehicleDamageStatus): Update the vehicle damage.
- [SetVehicleHealth](SetVehicleHealth): Set the health of a vehicle.
- [GetVehicleHealth](GetVehicleHealth): Check the health of a vehicle.
- [RepairVehicle](RepairVehicle): Fully repair a vehicle.
## Related Callbacks
- [OnVehicleDamageStatusUpdate](../callbacks/OnVehicleDamageStatusUpdate): Called when a vehicle's damage state changes.
## Related Resources
- [Damage Status](../resources/damagestatus)
- [Vehicle Panel Status](../resources/vehicle-panel-status)
- [Vehicle Door Status](../resources/vehicle-door-status)
- [Vehicle Light Status](../resources/vehicle-light-status)
- [Vehicle Tire Status](../resources/vehicle-tire-status)
| openmultiplayer/web/docs/translations/th/scripting/functions/GetVehicleDamageStatus.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/th/scripting/functions/GetVehicleDamageStatus.md",
"repo_id": "openmultiplayer",
"token_count": 869
} | 423 |
---
title: GetWeaponName
description: Get the name of a weapon.
tags: []
---
## คำอธิบาย
Get the name of a weapon.
| Name | Description |
| -------------- | ----------------------------------------------------------------------- |
| weaponid | The ID of the weapon to get the name of. |
| const weapon[] | An array to store the weapon's name in, passed by reference. |
| len | The maximum length of the weapon name to store. Should be sizeof(name). |
## ส่งคืน
1: The function was executed successfully.
0: The function failed to execute. The weapon specified does not exist.
The weapon's name is stored in the specified array.
## ตัวอย่าง
```c
public OnPlayerDeath(playerid, killerid, WEAPON:reason)
{
new gunname[32], string[64], playername[MAX_PLAYER_NAME + 1], killername[MAX_PLAYER_NAME + 1];
GetWeaponName(reason, gunname, sizeof(gunname));
GetPlayerName(playerid, playername, sizeof(playername));
GetPlayerName(killerid, killername, sizeof(killername));
format(string, sizeof(string), "%s has wasted %s using a %s.", killername, playername, gunname);
SendClientMessageToAll(0xFFFFFFAA, string);
return 1;
}
```
## ฟังก์ชั่นที่เกี่ยวข้องกัน
- GetPlayerWeapon: Check what weapon a player is currently holding.
- AllowInteriorWeapons: Determine if weapons can be used in interiors.
- GivePlayerWeapon: Give a player a weapon.
| openmultiplayer/web/docs/translations/th/scripting/functions/GetWeaponName.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/th/scripting/functions/GetWeaponName.md",
"repo_id": "openmultiplayer",
"token_count": 613
} | 424 |
---
title: ManualVehicleEngineAndLights
description: Use this function before any player connects (OnGameModeInit) to tell all clients that the script will control vehicle engines and lights.
tags: ["vehicle"]
---
## คำอธิบาย
Use this function before any player connects (OnGameModeInit) to tell all clients that the script will control vehicle engines and lights. This prevents the game automatically turning the engine on/off when players enter/exit vehicles and headlights automatically coming on when it is dark.
| Name | Description |
| ---- | ----------- |
## ตัวอย่าง
```c
public OnGameModeInit()
{
ManualVehicleEngineAndLights();
return 1;
}
```
## บันทึก
:::tip
Is it not possible to reverse this function after it has been used. You must either use it or not use it.
:::
## ฟังก์ชั่นที่เกี่ยวข้องกัน
- [SetVehicleParamsEx](../functions/SetVehicleParamsEx.md): Sets a vehicle's params for all players.
- [GetVehicleParamsEx](../functions/GetVehicleParamsEx.md): Get a vehicle's parameters.
- [SetVehicleParamsForPlayer](../functions/SetVehicleParamsForPlayer.md): Set the parameters of a vehicle for a player.
| openmultiplayer/web/docs/translations/th/scripting/functions/ManualVehicleEngineAndLights.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/th/scripting/functions/ManualVehicleEngineAndLights.md",
"repo_id": "openmultiplayer",
"token_count": 401
} | 425 |
---
title: PlayerSpectateVehicle
description: Sets a player to spectate another vehicle.
tags: ["player", "vehicle"]
---
## คำอธิบาย
Sets a player to spectate another vehicle. Their camera will be attached to the vehicle as if they are driving it.
| Name | Description |
| --------------- | ----------------------------------------------------------------------------------------------------------- |
| playerid | The ID of the player who should spectate a vehicle. |
| targetvehicleid | The ID of the vehicle the player should spectate. |
| mode | The spectate [mode](../resources/spectatemodes.md). Can generally be left blank as it defaults to 'normal'. |
## ส่งคืน
1: The function was executed successfully. Note that success is reported if the player is not in spectator mode (TogglePlayerSpectating), but nothing will happen. TogglePlayerSpectating MUST be used first.
0: The function failed to execute. The player, vehicle, or both don't exist.
## ตัวอย่าง
```c
TogglePlayerSpectating(playerid, 1);
PlayerSpectateVehicle(playerid, vehicleid);
```
## บันทึก
:::warning
Order is CRITICAL! Ensure that you use TogglePlayerSpectating before PlayerSpectateVehicle. The playerid and vehicleid have to be in the same interior and virtual world for this function to work properly.
:::
## ฟังก์ชั่นที่เกี่ยวข้องกัน
- PlayerSpectatePlayer: Spectate a player.
- TogglePlayerSpectating: Start or stop spectating.
| openmultiplayer/web/docs/translations/th/scripting/functions/PlayerSpectateVehicle.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/th/scripting/functions/PlayerSpectateVehicle.md",
"repo_id": "openmultiplayer",
"token_count": 690
} | 426 |
---
title: PlayerTextDrawSetString
description: Change the text of a player-textdraw.
tags: ["player", "textdraw", "playertextdraw"]
---
## คำอธิบาย
Change the text of a player-textdraw.
| Name | Description |
| -------- | ------------------------------------------------- |
| playerid | The ID of the player who's textdraw string to set |
| text | The ID of the textdraw to change |
| string[] | The new string for the TextDraw |
## ส่งคืน
This function does not return any specific values.
## ตัวอย่าง
```c
new pVehicleHealthTimer[MAX_PLAYERS];
new PlayerText:pVehicleHealthTD[MAX_PLAYERS];
public OnPlayerStateChange(playerid, PLAYER_STATE:newstate, PLAYER_STATE:oldstate)
{
if (newstate == 2) // Entered a vehicle as driver
{
pVehicleHealthTD[playerid] = CreatePlayerTextDraw(playerid, x, y, " ");
PlayerTextDrawShow(playerid, pVehicleHealthTD[playerid]);
// Set a timer to update the textdraw every second
pVehicleHealthTimer[playerid] = SetTimerEx("vhealth_td_update", 1000, true, "i", playerid);
}
if (oldstate == 2)
{
KillTimer(pVehicleHealthTD[playerid]);
PlayerTextDrawDestroy(playerid, pVehicleHealthTD[playerid]);
}
}
public vhealth_td_update(playerid)
{
new tdstring[32], Float:vHealth;
GetVehicleHealth(GetPlayerVehicleID(playerid), vHealth);
format(tdstring, sizeof(tdstring), "Vehicle Health: %0f", vHealth);
PlayerTextDrawSetString(playerid, pVehicleHealthTD[playerid], tdstring); // <<< Update the text to show the vehicle 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.
*/
```
## บันทึก
:::tip
You don't have to show the TextDraw again in order to apply the changes.
:::
:::warning
There are limits to the length of textdraw strings! See Limits for more info.
:::
## ฟังก์ชั่นที่เกี่ยวข้องกัน
- CreatePlayerTextDraw: Create a player-textdraw.
- PlayerTextDrawDestroy: Destroy a player-textdraw.
- PlayerTextDrawColor: Set the color of the text in a player-textdraw.
- PlayerTextDrawBoxColor: Set the color of a player-textdraw's box.
- PlayerTextDrawBackgroundColor: Set the background color of a player-textdraw.
- PlayerTextDrawAlignment: Set the alignment of a player-textdraw.
- PlayerTextDrawFont: Set the font of a player-textdraw.
- PlayerTextDrawLetterSize: Set the letter size of the text in a player-textdraw.
- PlayerTextDrawTextSize: Set the size of a player-textdraw box (or clickable area for PlayerTextDrawSetSelectable).
- PlayerTextDrawSetOutline: Toggle the outline on a player-textdraw.
- PlayerTextDrawSetShadow: Set the shadow on a player-textdraw.
- PlayerTextDrawSetProportional: Scale the text spacing in a player-textdraw to a proportional ratio.
- PlayerTextDrawUseBox: Toggle the box on a player-textdraw.
- PlayerTextDrawShow: Show a player-textdraw.
- PlayerTextDrawHide: Hide a player-textdraw.
| openmultiplayer/web/docs/translations/th/scripting/functions/PlayerTextDrawSetString.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/th/scripting/functions/PlayerTextDrawSetString.md",
"repo_id": "openmultiplayer",
"token_count": 1110
} | 427 |
---
title: SendClientMessage
description: This function sends a message to a specific player with a chosen color in the chat.
tags: []
---
## คำอธิบาย
This function sends a message to a specific player with a chosen color in the chat. The whole line in the chatbox will be in the set color unless color embedding is used.
| Name | Description |
| --------------- | ----------------------------------------------------- |
| playerid | The ID of the player to display the message to. |
| color | The color of the message (0xRRGGBBAA Hex format). |
| const message[] | The text that will be displayed (max 144 characters). |
## ส่งคืน
1: The function was executed successfully. Success is reported when the string is over 144 characters, but the message won't be sent.
0: The function failed to execute. The player is not connected.
## ตัวอย่าง
```c
#define COLOR_RED 0xFF0000FF
public OnPlayerConnect(playerid)
{
SendClientMessage(playerid, COLOR_RED, "This text is red");
SendClientMessage(playerid, 0x00FF00FF, "This text is green.");
SendClientMessage(playerid, -1, "This text is white.");
return 1;
}
```
## บันทึก
:::tip
You can use color embedding for multiple colors in the message. Using '-1' as the color will make the text white (for the simple reason that -1, when represented in hexadecimal notation, is 0xFFFFFFFF).
:::
:::warning
If a message is longer than 144 characters, it will not be sent. Truncation can be used to prevent this. Displaying a message on multiple lines will also solve this issue. Avoid using the percent sign (or format specifiers) in the actual message text without properly escaping it (like %%). It will result in crashes otherwise.
:::
## ฟังก์ชั่นที่เกี่ยวข้องกัน
- SendClientMessageToAll: Send a message to all players.
- SendPlayerMessageToPlayer: Force a player to send text for one player.
- SendPlayerMessageToAll: Force a player to send text for all players.
| openmultiplayer/web/docs/translations/th/scripting/functions/SendClientMessage.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/th/scripting/functions/SendClientMessage.md",
"repo_id": "openmultiplayer",
"token_count": 698
} | 428 |
---
title: SetMenuColumnHeader
description: Sets the caption of a column in a menu.
tags: ["menu"]
---
## คำอธิบาย
Sets the caption of a column in a menu.
| Name | Description |
| ------ | ----------------------------------------- |
| menuid | ID of the menu to change. |
| column | The column (0 or 1) to set the header of. |
| text[] | The caption text for the column. |
## ส่งคืน
This function does not return any specific values.
## ตัวอย่าง
```c
new Menu:TestMenu;
// There are two rows in this menu
TestMenu = CreateMenu("Menu Header", 2, 200.0, 100.0, 150.0, 150.0);
SetMenuColumnHeader(TestMenu, 0, "Row 1");
SetMenuColumnHeader(TestMenu, 1, "Row 2");
// Add menu items to it.
AddMenuItem(TestMenu, 0, "Row1 Item1");
AddMenuItem(TestMenu, 1, "Row2 Item1");
```
## บันทึก
:::tip
Crashes when passed an invalid menu ID.
:::
:::warning
Note that you can add only 12 items with AddMenuItem. The 13th object of a menu would replace the header of the column which is correctly set with this function.
:::
## ฟังก์ชั่นที่เกี่ยวข้องกัน
- [AddMenuItem](../../scripting/functions/AddMenuItem.md): Add an item to a menu.
- [CreateMenu](../../scripting/functions/CreateMenu.md): Create a menu.
- [OnPlayerSelectedMenuRow](../../scripting/callbacks/OnPlayerSelectedMenuRow.md): Called when a player selected a row in a menu.
| openmultiplayer/web/docs/translations/th/scripting/functions/SetMenuColumnHeader.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/th/scripting/functions/SetMenuColumnHeader.md",
"repo_id": "openmultiplayer",
"token_count": 575
} | 429 |
---
title: SetPlayerCameraPos
description: Sets the camera to a specific position for a player.
tags: ["player"]
---
## คำอธิบาย
Sets the camera to a specific position for a player.
| Name | Description |
| -------- | ---------------------------------------- |
| playerid | ID of the player |
| Float:x | The X coordinate to place the camera at. |
| Float:y | The Y coordinate to place the camera at. |
| Float:z | The Z coordinate to place the camera at. |
## ส่งคืน
1: The function executed successfully.
0: The function failed to execute. The player specified doesn't exist.
## ตัวอย่าง
```c
SetPlayerCameraPos(playerid, 652.23, 457.21, 10.84);
```
## บันทึก
:::tip
You may also have to use SetPlayerCameraLookAt with this function in order to work properly. Use SetCameraBehindPlayer to reset the camera to behind the player.
:::
:::warning
Using the camera functions directly after enabling spectator mode doesn't work.
:::
## ฟังก์ชั่นที่เกี่ยวข้องกัน
- SetPlayerCameraLookAt: Set where a player's camera should face.
- SetCameraBehindPlayer: Set a player's camera behind them.
| openmultiplayer/web/docs/translations/th/scripting/functions/SetPlayerCameraPos.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/th/scripting/functions/SetPlayerCameraPos.md",
"repo_id": "openmultiplayer",
"token_count": 461
} | 430 |
---
title: SetPlayerObjectPos
description: Sets the position of a player-object to the specified coordinates.
tags: ["player"]
---
## คำอธิบาย
Sets the position of a player-object to the specified coordinates.
| Name | Description |
| -------- | ----------------------------------------------------------------------------------- |
| playerid | The ID of the player whose player-object to set the position of. |
| objectid | The ID of the player-object to set the position of. Returned by CreatePlayerObject. |
| Float:X | The X coordinate to put the object at. |
| Float:Y | The Y coordinate to put the object at. |
| Float:Z | The Z coordinate to put the object at. |
## ส่งคืน
1: The function executed successfully.
0: The function failed to execute. Player and/or object do not exist.
## ตัวอย่าง
```c
new obj = CreatePlayerObject(...);
// Later on
SetPlayerObjectPos(playerid, obj, 2001.195679, 1547.113892, 14.283400);
```
## ฟังก์ชั่นที่เกี่ยวข้องกัน
- CreatePlayerObject: Create an object for only one player.
- DestroyPlayerObject: Destroy a player object.
- IsValidPlayerObject: Checks if a certain player object is vaild.
- MovePlayerObject: Move a player object.
- StopPlayerObject: Stop a player object from moving.
- SetPlayerObjectRot: Set the rotation of a player object.
- GetPlayerObjectPos: Locate a player object.
- GetPlayerObjectRot: Check the rotation of a player object.
- AttachPlayerObjectToPlayer: Attach a player object to a player.
- CreateObject: Create an object.
- DestroyObject: Destroy an object.
- IsValidObject: Checks if a certain object is vaild.
- MoveObject: Move an object.
- StopObject: Stop an object from moving.
- SetObjectPos: Set the position of an object.
- SetObjectRot: Set the rotation of an object.
- GetObjectPos: Locate an object.
- GetObjectRot: Check the rotation of an object.
- AttachObjectToPlayer: Attach an object to a player.
| openmultiplayer/web/docs/translations/th/scripting/functions/SetPlayerObjectPos.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/th/scripting/functions/SetPlayerObjectPos.md",
"repo_id": "openmultiplayer",
"token_count": 830
} | 431 |
---
title: SetPlayerWorldBounds
description: Set the world boundaries for a player.
tags: ["player"]
---
## คำอธิบาย
Set the world boundaries for a player. Players can not go out of the boundaries (they will be pushed back in).
| Name | Description |
| ----------- | ---------------------------------------------------- |
| playerid | The ID of the player to set the world boundaries of. |
| Float:x_max | The maximum X coordinate the player can go to. |
| Float:x_min | The minimum X coordinate the player can go to. |
| Float:y_max | The maximum Y coordinate the player can go to. |
| Float:y_min | The minimum Y coordinate the player can go to. |
## ส่งคืน
This function does not return any specific values.
## ตัวอย่าง
```c
public OnPlayerSpawn(playerid)
{
SetPlayerWorldBounds(playerid, 20.0, 0.0, 20.0, 0.0);
return 1;
}
```
```
(North)
ymax
|----------|
| |
(West) xmin | | xmax (East)
| |
|----------|
ymin
(South)
```
## บันทึก
:::tip
A player's world boundaries can be reset by setting them to 20000.0000, -20000.0000, 20000.0000, -20000.0000. These are the default values.
:::
:::warning
This function doesn't work in interiors!
:::
## ฟังก์ชั่นที่เกี่ยวข้องกัน
- GangZoneCreate: Create a gangzone.
| openmultiplayer/web/docs/translations/th/scripting/functions/SetPlayerWorldBounds.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/th/scripting/functions/SetPlayerWorldBounds.md",
"repo_id": "openmultiplayer",
"token_count": 693
} | 432 |
---
title: SetVehicleToRespawn
description: Sets a vehicle back to the position at where it was created.
tags: ["vehicle"]
---
## คำอธิบาย
Sets a vehicle back to the position at where it was created.
| Name | Description |
| --------- | -------------------------------- |
| vehicleid | The ID of the vehicle to respawn |
## ส่งคืน
1: The function executed successfully.
0: The function failed to execute. The vehicle does not exist
## ตัวอย่าง
```c
// Respawns the first vehicle.
SetVehicleToRespawn(1);
for(new i = GetVehiclePoolSize(); i > 0; i--)
{
SetVehicleToRespawn(i);
}
```
## ฟังก์ชั่นที่เกี่ยวข้องกัน
- CreateVehicle: Create a vehicle.
- DestroyVehicle: Destroy a vehicle.
| openmultiplayer/web/docs/translations/th/scripting/functions/SetVehicleToRespawn.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/th/scripting/functions/SetVehicleToRespawn.md",
"repo_id": "openmultiplayer",
"token_count": 322
} | 433 |
---
title: StopPlayerObject
description: Stop a moving player-object after MovePlayerObject has been used.
tags: ["player"]
---
## คำอธิบาย
Stop a moving player-object after MovePlayerObject has been used.
| Name | Description |
| -------- | ------------------------------------------------- |
| playerid | The ID of the player whose player-object to stop. |
| objectid | The ID of the player-object to stop. |
## ส่งคืน
This function does not return any specific values.
## ตัวอย่าง
```c
StopPlayerObject(playerid, objectid);
```
## ฟังก์ชั่นที่เกี่ยวข้องกัน
- MovePlayerObject: Move a player object.
- CreatePlayerObject: Create an object for only one player.
- DestroyPlayerObject: Destroy a player object.
- IsValidPlayerObject: Checks if a certain player object is vaild.
- IsPlayerObjectMoving: Check if the player object is moving.
- SetPlayerObjectPos: Set the position of a player object.
- SetPlayerObjectRot: Set the rotation of a player object.
- GetPlayerObjectPos: Locate a player object.
- GetPlayerObjectRot: Check the rotation of a player object.
- AttachPlayerObjectToPlayer: Attach a player object to a player.
- CreateObject: Create an object.
- DestroyObject: Destroy an object.
- IsValidObject: Checks if a certain object is vaild.
- MoveObject: Move an object.
- IsObjectMoving: Check if the object is moving.
- StopObject: Stop an object from moving.
- SetObjectPos: Set the position of an object.
- SetObjectRot: Set the rotation of an object.
- GetObjectPos: Locate an object.
- GetObjectRot: Check the rotation of an object.
- AttachObjectToPlayer: Attach an object to a player.
| openmultiplayer/web/docs/translations/th/scripting/functions/StopPlayerObject.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/th/scripting/functions/StopPlayerObject.md",
"repo_id": "openmultiplayer",
"token_count": 570
} | 434 |
---
title: TextDrawSetProportional
description: Appears to scale text spacing to a proportional ratio.
tags: ["textdraw"]
---
## คำอธิบาย
Appears to scale text spacing to a proportional ratio. Useful when using TextDrawLetterSize to ensure the text has even character spacing.
| Name | Description |
| ---- | ---------------------------------------------------- |
| text | The ID of the textdraw to set the proportionality of |
| set | 1 to enable proportionality, 0 to disable. |
## ส่งคืน
This function does not return any specific values.
## ตัวอย่าง
```c
new Text:MyTextdraw;
public OnGameModeInit()
{
MyTextDraw = TextDrawCreate(100.0, 33.0,"Example TextDraw");
TextDrawSetProportional(MyTextDraw,1);
return 1;
}
```
## บันทึก
:::tip
Proportionality is set to 1 by default, you might skip this function if you don't want to disable it. If you want to change the proportionality of a textdraw that is already shown, you don't have to recreate it. Simply use TextDrawShowForPlayer/TextDrawShowForAll after modifying the textdraw and the change will be visible.
:::
## ฟังก์ชั่นที่เกี่ยวข้องกัน
- [TextDrawCreate](../functions/TextDrawCreate.md): Create a textdraw.
- [TextDrawDestroy](../functions/TextDrawDestroy.md): Destroy a textdraw.
- [TextDrawColor](../functions/TextDrawColor.md): Set the color of the text in a textdraw.
- [TextDrawBoxColor](../functions/TextDrawBoxColor.md): Set the color of the box in a textdraw.
- [TextDrawBackgroundColor](../functions/TextDrawBackgroundColor.md): Set the background color of a textdraw.
- [TextDrawAlignment](../functions/TextDrawAlignment.md): Set the alignment of a textdraw.
- [TextDrawFont](../functions/TextDrawFont.md): Set the font of a textdraw.
- [TextDrawLetterSize](../functions/TextDrawLetterSize.md): Set the letter size of the text in a textdraw.
- [TextDrawTextSize](../functions/TextDrawTextSize.md): Set the size of a textdraw box.
- [TextDrawSetOutline](../functions/TextDrawSetOutline.md): Choose whether the text has an outline.
- [TextDrawSetShadow](../functions/TextDrawSetShadow.md): Toggle shadows on a textdraw.
- [TextDrawUseBox](../functions/TextDrawUseBox.md): Toggle if the textdraw has a box or not.
- [TextDrawSetString](../functions/TextDrawSetString.md): Set the text in an existing textdraw.
- [TextDrawShowForPlayer](../functions/TextDrawShowForPlayer.md): Show a textdraw for a certain player.
- [TextDrawHideForPlayer](../functions/TextDrawHideForPlayer.md): Hide a textdraw for a certain player.
- [TextDrawShowForAll](../functions/TextDrawShowForAll.md): Show a textdraw for all players.
- [TextDrawHideForAll](../functions/TextDrawHideForAll.md): Hide a textdraw for all players.
| openmultiplayer/web/docs/translations/th/scripting/functions/TextDrawSetProportional.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/th/scripting/functions/TextDrawSetProportional.md",
"repo_id": "openmultiplayer",
"token_count": 931
} | 435 |
---
title: UsePlayerPedAnims
description: Uses standard player walking animation (animation of the CJ skin) instead of custom animations for every skin (e.g. skating for skater skins).
tags: ["player"]
---
## คำอธิบาย
Uses standard player walking animation (animation of the CJ skin) instead of custom animations for every skin (e.g. skating for skater skins).
## ตัวอย่าง
```c
public OnGameModeInit()
{
UsePlayerPedAnims();
return 1;
}
```
## บันทึก
:::tip
Only works when placed under [OnGameModeInit](../callbacks/OnGameModeInit).
Not using this function causes two-handed weapons (not dual-handed - a single weapon that is held by both hands) to be held in only one hand.
:::
:::tip
You can also enable standard player walking animation via [config.json](../../server/config.json)
```json
"use_player_ped_anims": true,
```
:::
## ฟังก์ชั่นที่เกี่ยวข้องกัน
- [ApplyAnimation](../functions/ApplyAnimation): Apply an animation to a player.
- [ClearAnimations](../functions/ClearAnimations): Clear any animations a player is performing.
| openmultiplayer/web/docs/translations/th/scripting/functions/UsePlayerPedAnims.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/th/scripting/functions/UsePlayerPedAnims.md",
"repo_id": "openmultiplayer",
"token_count": 396
} | 436 |
---
title: flength
description: Returns the length of a file.
tags: []
---
:::warning
This function starts with lowercase letter.
:::
## คำอธิบาย
Returns the length of a file.
| Name | Description |
| ------ | ------------------------------------------ |
| handle | The file handle returned by fopen or ftemp |
## ส่งคืน
The length of a file, in bytes.
## ตัวอย่าง
```c
// Open "file.txt" in "read only" mode
new File:handle = fopen("file.txt", io_read);
// If "file.txt" is open
if (handle)
{
// Success
// Print the size oin bytes of "file.txt"
printf("File size: %d", flength(handle));
// Close "file.txt"
fclose(handle);
}
else
{
// Error
print("Failed to open \"file.txt\".");
}
```
## บันทึก
:::warning
Using an invalid handle will crash your server! Get a valid handle by using fopen or ftemp.
:::
## ฟังก์ชั่นที่เกี่ยวข้องกัน
- [fopen](../functions/fopen): Open a file.
- [fclose](../functions/fclose): Close a file.
- [ftemp](../functions/ftemp): Create a temporary file stream.
- [fremove](../functions/fremove): Remove a file.
- [fwrite](../functions/fwrite): Write to a file.
- [fread](../functions/fread): Read a file.
- [fputchar](../functions/fputchar): Put a character in a file.
- [fgetchar](../functions/fgetchar): Get a character from a file.
- [fblockwrite](../functions/fblockwrite): Write blocks of data into a file.
- [fblockread](../functions/fblockread): Read blocks of data from a file.
- [fseek](../functions/fseek): Jump to a specific character in a file.
- [flength](../functions/flength): Get the file length.
- [fexist](../functions/fexist): Check, if a file exists.
- [fmatch](../functions/fmatch): Check, if patterns with a file name matches.
| openmultiplayer/web/docs/translations/th/scripting/functions/flength.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/th/scripting/functions/flength.md",
"repo_id": "openmultiplayer",
"token_count": 709
} | 437 |
---
title: floattan
description: Get the tangent from a given angle.
tags: []
---
:::warning
This function starts with lowercase letter.
:::
## คำอธิบาย
Get the tangent from a given angle. The input angle may be in radians, degrees or grades.
| Name | Description |
| ----------- | ------------------------------------------------------ |
| Float:value | The angle from which to get the tangent. |
| anglemode | The angle mode to use, depending on the value entered. |
## ส่งคืน
The tangent from the value entered.
## ตัวอย่าง
```c
public OnGameModeInit()
{
printf("The tangent from 30° is %f", floattan(30.0, degrees));
// Output: 1
return 1;
}
```
## บันทึก
:::warning
GTA/SA-MP use degrees for angles in most circumstances, for example GetPlayerFacingAngle. Therefore, it is most likely you'll want to use the 'degrees' angle mode, not radians. Also note that angles in GTA are counterclockwise; 270° is East and 90° is West. South is still 180° and North still 0°/360°.
:::
## ฟังก์ชั่นที่เกี่ยวข้องกัน
- [floatsin](../functions/floatsin): Get the sine from a specific angle.
- [floatcos](../functions/floatcos): Get the cosine from a specific angle.
| openmultiplayer/web/docs/translations/th/scripting/functions/floattan.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/th/scripting/functions/floattan.md",
"repo_id": "openmultiplayer",
"token_count": 521
} | 438 |
---
title: ispacked
description: Checks if the given string is packed.
tags: []
---
:::warning
This function starts with lowercase letter.
:::
## คำอธิบาย
Checks if the given string is packed.
| Name | Description |
| ------ | -------------------- |
| string | The string to check. |
## ส่งคืน
1 if the string is packed, 0 if it's unpacked.
## ตัวอย่าง
```c
// Create a packed string
new string[24 char];
if (ispacked(string))
{
print("The string is packed.");
}
```
## ฟังก์ชั่นที่เกี่ยวข้องกัน
| openmultiplayer/web/docs/translations/th/scripting/functions/ispacked.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/th/scripting/functions/ispacked.md",
"repo_id": "openmultiplayer",
"token_count": 259
} | 439 |
---
title: strfind
description: Search for a sub string in a string.
tags: []
---
:::warning
This function starts with lowercase letter.
:::
## คำอธิบาย
Search for a sub string in a string.
| Name | Description |
| --------------------- | --------------------------------------------------------------------------------------------------------- |
| const string[] | The string you want to search in (haystack). |
| const sub[] | The string you want to search for (needle). |
| ignorecase (optional) | When set to true, the case doesn't matter - HeLLo is the same as Hello. When false, they're not the same. |
| Position (optional) | The offset to start searching from. |
## ส่งคืน
The number of characters before the sub string (the sub string's start position) or -1 if it's not found.
## ตัวอย่าง
```c
if (strfind("Are you in here?", "you", true) != -1) //returns 4, because the start of 'you' (y) is at index 4 in the string
{
SendClientMessageToAll(0xFFFFFFFF, "I found you!");
}
```
## ฟังก์ชั่นที่เกี่ยวข้องกัน
- strcmp: Compare two strings to check if they are the same.
- strtok: Get the next 'token' (word/parameter) in a string.
- strdel: Delete part of a string.
- strins: Insert text into a string.
- strlen: Get the length of a string.
- strmid: Extract part of a string into another string.
- strpack: Pack a string into a destination string.
- strval: Convert a string into an integer.
- strcat: Concatenate two strings into a destination reference.
| openmultiplayer/web/docs/translations/th/scripting/functions/strfind.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/th/scripting/functions/strfind.md",
"repo_id": "openmultiplayer",
"token_count": 826
} | 440 |
---
title: Crime List
description: Crime List to be used with [PlayCrimeReportForPlayer](../functions/PlayCrimeReportForPlayer) function.
sidebar_label: Crime List
---
To be used with [PlayCrimeReportForPlayer](../functions/PlayCrimeReportForPlayer) function.
| Crime ID | Ten-code | Description |
| -------- | -------- | -------------------------------------------------------- |
| 3 | 10-71 | Advise nature of fire (size, type, contents of building) |
| 4 | 10-47 | Emergency road repairs needed |
| 5 | 10-81 | Breatherlizer Report |
| 6 | 10-24 | Assignment Completed |
| 7 | 10-21 | Call () by phone |
| 8 | 10-21 | Call () by phone |
| 9 | 10-21 | Call () by phone |
| 10 | 10-17 | Meet Complainant |
| 11 | 10-81 | Breatherlizer Report |
| 12 | 10-91 | Pick up prisoner/subject |
| 13 | 10-28 | Vehicle registration information |
| 14 | 10-81 | Breathalyzer |
| 15 | 10-28 | Vehicle registration information |
| 16 | 10-91 | Pick up prisoner/subject |
| 17 | 10-34 | Riot |
| 18 | 10-37 | (Investigate) suspicious vehicle |
| 19 | 10-81 | Breathalyzer |
| 21 | 10-7 | Out of service |
| 22 | 10-7 | Out of service |
| openmultiplayer/web/docs/translations/th/scripting/resources/crimelist.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/th/scripting/resources/crimelist.md",
"repo_id": "openmultiplayer",
"token_count": 1223
} | 441 |
---
title: Marker Modes
---
To be used with [ShowPlayerMarkers](../functions/ShowPlayerMarkers).
```c
PLAYER_MARKERS_MODE_OFF (0)
PLAYER_MARKERS_MODE_GLOBAL (1)
PLAYER_MARKERS_MODE_STREAMED (2)
```
| openmultiplayer/web/docs/translations/th/scripting/resources/markermodes.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/th/scripting/resources/markermodes.md",
"repo_id": "openmultiplayer",
"token_count": 98
} | 442 |
---
title: Spectate Modes
description: Spectate Modes to be used with [PlayerSpectatePlayer](../functions/PlayerSpectatePlayer.md) and [PlayerSpectateVehicle](../functions/PlayerSpectateVehicle.md) functions.
tags: []
sidebar_label: Spectate Modes
---
Spectate Modes to be used with [PlayerSpectatePlayer](../functions/PlayerSpectatePlayer.md) and [PlayerSpectateVehicle](../functions/PlayerSpectateVehicle.md) functions.
| Type | Effect |
| -------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
| SPECTATE_MODE_NORMAL | Normal spectate mode (third person point of view). Camera can not be changed. |
| SPECTATE_MODE_FIXED | Use SetPlayerCameraPos after this to position the player's camera, and it will track the player/vehicle set with PlayerSpectatePlayer/PlayerSpectateVehicle |
| SPECTATE_MODE_SIDE | The camera will be attached to the side of the player/vehicle (like when you're in first-person camera on a bike and you do a wheelie). |
| openmultiplayer/web/docs/translations/th/scripting/resources/spectatemodes.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/th/scripting/resources/spectatemodes.md",
"repo_id": "openmultiplayer",
"token_count": 524
} | 443 |
---
title: "โครงสร้างขั้นสูง"
---
## การจัดการ Array
### หาช่องว่างอย่างไรให้ถูกต้อง
ตัวอย่างนี้แสดงวิธีการหาช่องว่างในอาร์เรย์โดยใช้โค้ดมาตรฐาน แบบฝึกหัด
```c
new
gMyArray[10];
stock FindEmptySlot()
{
new
i = 0;
while (i < sizeof (gMyArray) && gMyArray[i])
{
i++;
}
if (i == sizeof (gMyArray)) return -1;
return i;
}
```
ตัวอย่างพื้นฐานนี้ถือว่าช่องอาร์เรย์ว่างถ้าหากค่าเป็น 0 ลูปวนผ่านทุก ๆ ค่าในอาร์เรย์ (และทำอย่างต่อเนื่อง) ตราบใดที่ค่าไม่ใช่ 0 เมื่อถึงจุดนึงที่ค่าเป็น 0 เงื่อนไขลูป while จะ fail และ ลูปจะสิ้นสุดลงโดยไม่ต้อง break เป็นพื้นฐานทั่วไป แต่ ก็ควรระวังกับสถานการณ์เช่นนี้ ฟังก์ชั่นนี้จะส่งค่ากลับเป็น -1 หากไม่พบช่องว่าง ซึ่งต้องตรวจสอบในตอนท้าย โดยทั่วไปคุณจะใช้ id ที่พบทันที:
```c
MyFunction()
{
new
i = 0;
while (i < sizeof (gMyArray) && gMyArray[i])
{
i++;
}
if (i == sizeof (gMyArray))
{
printf("ไม่พบช่องว่าง");
return 0;
}
printf("ช่องที่ %d ว่าง", i);
// เอาช่องที่พบไปใช้กับโค้ดของคุณด้านล่างจะเอาไปทำอะไรก็ตามแต่
return 1;
}
```
คุณสามารถแทน "gMyArray[i]" ด้วยนิพจน์ของคุณในการ ชี้ไปยังช่องที่ใช้งาน
### List
#### เบื้องต้น
List เป็นประเภทของโครงสร้างที่มีประโยชน์มาก โดยพื้นฐานแล้วพวกมันคืออาร์เรย์ที่ ชิ้นส่วนถัดไปหรือข้อมูลที่สัมพันธ์กันจะชี้ไปที่ส่วนสุดท้าย
ตัวอย่าง:
สมมติว่าคุณมีอาร์เรย์ต่อไปนี้:
```c
3, 1, 64, 2, 4, 786, 2, 9
```
หากคุณต้องการจัดเรียงอาร์เรย์ให้ท้ายที่สุดออกมาเป็นแบบนี้:
```c
1, 2, 2, 3, 4, 9, 64, 786
```
อย่างไรก็ตามหากคุณต้องการทิ้งข้อมูลให้เรียงลำดับแบบเดิมแต่ไม่รู้ เลขลำดับเนื่องจากเหตุผลบางอย่าง (แค่ตัวอย่าง) ดังนั้นคุณเริ่มมีปัญหาแล้ว ยังไงล่ะ? คุณหมายถึงมีตัวเลขสองชุดในการสั่งครั้งเดียว? ใช่แล้ว ปัญหาแบบนี้แหละที่จะมีประโยชน์ในการใช้ List ในการสร้าง List จากข้อมูลนี้คุณจะต้องสร้างอาร์เรย์เข้าไป 2 มิติ โดยทั้งสองมิติจะมีขนาดใหญ่ 2 เซลล์ หนึ่งเก็บจำนวนเดิมไว้ และอีกหนึ่งเก็บดัชนีของ ตัวเลขถัดไปที่มากกว่าไว้ คุณจะต้องมีตัวแปรแยกต่างหากเพื่อเก็บดัชนีของตัวเลขต่ำสุดไว้ด้วย อาร์เรย์ใหม่ของคุณจะมีลักษณะดังนี้:
```c
start = 1
3, 1, 64, 2, 4, 786, 2, 9
4, 3, 5, 6, 7, -1, 0, 2
```
ดัชนีถัดไปที่สัมพันธ์กับ 786 คือ -1 นี่คือดัชนีอาร์เรย์ที่ไม่ถูกต้องและ เป็นการระบุจุดสิ้นสุดของ List นั้นคือไม่มีตัวเลขเพิ่มเติมแล้ว เห็นได้ชัดว่า 2 ทั้งสอง จะเป็น 2 ทางไหนก่อนก็ได้ อันแรกในอาร์เรย์จะอยู่ในอันดับแรกใน List เนื่องจากมีแนวโน้มที่จะพบก่อน
ข้อดีอีกอย่างของวิธีการเรียงลำดับตัวเลขนี้คือการเพิ่มจำนวนได้เร็วขึ้นมาก หากคุณต้องการเพิ่มเลข 3 ให้กับอาร์เรย์ที่เรียงลำดับของคุณ จะต้องเลื่อนอย่างน้อย 4 ตัวเลข หนึ่งช่องไปทางขวาเพื่อสร้างช่องว่าง ซึ่งในที่นี้มันอาจจะยังไม่น่ากลัว แต่มันจะช้ามาก ๆ ถ้าอาร์เรย์มีขนาดใหญ่ แต่ด้วยเวอร์ชั่น List นี้เพียงแค่คุณต่อ 3 เพิ่มเข้าไปในลำดับสุดท้ายของอาร์เรย์และ แก้ไขค่าเดียวใน List;
```c
start = 1
3, 1, 64, 2, 4, 786, 2, 9, 3
8, 3, 5, 6, 7, -1, 0, 2, 4
^ แก้ไขค่านี้ ^ ช่องถัดไปที่สูงที่สุด
```
ไม่มีตัวเลขไหนถูกย้าย ดังนั้นจึงไม่มีดัชนีให้อัปเดต เพียงแค่ทำให้ค่าที่ต่ำสุดชี้ไปยังหมายเลขใหม่และ สร้างหมายเลขใหม่ชี้ไปยังค่าที่ต่ำสุดที่ชี้ไป การลบค่า ก็ทำได้ง่าย:
```c
start = 1
3, 1, 64, X, 4, 786, 2, 9, 3
8, 6, 5, 6, 7, -1, 0, 2, 4
^ เปลี่ยนตรงนี้เพื่อข้ามค่าที่ต้องการลบ
```
ตอนนี้เลข 2 ตัวแรกได้ถูกลบออกแล้ว และเลขก่อนหน้าที่ชี้ไปยังเลขนั้น (คือเลข 1) ได้ถูกอัปเดตให้ชี้ไปยังตำแหน่งเดียวกับเลขที่ถูกลบเคยชี้อยู่ ในตัวอย่างนี้ ไม่มีการลบตัวชี้หรือตัวเลขของหมายเลขที่ถูกลบออก แต่คุณก็ไม่สามารถไปที่ช่องนั้นได้ใน List ดังนั้นไม่สำคัญเลยมันได้ถูกลบออกอย่างมีประสิทธิภาพแล้ว
#### Types
List ในตัวอย่างข้างต้นเป็นเพียงแค่ List ขั้นพื้นฐานแบบเดี่ยว คุณยังสามารถทำ List แบบคู่ที่ทุก ๆ ค่าชี้ไปยังค่าถัดไปและค่าสุดท้าย ซึ่งมักจะมีตัวชี้ไปที่ชี้ไปยังตำแหน่งสิ้นสุดของ List เช่นกันเพื่อย้อนกลับ (เช่น เพื่อให้เรียงตัวเลขจากมากไปหาน้อย):
```c
start = 1
end = 5
value: 3, 1, 64, 2, 4, 786, 2, 9, 3
next: 8, 3, 5, 6, 7, -1, 0, 2, 4
last: 6, -1, 7, 1, 8, 2, 3, 4, 0
```
คุณต้องระวังสิ่งนี้โดยเฉพาะอย่างยิ่ง เมื่อคุณมีค่ามากกว่า หนึ่งค่า ที่ตัวชี้สุดท้ายชี้ไปที่ตัวเลขที่ว่าเลขไหนเป็นตัวชี้ตัวถัดไปที่จะ ย้อนกลับไปตรงๆอีกครั้งแบบนี้ ซึ่งมันผิด:
```c
2, 3, 3
1, 2, -1
-1, 2, 0
```
เลขถัดจากตัวชี้ของ 2 ก็คือ 3 ตัวแรก แต่ตัวชี้ของ 3 ตัวสุดท้าย ไม่ได้ชี้กลับไปหา 2 List ของทั้งคู่อยู่ในลำดับของตัวเอง (สองและสามอาจอยู่ได้ ทั้งสองทาง) แต่เมื่อรวมกันแล้วมันผิด เวอร์ชั่นที่ถูกต้อง เป็นแบบนี้:
```c
2, 3, 3
1, 2, -1
-1, 0, 2
```
List ทั้งสองเริ่มต้นและสิ้นสุดที่เลขสองตัว ด้านหลังของ List ในตัวอย่างที่ผิดเริ่มต้นที่เลขตรงกลาง
The other type of list is the looping one where the last value points back to the first. The obvious advantage to this is that you can get to any value from any other value without knowing in advance whether the target is before or after the start point, you just need to be careful not to get into an infinite loop as there's no explicit -1 end point. These lists do still have start points. You can also do double looping lists where you have a next and last list, both of which loop round:
```c
start = 1
end = 5
3, 1, 64, 2, 4, 786, 2, 9, 3
8, 3, 5, 6, 7, 1, 0, 2, 4
6, 5, 7, 1, 8, 2, 3, 4, 0
```
#### Mixed lists
Mixed lists are arrays containing multiple lists at once. An example could be an array of values, sorted by a list, with another list linking all unused slots so you know where you can add a new value. Example (X means unused (free) slot):
```c
sortedStart = 3
unusedStart = 1
value: 34, X, X, 6, 34, 46, X, 54, 23, 25, X, 75, X, 45
sort: 4, 8, 13, 7, 11, 9, 0, -1, 5
free: 2, 6, 10, 12, -1
```
Obviously the two lists never interact so both can use the same slot for their next value:
```c
sortedStart = 3
unusedStart = 1
value: 34, X, X, 6, 34, 46, X, 54, 23, 25, X, 75, X, 45
next: 4, 2, 6, 8, 13, 7, 10, 11, 9, 0, 12, -1, -1, 5
```
#### Code
Before you start the code you need to decide what sort of list is best suited for your application, this is entirely based on application can't easily be covered here. All these examples are mixed lists, one list for the required values, one for unused slots.
This example shows how to write code for a list sorted numerically ascending.
```c
#define NUMBER_OF_VALUES (10)
enum E_DATA_LIST
{
E_DATA_LIST_VALUE,
E_DATA_LIST_NEXT
}
new
gListData[NUMBER_OF_VALUES][E_DATA_LIST],
gUnusedStart = 0,
gListStart = -1; // Starts off with no list
// This function initializes the list
List_Setup()
{
new
i;
size--;
for (i = 0; i < size; i++)
{
// To start with all slots are unused
gListData[i][E_DATA_LIST_NEXT] = i + 1;
}
// End the list
gListData[size][E_DATA_LIST_NEXT] = -1;
}
// This function adds a value to the list (using basic sorting)
List_Add(value)
{
// Check there are free slots in the array
if (gUnusedStart == -1) return -1;
new
pointer = gListStart,
last = -1
slot = gUnusedStart;
// Add the value to the array
gListData[slot][E_DATA_LIST_VALUE] = value;
// Update the empty list
gUnusedStart = gListData[slot][E_DATA_LIST_NEXT];
// Loop through the list till we get to bigger/same size number
while (pointer != -1 && gListData[pointer][E_DATA_LIST_VALUE] < value)
{
// Save the position of the last value
last = pointer
// Move on to the next slot
pointer = gListData[pointer][E_DATA_LIST_NEXT];
}
// If we got here we ran out of values or reached a larger one
// Check if we checked any numbers
if (last == -1)
{
// The first number was bigger or there is no list
// Either way add the new value to the start of the list
gListData[slot][E_DATA_LIST_NEXT] = gListStart;
gListStart = slot;
}
else
{
// Place the new value in the list
gListData[slot][E_DATA_LIST_NEXT] = pointer;
gListData[last][E_DATA_LIST_NEXT] = slot;
}
return slot;
}
// This function removes a value from a given slot in the array (returned by List_Add)
List_Remove(slot)
{
// Is this a valid slot
if (slot < 0 || slot >= NUMBER_OF_VALUES) return 0;
// First find the slot before
new
pointer = gListStart,
last = -1;
while (pointer != -1 && pointer != slot)
{
last = pointer;
pointer = gListData[pointer][E_LIST_DATA_NEXT];
}
// Did we find the slot in the list
if (pointer == -1) return 0;
if (last == -1)
{
// The value is the first in the list
// Skip over this slot in the list
gListStart = gListData[slot][E_LIST_DATA_NEXT];
}
else
{
// The value is in the list
// Skip over this slot in the list
gListData[last][E_LIST_DATA_NEXT] = gListData[slot][E_LIST_DATA_NEXT];
}
// Add this slot to the unused list
// The unused list isn't in any order so this doesn't matter
gListData[slot][E_LIST_DATA_NEXT] = gUnusedStart;
gUnusedStart = slot;
return 1;
}
```
### Binary Trees
#### Introduction
Binary trees are a very fast method of searching for data in an array by using a very special list system. The most well known binary tree is probably the 20 questions game, with just 20 yes/no questions you can have over 1048576 items. A binary tree, as it's name implies, is a type of tree, similar to a family tree, where every item has 0, 1 or 2 children. They are not used for ordering data like a list but sorting data for very efficient searching. Basically you start with an item somewhere near the middle of the ordered list of objects (e.g. the middle number in a sorted array) and compare that to the value you want to find. If it's the same you've found your item, if it's greater you move to the item to the right (not immediately to the right, the item to the right of the middle item would be the item at the three quarter mark), if it's less you move left, then repeat the process.
**Example**
```c
1 2 5 6 7 9 12 14 17 19 23 25 28 33 38
```
You have the preceding ordered array and you want to find what slot the number 7 is in (if it's in at all), in this example it's probably more efficient to just loop straight through the array to find it but that's not the point, that method increases in time linearly with the size of the array, a binary search time increases linearly as the array increases exponentially in size. I.e. an array 128 big will take twice as long to search straight through as an array 64 big, but a binary search 128 big will only take one check more than a binary search 64 big, not a lot at all.
If we construct a binary tree from the data above we get: 
If you read left to right, ignoring the vertical aspect you can see that the numbers are in order. Now we can try find the 7.
The start number is 14, 7 is less than 14 so we go to the slot pointed to by the left branch of 14. This brings us to 6, 7 is bigger than 6 so we go right to 9, then left again to 7. This method took 4 comparisons to find the number (including the final check to confirm that we are on 7), using a straight search would have taken 5.
Lets say there is no 7, we would end up with this binary tree: 
This, unlike the example above, has a single child number (the 9), as well as 2 and 0 child numbers. You only get a perfect tree when there are (2^n)-1 numbers (0, 1, 3, 7, 15, 31 ...), any other numbers will give a not quite full tree. In this case when we get to the 9, where the 7 will be, we'll find there is no left branch, meaning the 7 doesn't exist (it cannot possibly be anywhere else in the tree, think about it), so we return -1 for invalid slot.
#### Balanced and unbalanced
The trees in the examples above are called balanced binary trees, this means as near as possible all the branches are the same length (obviously in the second there aren't enough numbers for this to be the case but it's as near as possible). Constructing balanced trees is not easy, the generally accepted method of constructing almost balanced trees is putting the numbers in in a random order, this may mean you end up with something like this: 
Obviously this tree is still valid but the right side is much larger than the left, however finding 25 still only takes 7 comparisons in this compared to 12 in the straight list. Also, as long as you start with a fairly middle number the random insertion method should produced a fairly balanced tree. The worst possible thing you can do is put the numbers in in order as then there will be no left branches at all (or right branches if done the other way), however even in this worst case the binary tree will take no longer to search than the straight list.
**Modification**
#### Addiction
Adding a value to a binary tree is relatively easy, you just follow the tree through, using the value you want to add as a reference untill you reach an empty branch and add the number there. E.g. if you wanted to add the number 15 to our original balanced tree it would end up on the left branch of the 17. If we wanted to add the number 8 to the second balanced tree (the one without the 7) it would end up in the 7's old slot on the left of the 9.
#### Deletion
Deleting a number from a binary tree can be hard or it can be easy. If the number is at the end of a branch (e.g. 1, 5, 7, 12 etc in the original tree) you simply remove them. If a number only has one child (e.g. the 9 in the second example) you simply move that child (e.g. the 12) up into their position (so 6's children would be 2 and 12 in the new second example with 9 removed). Deletion only gets interesting when a node has two children. There are at least four ways of doing this:
The first method is the simplest computationally. Basically you choose one of the branches (left or right, assume right for this explanation) and replace the node you've removed with the first node of that branch (i.e. the right child of the node you've removed). You then go left through than new branch till you reach the end and place the left branch there. E.g. if you removed the 14 from the original exampe you would end up with 25 taking it's place at the top of the tree and 6 attached to the left branch of 17. This method is fast but ends up with very unbalanced trees very quickly.
The second method is to get all the numbers which are children of the node you just removed and rebuild a new binary tree from them, then put the top of that tree into the node you've just removed. This keeps the tree fairly well balanced but is obviously slower.
The third method is to combine the two methods above and rebuild the tree inline, this is more complex to code but keeps the tree balanced and is faster than the second method (though no-where near as fast as the first).
The final menthod listed here is to simply set a flag on a value saying it's not used any more, this is even faster than the first method and maintains the structure but means you can't re-use slots unless you can find a value to replace it with later.
| openmultiplayer/web/docs/translations/th/tutorials/AdvancedStructures.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/th/tutorials/AdvancedStructures.md",
"repo_id": "openmultiplayer",
"token_count": 10237
} | 444 |
---
title: OnActorStreamOut
description: Bu callback, bir aktör oyuncunun akış alanından ayrıldığında tetiklenir.
tags: []
---
:::warning
Bu callback SA-MP 0.3.7 sürümüyle birlikte eklenmiştir. Önceki SA-MP sürümlerinde çalışmaz.
:::
## Açıklama
Bu callback, bir aktör oyuncunun akış alanından ayrıldığında tetiklenir.
| Name | Description |
| ----------- | ---------------------------------------------- |
| actorid | Oyuncunun akış alanından ayrılan aktör id'si. |
| forplayerid | Aktörün akış alanından ayrıldığı oyuncu id'si. |
## Çalışınca Vereceği Sonuçlar
It is always called first in filterscripts.
## Örnek
```c
public OnActorStreamOut(actorid, forplayerid)
{
new string[40];
format(string, sizeof(string), "%d id'li aktör artık akış alanında değil.", actorid);
SendClientMessage(forplayerid, 0xFFFFFFFF, string);
return 1;
}
```
## Notlar
:::tip
Bu callback NPC'ler için de tetiklenebilir.
:::
## Bağlantılı Fonksiyonlar
| openmultiplayer/web/docs/translations/tr/scripting/callbacks/OnActorStreamOut.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/tr/scripting/callbacks/OnActorStreamOut.md",
"repo_id": "openmultiplayer",
"token_count": 461
} | 445 |
---
title: OnPlayerDeath
description: This callback is called when a player dies, either by suicide or by being killed by another player.
tags: ["player"]
---
## Açıklama
Bu callback bir oyuncu öldüğünde, intihar ettiğinde yada başka bir oyuncu tarafından öldürüldüğünde çağırılır.
| İsim | Açıklama |
|---------------|---------------------------------------------------------------------------------------------|
| playerid | Ölen oyuncunun ID'si. |
| killerid | Öldüren oyuncunun ID'si, eğer öldüren bir oyuncu yoksa INVALID_PLAYER_ID değeri döndürülür. |
| WEAPON:reason | Oyuncunun ölüm sebebinin ID'si. |
## Çalışınca Vereceği Sonuçlar
0 - Diğer filterscriptlerin bu callbacki çağırmasını engeller.
1 - Bu callbackin sonraki filterscriptlere geçeceğini belirtir.
Filterscriptlerde her zaman ilk olarak çağırılır.
## Örnekler
```c
new PlayerDeaths[MAX_PLAYERS];
new PlayerKills[MAX_PLAYERS];
public OnPlayerDeath(playerid, killerid, WEAPON:reason)
{
SendDeathMessage(killerid, playerid, reason); // killfeed(Sağdaki öldüren, silah ve ölen oyuncu) listesine ölen, öldüren ve ölüm nedenini gösterir.
// killerid ile herhangi bir işlem yapmadan önce, killerid'nin geçerli olup olmadığını kontrol eder.
if (killerid != INVALID_PLAYER_ID)
{
PlayerKills[killerid] ++;
}
// Kontrolün dışında, playerid için gerekli işlemleri yapar. (playerid her zaman geçerlidir.)
PlayerDeaths[playerid] ++;
return 1;
}
```
## Notlar
:::tip
Herhangi bir ateş kaynağından gelen hasarlarda(örnek: molotov, 18) weaponid değeri 37 (flame thrower) olarak döndürülür. Herhangi bir patlama kaynağından gelen hasarlarda (örnek: roketatar, el bombası) weapondid değeri 51 olarak geri döndürülür. SendDeathMessage fonksiyonunu kullanmadan önce killerid'nin geçerli olup olmadığını kontrol etmenize gerek yok. INVALID_PLAYER_ID geçerli bir killerid ID parametresidir. Yalnızca playerid tarafından çağırılabilir. (anti fake death için bilmeniz iyi olur.)
:::
:::warning
Bir dizi içerisinde kullanmadan önce killerid'nin geçerli olup olmadığını kontrol ETMELİSİNİZ, yoksa OnPlayerDeath scriptinin çökmesine neden olur (Bütün script değil). Bunun nedeni INVALID_PLAYER_ID'nin 65535 olarak belirlenmiş olmasıdır ve bu değer MAX_PLAYERS'dan yüksek olacağı için scripti çökertir.
:::
## Bağlantılı Fonksiyonlar
- [SendDeathMessage](../functions/SendDeathMessage): killfeed'e (Sağdaki öldüren, silah, ölüm listesi.) bir yeni ölüm verisi girer.
- [SetPlayerHealth](../functions/SetPlayerHealth): Oyuncu canını belirler.
| openmultiplayer/web/docs/translations/tr/scripting/callbacks/OnPlayerDeath.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/tr/scripting/callbacks/OnPlayerDeath.md",
"repo_id": "openmultiplayer",
"token_count": 1319
} | 446 |
---
title: OnPlayerObjectMoved
description: Fonksiyon, bir oyuncu objesi MovePlayerObject'den sonra hareket ettirildiğinde (hareket etmeyi durdurduğunda) çağrılır.
tags: ["player"]
---
## Açıklama
Fonksiyon, bir oyuncu objesi MovePlayerObject'den sonra hareket ettirildiğinde (hareket etmeyi durdurduğunda) çağrılır.
| Parametre | Açıklama |
| --------- | ------------------------------------------ |
| playerid | Objenin atandığı oyuncunun ID'si. |
| objectid | Hareket ettirilen oyuncu objesinin ID'si. |
## Çalışınca Vereceği Sonuçlar
Filterscript komutlarında her zaman ilk olarak çağrılır.
## Örnekler
```c
public OnPlayerObjectMoved(playerid, objectid)
{
printf("Oyuncu objesi haraket ettirildi: object id: %d oyuncu id: %d", objectid, playerid);
return 1;
}
```
## Notlar
:::tip
Bu fonksiyon, NPC için de çağrılabilir.
:::
## Bağlantılı Fonksiyonlar
- [MovePlayerObject](../functions/MovePlayerObject): Oyuncu objesi hareket ettirme.
- [IsPlayerObjectMoving](../functions/IsPlayerObjectMoving): Oyuncu objesinin hareket edip etmediğini kontrol etme.
- [StopPlayerObject](../functions/StopPlayerObject): Hareket eden oyuncu objesini durdurma.
- [CreatePlayerObject](../functions/CreatePlayerObject): Oyuncu objesi oluşturma.
- [DestroyPlayerObject](../functions/DestroyPlayerObject): Oyuncu objesi silme.
| openmultiplayer/web/docs/translations/tr/scripting/callbacks/OnPlayerObjectMoved.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/tr/scripting/callbacks/OnPlayerObjectMoved.md",
"repo_id": "openmultiplayer",
"token_count": 584
} | 447 |
---
title: OnRconLoginAttempt
description: Bu fonksiyon, bir oyuncu RCON olarak oturum açmaya çalıştığında giriş denemesi başarısız olsa bile çağrılır.
tags: []
---
## Açıklama
Bu fonksiyon, bir oyuncu RCON olarak oturum açmaya çalıştığında giriş denemesi başarısız olsa bile çağrılır.
| Parametre | Açıklama |
| ---------- | -------------------------------------------------------- |
| ip[] | RCON oturumu açmaya çalışan IP adresi. |
| password[] | Oturum açmaya çalışırken girilen parola. |
| success | Giriş sonucu. Parola yanlışsa 0, doğruysa 1 olarak döner. |
## Çalışınca Vereceği Sonuçlar
Filterscript komutlarında her zaman ilk olarak çağrılır.
## Örnekler
```c
public OnRconLoginAttempt(ip[], password[], success)
{
if (!success) //Eğer parola yanlışsa.
{
printf("%s IP ADRESİNE SAHİP OYUNCU RCON OTURUMU AÇMAYI DENEDİ FAKAT BAŞARISIZ OLDU, GİRMEYE ÇALIŞTIĞI PAROLA: %s",ip, password);
new pip[16];
for(new i = GetPlayerPoolSize(); i != -1; --i) //Tüm oyuncular arasında döngü oluşturun.
{
GetPlayerIp(i, pip, sizeof(pip));
if (!strcmp(ip, pip, true)) //Bir oyuncunun IP'si, oturum açma sırasında başarısız olan IP ise...
{
SendClientMessage(i, 0xFFFFFFFF, "Wrong Password. Bye!"); //Mesaj gönder.
Kick(i); //Oyuncu kicklendi.
}
}
}
return 1;
}
```
## Notlar
:::tip
Bu fonksiyon yalnızca /rcon login komutu oyun içinde kullanıldığında çağrılır. Fonksiyon, yalnızca oyuncu henüz oturum açmamışsa çağrılır. Oyuncu oturum açtığında, bunun yerine OnRconCommand çağrılır.
:::
## Bağlantılı Fonksiyonlar
- [IsPlayerAdmin](../functions/IsPlayerAdmin): Oyuncunun RCON oturumu açıp açmadığını kontrol etme.
- [SendRconCommand](../functions/SendRconCommand): Komut dosyası aracılığıyla bir RCON komutu gönderme.
| openmultiplayer/web/docs/translations/tr/scripting/callbacks/OnRconLoginAttempt.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/tr/scripting/callbacks/OnRconLoginAttempt.md",
"repo_id": "openmultiplayer",
"token_count": 1058
} | 448 |
---
title: AddServerRule
description: Bir sunucu kuralı ekleyin.
tags: ["rule"]
---
<VersionWarnTR version='omp v1.1.0.2612' />
## Açıklama
Bir sunucu kuralı ekleyin.
| İsim | Açıklama |
| ----------------- | ----------------------------------------------------------- |
| const rule[] | Eklemek istediğiniz sunucu kuralının adı. |
| const format[] | Sunucu kural değeri. |
| OPEN_MP_TAGS:... | Herhangi bir etiket türünden belirsiz sayıda argüman. |
## Çalışınca Vereceği Sonuçlar
Fonksiyon başarıyla çalıştırıldıysa true, aksi halde false döner.
## Örnekler
```c
public OnGameModeInit()
{
AddServerRule("discord", "discord.gg/samp");
return 1;
}
```
## Bağlantılı Fonksiyonlar
- [RemoveServerRule](RemoveServerRule): Sunucu kuralını kaldırır.
- [IsValidServerRule](IsValidServerRule): Verilen sunucu kuralının geçerli olup olmadığını kontrol eder.
| openmultiplayer/web/docs/translations/tr/scripting/functions/AddServerRule.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/tr/scripting/functions/AddServerRule.md",
"repo_id": "openmultiplayer",
"token_count": 509
} | 449 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.