text stringlengths 1 2.83M | id stringlengths 16 152 | metadata dict | __index_level_0__ int64 0 949 |
|---|---|---|---|
---
título: OnPlayerGiveDamage
descripción: Este callback se llama cuando un jugador le hace daño a otro jugador.
tags: ["player"]
---
## Descripción
Este callback se llama cuando un jugador le hace daño a otro jugador.
| Nombre | Descripción |
| --------- | -------------------------------------------------------------------------------------------------------------------- |
| playerid | El ID del jugador que hizo daño. |
| damagedid | El ID del jugador que recibió daño. |
| Float:amount | La cantidad de chaleco/vida que el jugador dañado perdió (combinados). |
| WEAPON:weaponid | La razón (arma/causa) que causó el daño. |
| bodypart | La parte del cuerpo que fue golpeada. |
## 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 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 le hizo %.0f de daño a %s, arma: %s, parte del cuerpo: %d", attacker, amount, victim, weaponname,bodypart);
SendClientMessageToAll(0xFFFFFFFF, string);
return 1;
}
```
## Notas
:::tip
Tener en cuenta que esta funcion puede ser imprecisa en algunos casos. Si lo que buscás es prevenir a ciertos jugadores de dañarse entre sí, usá SetPlayerTeam. 'weaponid' va a retornar 37 (lanzallamas) de cualquier origen de fuego (ej. molotov, 18), 'weaponid' retornará 51 ante cualquier arma que cree una explosión (ej. lanzamisiles, granada). playerid es el único que puede llamar este callback. La cantidad de daño es siempre el daño máximo que el weaponid puede hacer, incluso cuando la vida restante es menor que el daño máximo de esta. Entonces cuando un jugador tiene 100.0 de salud y recibe un tiro con una Desert Eagle que tiene un valor de daño de 46.2, tomará 3 disparos para matar a ese jugador. Los 3 disparos mostrarán una cantidad de daño de 46.2 sin importar que cuando el último disparo impacta, el jugador tiene sólo 7.6 de salud restante.
:::
| openmultiplayer/web/docs/translations/es/scripting/callbacks/OnPlayerGiveDamage.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/es/scripting/callbacks/OnPlayerGiveDamage.md",
"repo_id": "openmultiplayer",
"token_count": 1220
} | 380 |
---
título: OnPlayerStreamOut
descripción: Este callback se llama cuando un jugador se deja de cargar (ya no es visible) por el cliente de algún otro jugador.
tags: ["player"]
---
## Descripción
Este callback se llama cuando un jugador se deja de cargar (ya no es visible) por el cliente de algún otro jugador.
| Nombre | Descripción |
| ----------- | ----------------------------------------------- |
| playerid | El jugador al que se lo dejó de cargar. |
| forplayerid | El jugador que dejó de cargar al otro jugador. |
## Devoluciones
Siempre se llama primero en filterscripts.
## Ejemplos
```c
public OnPlayerStreamOut(playerid, forplayerid)
{
new string[80];
format(string, sizeof(string), "Tu computadora acaba de dejar de cargar al jugador ID %d", playerid);
SendClientMessage(forplayerid, 0xFF0000FF, string);
return 1;
}
```
## Notas
<TipNPCCallbacksES />
## Funciones Relacionadas
| openmultiplayer/web/docs/translations/es/scripting/callbacks/OnPlayerStreamOut.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/es/scripting/callbacks/OnPlayerStreamOut.md",
"repo_id": "openmultiplayer",
"token_count": 382
} | 381 |
---
título: OnVehicleSpawn
descripción: Este callback se llama cuando un vehículo reaparece.
tags: ["vehicle"]
---
:::warning
Este callback se llama **solo** cuando el vehículo **re**aparece! CreateVehicle y AddStaticVehicle(Ex) **no van** a desencadenar este callback.
:::
## Descripción
Este callback se llama cuando un vehículo reaparece.
| Name | Description |
| --------- | ----------------------------------- |
| vehicleid | El ID del vehículo que spawneo. |
## 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 OnVehicleSpawn(vehicleid)
{
printf("El vehículo %i spawneó!",vehicleid);
return 1;
}
```
## Funciones Relacionadas
- [SetVehicleToRespawn](../functions/SetVehicleToRespawn): Reaparecer un vehículo.
- [CreateVehicle](../functions/CreateVehicle): Crear un vehículo.
| openmultiplayer/web/docs/translations/es/scripting/callbacks/OnVehicleSpawn.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/es/scripting/callbacks/OnVehicleSpawn.md",
"repo_id": "openmultiplayer",
"token_count": 377
} | 382 |
---
title: OnPlayerDisconnect
description: وقتی بازیکن از سرور خارج می شود، این کالبک فراخوانی می شود.
tags: ["player"]
---
<div dir="rtl" style={{ textAlign: "right" }}>
## توضیحات
وقتی بازیکن از سرور خارج می شود، این کالبک فراخوانی می شود.
| پارامتر | توضیحات |
| -------- | -------------------------------------------------- |
| playerid | آیدی بازیکنی که از سرور خارج شده است. |
| reason | دلیل خارج شدن. جدول زیر را ببینید. |
## مقادیر بازگشتی
0 - فیلتر اسکریپتها را از دریافت این پاسخدهی جلوگیری میکند.
1 - این پاسخ به فیلتر اسکریپت بعدی ارسال می شود.
این کالبک همیشه اول در فیلتر اسکریپت ها تماس داده میشود.
## دلایل خروج (reason)
| کد | دلیل | جزئیات |
| -- | ------------- | ----------------------------------------------------------------------------------------- |
| 0 | تایم اوت/کرش | ارتباط بازیکن قطع شد یا بازی کرش خورد یا شبکه و اینترنت ایراد داشت. |
| 1 | خارج شدن | بازیکن با استفاده از دستور /q از بازی خارج شد یا از طریق منوی بازی. |
| 2 | اخراج/محروم | بازیکن توسط سرور اخراج یا محروم شد. |
| 3 | سفارشی | توسط برخی از کتابخانه ها استفاده می شود. مانند fixes.inc |
| 4 | حالت پایان | گیم مود فعلی در حال پایان است، بنابراین اتصال همه بازیکنان از آن قطع می شود (اما آنها هنوز در سرور هستند) |
:::warning
کد 3 در ابتدا توسط fixes.inc در SA-MP اضافه شد
کد های 3 و 4 توسط open.mp اضافه شد.
:::
## مثال ها
</div>
```c
public OnPlayerDisconnect(playerid, reason)
{
new
szString[64],
playerName[MAX_PLAYER_NAME];
GetPlayerName(playerid, playerName, MAX_PLAYER_NAME);
new szDisconnectReason[5][] =
{
"Timeout/Crash",
"Quit",
"Kick/Ban",
"Custom",
"Mode End"
};
format(szString, sizeof szString, "%s Az Server Kharej Shod (Dalil: %s).", playerName, szDisconnectReason[reason]);
SendClientMessageToAll(0xC4C4C4FF, szString);
return 1;
}
```
<div dir="rtl" style={{ textAlign: "right" }}>
## نکته ها
:::tip
برخی از تابع ها ممکن است هنگام استفاده در این کالبک به درستی کار نکنند چون ممکن است بازیکن قبلاً از بازی خارج شده است. این بدان معنی است که شما نمی توانید اطلاعات واضحی را از توابعی مانند GetPlayerIp و GetPlayerPos دریافت کنید.
:::
## کالبک های مرتبط
کالبک های زیر ممکن است مفید باشند، زیرا به هر طریقی با این کالبک مرتبط هستند.
- [OnPlayerConnect](OnPlayerConnect): این کالبک زمانی فراخوانی می شود که بازیکن به سرور متصل شود.
- [OnIncomingConnection](OnIncomingConnection): این کالبک زمانی فراخوانی می شود که یک بازیکن در حال تلاش برای اتصال به سرور است.
- [OnPlayerFinishedDownloading](OnPlayerFinishedDownloading): زمانی که بازیکن دانلود مدل های سفارشی را تمام می کند، این کالبک فراخوانی می شود.
</div>
| openmultiplayer/web/docs/translations/fa/scripting/callbacks/OnPlayerDisconnect.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/fa/scripting/callbacks/OnPlayerDisconnect.md",
"repo_id": "openmultiplayer",
"token_count": 2268
} | 383 |
---
title: OnClientCheckResponse
description: Tinatawag ang callback na ito kapag nakumpleto ang request sa SendClientCheck
tags: []
---
## Description
Tinatawag ang callback na ito kapag nakumpleto ang request sa SendClientCheck
| Name | Description |
| ------------- | --------------------------------- |
| playerid | Ang ID ng player na i-checheck |
| actionid | Ang uri ng pag-checheck na ginawa.|
| memaddr | Ang address requested. |
| retndata | Ang resulta ng pag check |
## Returns
Palaging una itong tinatawag sa mga filterscript.
## Examples
```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;
}
```
## Notes
:::warning
**SA:MP Server**: Ang callback na ito ay tinatawag lamang kapag ito ay nasa isang filterscript.
**Open Multiplayer Server**: Ang callback na ito ay normal na gumagana sa loob ng isang gamemode / filterscript.
:::
## Related Functions
Maaaring maging kapaki-pakinabang ang sumusunod na function, dahil nauugnay ang mga ito sa callback na ito sa isang paraan o iba pa.
- [SendClientCheck](../functions/SendClientCheck): Magsagawa ng memory check sa client. | openmultiplayer/web/docs/translations/fil/scripting/callbacks/OnClientCheckResponse.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/fil/scripting/callbacks/OnClientCheckResponse.md",
"repo_id": "openmultiplayer",
"token_count": 548
} | 384 |
---
title: OnObjectMoved
description: This callback is called when an object is moved after MoveObject (when it stops moving).
tags: []
---
## Description
Ang callback na ito ay itinatawag kapag ang object ay iginalaw pagkatapos ang MoveObject (kapag natapos na itong gumalaw).
| Name | Description |
| -------- | ----------------------------------- |
| objectid | Ang ID ng object na iginalaw |
## Returns
Palagi itong tinatawag una sa mga filterscripts.
## Examples
```c
public OnObjectMoved(objectid)
{
printf("Ang object id %d ay natapos nang gumalaw.", objectid);
return 1;
}
```
## Mga Dapat Unawain
:::tip
Ang SetObjectPos ay hindi gumagana kapag ginamit sa callback na ito. Upang ito'y maayos, gawin muli o i-recreate ang object.
:::
## Mga Kaugnay na Functions
- [MoveObject](../functions/MoveObject.md): Galawin ang isang Object.
- [MovePlayerObject](../functions/MovePlayerObject.md): Galawin ang isang player Object.
- [IsObjectMoving](../functions/IsObjectMoving.md): Tignan kapag ang object ay gumagalaw.
- [StopObject](../functions/StopObject.md): Tigilan ang isang object sa paggalaw.
- [OnPlayerObjectMoved](../callbacks/OnPlayerObjectMoved.md): Itinatawag kapag ang isang player object ay tumigil sa paggalaw.
| openmultiplayer/web/docs/translations/fil/scripting/callbacks/OnObjectMoved.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/fil/scripting/callbacks/OnObjectMoved.md",
"repo_id": "openmultiplayer",
"token_count": 454
} | 385 |
---
title: OnVehicleStreamIn
description: Ang callback na ito ay tinatawag kapag ang isang sasakyan ay na-stream sa client ng isang manlalaro.
tags: ["vehicle"]
---
## Description
Ang callback na ito ay tinatawag kapag ang isang sasakyan ay na-stream sa client ng isang manlalaro.
| Name | Description |
| ----------- | ------------------------------------------------------ |
| vehicleid | Ang ID ng sasakyan na nag-stream para sa player. |
| forplayerid | Ang ID ng player kung saan nag-stream ang sasakyan. |
## Returns
Palaging una itong tinatawag sa mga filterscript.
## Examples
```c
public OnVehicleStreamIn(vehicleid, forplayerid)
{
new string[32];
format(string, sizeof(string), "You can now see vehicle %d.", vehicleid);
SendClientMessage(forplayerid, 0xFFFFFFFF, string);
return 1;
}
```
## Notes
<TipNPCCallbacks />
## Related Callbacks
- [OnVehicleStreamOut](OnVehicleStreamOut): Tinatawag ang callback na ito kapag nag-stream out ang isang sasakyan para sa isang player.
- [OnPlayerStreamIn](OnPlayerStreamIn): Tinatawag ang callback na ito kapag nag-stream ang isang manlalaro para sa isa pang manlalaro.
- [OnPlayerStreamOut](OnPlayerStreamOut): Tinatawag ang callback na ito kapag nag-stream out ang isang player para sa isa pang player. | openmultiplayer/web/docs/translations/fil/scripting/callbacks/OnVehicleStreamIn.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/fil/scripting/callbacks/OnVehicleStreamIn.md",
"repo_id": "openmultiplayer",
"token_count": 485
} | 386 |
---
title: EnablePlayerCameraTarget
description: I-toggle ang mga function sa pag-target ng camera para sa isang player.
tags: ["player"]
---
<VersionWarn version='SA-MP 0.3.7' />
## Description
I-toggle ang mga function sa pag-target ng camera para sa isang player. Naka-disable bilang default para makatipid ng bandwidth.
| Name | Description |
| -------- | -------------------------------------------------------------- |
| playerid | Ang ID ng player upang i-toggle ang mga function ng pag-target sa camera.|
| enable | 1 upang paganahin ang mga function ng pag-target sa camera at 0 upang i-disable ang mga ito.|
## Returns
1: Matagumpay na naisakatuparan ang function.
0: Nabigo ang function na isagawa. Hindi konektado ang player.
## Examples
```c
public OnPlayerConnect(playerid)
{
EnablePlayerCameraTarget(playerid, 1);
return 1;
}
```
## Related Functions
- [GetPlayerCameraTargetVehicle](GetPlayerCameraTargetVehicle): Kunin ang ID ng sasakyang tinitingnan ng player.
- [GetPlayerCameraTargetPlayer](GetPlayerCameraTargetPlayer): Kunin ang ID ng player na tinitingnan ng player.
- [GetPlayerCameraFrontVector](GetPlayerCameraFrontVector): Kunin ang camera front vector ng player | openmultiplayer/web/docs/translations/fil/scripting/functions/EnablePlayerCameraTarget.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/fil/scripting/functions/EnablePlayerCameraTarget.md",
"repo_id": "openmultiplayer",
"token_count": 409
} | 387 |
---
title: GetPlayerVehicleSeat
description: Find out which seat a player is in.
tags: ["player", "vehicle"]
---
## Paglalarawan
Alamin kung nasaang upuan nakaupo ang manlalaro.
| Name | Description |
| -------- | --------------------------------------------------- |
| playerid | Ang ID ng manlalaro na gusto mong makuha ang upuan. |
## Returns
- Ang ID ng upuan na kinaroroonan ng manlalaro. -1 ay wala sa sasakyan, 0 ang driver, 1 ang pasahero sa harap, at 2 & 3 ang mga pasahero sa likuran.
## Halimbawa ng Paggamit
```c
if (strcmp(cmdtext, "/myseat", true) == 0)
{
new
playerSeat = GetPlayerVehicleSeat(playerid);
// Paano mo maitatanggal ang iyong impormasyon.
if (playerSeat == 128)
{
return SendClientMessage(playerid, 0xFFFFFFFF, "Isang error ang pumigil sa amin na ireturn ang ID ng upuan.");
}
new
message[14];
format(message, sizeof(message), "Ang iyong upuan: %i", playerSeat);
SendClientMessage(playerid, 0xFFFFFFFF, message);
return 1;
}
```
## Mga Kaugnay na Functions
Maaaring makatulong ang mga sumusunod na function habang nauugnay ang mga ito sa function na ito sa isang paraan o sa iba pa.
- [GetPlayerVehicleID](./GetPlayerVehicleID): Kunin ang ID ng sasakyan kung saan nakasakay ang manlalaro.
- [PutPlayerInVehicle](./PutPlayerInVehicle): Maglagay ng manlalaro sa isang sasakyan.
| openmultiplayer/web/docs/translations/fil/scripting/functions/GetPlayerVehicleSeat.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/fil/scripting/functions/GetPlayerVehicleSeat.md",
"repo_id": "openmultiplayer",
"token_count": 563
} | 388 |
---
title: SetTeamCount
description: Ginagamit ang function na ito upang baguhin ang dami ng mga team na ginamit sa gamemode.
tags: []
---
## Description
Ginagamit ang function na ito upang baguhin ang dami ng mga team na ginamit sa gamemode. Wala itong malinaw na paraan ng paggamit, ngunit makakatulong upang ipahiwatig ang bilang ng mga koponan na ginamit para sa mas mahusay (mas epektibo) panloob na paghawak. Ang function na ito ay dapat lamang gamitin sa OnGameModeInit callback. Mahalaga: Maaari kang pumasa ng 2 bilyon dito kung gusto mo, walang epekto ang function na ito.
| Name | Description |
| ----- | ----------------------------------- |
| teams | Bilang ng mga koponan na alam ng gamemode.|
## Returns
Ang function na ito ay hindi nagbabalik ng anumang value.
## Examples
```c
public OnGameModeInit( )
{
// Gumagamit kami ng 18 team sa paggamit na ito ng Team-Deathmatch mode, tukuyin ito;
SetTeamCount(18);
return 1;
}
```
## Related Functions
- [GetPlayerTeam](GetPlayerTeam): Suriin kung nasaang koponan ang isang manlalaro.
- [SetPlayerTeam](SetPlayerTeam): Magtakda ng koponan ng manlalaro. | openmultiplayer/web/docs/translations/fil/scripting/functions/SetTeamCount.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/fil/scripting/functions/SetTeamCount.md",
"repo_id": "openmultiplayer",
"token_count": 435
} | 389 |
---
title: floatlog
description: Binibigyang-daan ka ng function na ito na makuha ang logarithm ng isang float value.
tags: ["math", "floating-point"]
---
<LowercaseNote />
## Description
Binibigyang-daan ka ng function na ito na makuha ang logarithm ng isang float value.
| Name | Description |
| ----------- | ---------------------------------------- |
| Float:value | Ang value kung saan makukuha ang logarithm. |
| Float:base | Ang logarithm base. |
## Returns
Ang logarithm bilang isang float value.
## Examples
```c
public OnGameModeInit()
{
printf("The logarithm of 15.0 with the base 10.0 is %f", floatlog( 15.0, 10.0 ));
return 1;
}
```
## Related Functions
- [floatsqroot](floatsqroot): Kalkulahin ang square root ng isang floating point value.
- [floatpower](floatpower): Nagtataas ng ibinigay na halaga sa isang kapangyarihan ng exponent. | openmultiplayer/web/docs/translations/fil/scripting/functions/floatlog.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/fil/scripting/functions/floatlog.md",
"repo_id": "openmultiplayer",
"token_count": 354
} | 390 |
---
title: OnActorStreamIn
description: Cette fonction est appelée quand un actor est chargé (devient visible) pour un joueur.
tags: [actors, actorstream, forplayerid, actorid]
---
<VersionWarn name='callback' version='SA-MP 0.3.7' />
## Paramètres
Cette fonction est appelée quand un actor est chargé _(devient visible)_ pour un joueur.
| Nom | Description |
| ----------- | ------------------------------------------- |
| `int` actorid | ID de l'actor chargé par le joueur |
| `int` forplayerid | ID du joueur qui charge l'actor (`actorid`) |
## 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 OnActorStreamIn(actorid, forplayerid)
{
new string[40];
format(string, sizeof(string), "L'acteur %d est maintenant stream par vous.", actorid);
SendClientMessage(forplayerid, 0xFFFFFFFF, string);
return 1;
}
```
## Astuces
<TipNPCCallbacks />
## Fonctions connexes
| openmultiplayer/web/docs/translations/fr/scripting/Callbacks/OnActorStreamIn.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/fr/scripting/Callbacks/OnActorStreamIn.md",
"repo_id": "openmultiplayer",
"token_count": 459
} | 391 |
---
title: OnNPCModeInit
description: Ce rappel est appelé lorsque le script d'un PNJ est chargé.
tags: ["npc"]
---
## Description
Ce rappel est appelé lorsque le script d'un PNJ est chargé.
## Exemples
```c
public OnNPCModeInit()
{
print("Le script du PNJ a été chargé.");
return 1;
}
```
## Rappels Relatives
Les rappels suivants peuvent être utiles, car ils sont liés à ce rappel d'une manière ou d'une autre.
- [OnNPCModeExit](OnNPCModeExit): Ce rappel est appelé lorsque le script d'un PNJ est déchargé.
| openmultiplayer/web/docs/translations/fr/scripting/Callbacks/OnNPCModeInit.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/fr/scripting/Callbacks/OnNPCModeInit.md",
"repo_id": "openmultiplayer",
"token_count": 210
} | 392 |
---
title: OnPlayerEnterCheckpoint
description: Cette callback est appelée quand un joueur est entré dans un checkpoint.
tags: ["player", "checkpoint"]
---
## Paramètres
Cette callback est appelée quand un joueur est entré dans un checkpoint.
| Nom | Description |
| -------------- | ------------------------------------------ |
| `int` playerid | Le joueur qui est entré dans le checkpoint |
## 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
// Dans cet exemple, un checkpoint est créé pour un joueur lorsqu'il spawn,
// lequel va faire spawn un véhicule et ensuite disparaître.
public OnPlayerSpawn(playerid)
{
SetPlayerCheckpoint(playerid, 1982.6150, -220.6680, -0.2432, 3.0);
return 1;
}
public OnPlayerEnterCheckpoint(playerid)
{
CreateVehicle(520, 1982.6150, -221.0145, -0.2432, 82.2873, -1, -1, 60000);
DisablePlayerCheckpoint(playerid);
return 1;
}
```
## Astuces
<TipNPCCallbacks />
## Fonctions connexes
- [SetPlayerCheckpoint](../functions/SetPlayerCheckpoint): Créer un checkpoint pour un joueur.
- [DisablePlayerCheckpoint](../functions/DisablePlayerCheckpoint): Désactive le checkpoint du joueur.
- [IsPlayerInCheckpoint](../functions/IsPlayerInCheckpoint): Vérifie si un joueur est dans un checkpoint.
- [SetPlayerRaceCheckpoint](../functions/SetPlayerRaceCheckpoint): Créer un race checkpoint pour le joueur.
- [DisablePlayerRaceCheckpoint](../functions/DisablePlayerRaceCheckpoint): Désactive le race checkpoint du joueur.
- [IsPlayerInRaceCheckpoint](../functions/IsPlayerInRaceCheckpoint): Vérifie si un joueur est dans un race checkpoint.
| openmultiplayer/web/docs/translations/fr/scripting/Callbacks/OnPlayerEnterCheckpoint.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/fr/scripting/Callbacks/OnPlayerEnterCheckpoint.md",
"repo_id": "openmultiplayer",
"token_count": 650
} | 393 |
---
title: OnPlayerPickUpPlayerPickup
description: Ce rappel est appelé lorsqu'un joueur ramasse un objet joueur-pickup créé avec CreatePlayerPickup.
tags: ["player", "pickup", "playerpickup"]
---
<VersionWarn name='callback' version='omp v1.1.0.2612' />
## Description
Ce rappel est appelé lorsqu'un joueur ramasse un objet joueur-pickup créé avec [CreatePlayerPickup](../functions/CreatePlayerPickup).
| Nom | Description |
|----------|------------------------------------------------------------------------------------------------|
| playerid | L'ID du joueur qui a ramassé l'objet joueur-pickup. |
| pickupid | L'ID de l'objet joueur-pickup, retourné par [CreatePlayerPickup](../functions/CreatePlayerPickup) |
## Retours
Il est toujours appelé en premier dans le gamemode.
## Exemples
```c
new player_pickup_Cash[MAX_PLAYERS];
new player_pickup_Health[MAX_PLAYERS];
public OnPlayerConnect(playerid)
{
player_pickup_Cash[playerid] = CreatePlayerPickup(playerid, 1274, 2, 2009.8658, 1220.0293, 10.8206, -1);
player_pickup_Health[playerid] = CreatePlayerPickup(playerid, 1240, 2, 2009.8474, 1218.0459, 10.8175, -1);
return 1;
}
public OnPlayerPickUpPlayerPickup(playerid, pickupid)
{
if (pickupid == player_pickup_Cash[playerid])
{
GivePlayerMoney(playerid, 1000);
}
else if (pickupid == player_pickup_Health[playerid])
{
SetPlayerHealth(playerid, 100.0);
}
return 1;
}
```
## Rappels Relatives
Les rappels suivants peuvent être utiles, car ils sont liés à ce rappel d'une manière ou d'une autre.
- [OnPlayerPickupStreamIn](OnPlayerPickupStreamIn): Appelé lorsque qu'un objet joueur-pickup entre dans la portée visuelle du joueur.
- [OnPlayerPickupStreamOut](OnPlayerPickupStreamOut): Appelé lorsque qu'un objet joueur-pickup quitte la portée visuelle du joueur.
## Fonctions Relatives
Les fonctions suivantes peuvent être utiles, car elles sont liées à ce rappel d'une manière ou d'une autre.
- [CreatePlayerPickup](../functions/CreatePlayerPickup): Crée un objet joueur-pickup qui sera visible pour un seul joueur.
- [DestroyPlayerPickup](../functions/DestroyPlayerPickup): Destroy a player-pickup.
| openmultiplayer/web/docs/translations/fr/scripting/Callbacks/OnPlayerPickUpPlayerPickup.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/fr/scripting/Callbacks/OnPlayerPickUpPlayerPickup.md",
"repo_id": "openmultiplayer",
"token_count": 925
} | 394 |
---
title: OnRconCommand
description: Cette callback est appelée lorsqu'une commande est exécutée dans la console, ou via le jeu avec les commandes RCON.
tags: []
---
## Paramètres
Cette callback est appelée lorsqu'une commande est exécutée dans la console, ou via le jeu avec les commandes RCON
| Nom | Description |
| -------------- | -----------------------------------------|
| `string` cmd[] | Une chaîne contenant la commande écrite. |
## Valeur de retour
- **0** si la commande n'a pas été exécutée, le script sera aussi exécuté sur les filterscripts.
- **1** si la commande a été exécutée, elle ne sera pas envoyée aux autres scripts.
## Exemples
```c
public OnRconCommand(cmd[])
{
printf("[RCON]: Vous avez écrit '/rcon %s'!", cmd);
return 0;
}
```
```c
public OnRconCommand(cmd[])
{
if(!strcmp(cmd, "bonjour", true))
{
SendClientMessageToAll(0xFFFFFFAA, "Bonjour tous le monde!!");
print("Vous avez envoyé un message de bonjour à tous les joueurs!");
return 1;
}
return 0;
}
```
## Astuces
:::tip
/rcon n'est pas inclut dans `cmd` lorsqu'un joueur tape la commande.
Si vous utilisez la fonction `printf` dans cette callback, un message sera envoyé au joueur qui a tapé la commande dans le jeu, et dans les logs.
:::
:::warning
Vous devez inclure cette callback dans un filterscript chargé pour qu'elle marche dans le gamemode!
:::
## Fonction connexe
- [IsPlayerAdmin](../functions/IsPlayerAdmin): Vérifie si un joueur est loggé en RCON.
## Callback connexe
- [OnRconLoginAttempt](OnRconLoginAttempt): Appelée lorsqu'un joueur essaie de se connecter en RCON.
| openmultiplayer/web/docs/translations/fr/scripting/Callbacks/OnRconCommand.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/fr/scripting/Callbacks/OnRconCommand.md",
"repo_id": "openmultiplayer",
"token_count": 676
} | 395 |
---
title : AddMenuItem
description: ajoute un élément à un menu spécifié.
tags: ["menu"]
---
## Description
Ajoute un élément à un menu spécifié.
| Nom | Descriptif |
| ------- | ------------------------------------------------ |
| menuid | L'identifiant du menu auquel ajouter un élément. |
| column | La colonne à laquelle ajouter l'élément. |
| title[] | Titre du nouvel élément de menu. |
## Retour
L'index de la ligne à laquelle cet élément a été ajouté.
## Exemples
```c
new Menu:gExampleMenu;
public OnGameModeInit()
{
gExampleMenu = CreateMenu("Votre menu", 2, 200.0, 100.0, 150.0, 150.0);
AddMenuItem(gExampleMenu, 0, "item 1");
AddMenuItem(gExampleMenu, 0, "item 2");
return 1;
}
```
## Remarques
:::tip
Crash lors de la transmission d'un ID de menu non valide. Vous ne pouvez avoir que 12 éléments par menu (le 13e va à droite de l'en-tête du nom de la colonne (en couleur), le 14e et les suivants ne s'affichent pas du tout). Vous ne pouvez utiliser que 2 colonnes (0 et 1). Vous ne pouvez ajouter que 8 codes de couleur par article (~r~, ~g~ etc.). La longueur maximale de l'élément de menu est de 31 symboles.
:::
## Fonctions associées
- [CreateMenu](CreateMenu): Créer un menu.
- [SetMenuColumnHeader](SetMenuColumnHeader): définit l'en-tête d'une des colonnes d'un menu.
- [DestroyMenu](DestroyMenu): Détruit un menu.
- [OnPlayerSelectedMenuRow](../callbacks/OnPlayerSelectedMenuRow): Appelé lorsqu'un joueur sélectionne une ligne dans un menu.
- [OnPlayerExitedMenu](../callbacks/OnPlayerExitedMenu): Appelé lorsqu'un joueur quitte un menu.
| openmultiplayer/web/docs/translations/fr/scripting/functions/AddMenuItem.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/fr/scripting/functions/AddMenuItem.md",
"repo_id": "openmultiplayer",
"token_count": 662
} | 396 |
---
title: GameModeExit
description: Leállítja a jelenlegi játékmódot
tags: []
---
## Leírás
Leállítja a jelenlegi játékmódot
## Példák
```c
if (OneTeamHasWon)
{
GameModeExit();
}
```
| openmultiplayer/web/docs/translations/hu/scripting/funcitons/GameModeExit.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/hu/scripting/funcitons/GameModeExit.md",
"repo_id": "openmultiplayer",
"token_count": 101
} | 397 |
---
title: OnFilterScriptInit
description: Callback ini akan terpanggil ketika gamemode sedang diinialisasi (dimuat).
tags: []
---
## Deskripsi
Callback ini akan terpanggil ketika filterscript sedang diinialisasi (dimuat). Ini hanya terpanggil di dalam filterscript yang akan dimuat.
## Contoh
```c
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Filterscript berhasil dimuat.");
print("--------------------------------------\n");
return 1;
}
```
## Fungsi Terkait
| openmultiplayer/web/docs/translations/id/scripting/callbacks/OnFilterScriptInit.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/id/scripting/callbacks/OnFilterScriptInit.md",
"repo_id": "openmultiplayer",
"token_count": 179
} | 398 |
---
title: OnPlayerExitVehicle
description: Callback ini di panggil ketika pemain mulai keluar dari kendaraan.
tags: ["player", "vehicle"]
---
## Deskripsi
Callback ini di panggil ketika pemain mulai keluar dari kendaraan.
| Nama | Deskripsi |
| --------- | ----------------------------------------------- |
| playerid |
ID pemain yang keluar dari kendaraan. |
| vehicleid |
ID kendaraan pemain yang keluar. |
## Returns
Ini selalu di panggil pertama dalam filtersciprt.
## Contoh
```c
public OnPlayerExitVehicle(playerid, vehicleid)
{
new string[35];
format(string, sizeof(string), "INFO: Kamu keluar dari kendaraan %i", vehicleid);
SendClientMessage(playerid, 0xFFFFFFFF, string);
return 1;
}
```
## Catatan
:::warning
Tidak di panggil jika pemain jatuh dari sepeda atau dikeluarkan dari kendaraan dengan cara lain seperti menggunakan SetPlayerPos. Anda harus menggunakan OnPlayerStateChange dan memeriksa apakah status lama mereka adalah PLAYER_STATE_DRIVER atau PLAYER_STATE_PASSENGER dan status baru mereka adalah PLAYER_STATE_ONFOOT.
:::
## Fungsi Terkait
- [RemovePlayerFromVehicle](../functions/RemovePlayerFromVehicle): Mengeluarkan pemain dari kendaraan mereka.
- [GetPlayerVehicleSeat](../functions/GetPlayerVehicleSeat): Memeriksa di kursi mana seorang pemain berada.
| openmultiplayer/web/docs/translations/id/scripting/callbacks/OnPlayerExitVehicle.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/id/scripting/callbacks/OnPlayerExitVehicle.md",
"repo_id": "openmultiplayer",
"token_count": 531
} | 399 |
---
title: Ban
description: Melarang player yang sedang berada di dalam server.
tags: ["administration"]
---
## Deskripsi
Melarang player yang sedang berada di dalam server. Player tersebut tidak bisa bergabung lagi selamanya. Pelarangan pemain berbasis IP ini akan disimpan di dalam format file samp.ban di dalam direktori root server. BanEx dapat digunakan untuk memberi alasan mengapa player tersebut di ban. IP ban dapat di tambah/di hapus menggunakan command RCON banip dan unbanip (SendRconCommand).
| Nama | Deskripsi |
| -------- | -------------------------------------- |
| playerid | ID player yang ingin dilarang bermain. |
## Returns
Fungsi ini tidak me-return value yang spesifik.
## Contoh
```c
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp(cmdtext, "/banme", true) == 0)
{
// Ban player yang menggunakan command ini.
Ban(playerid);
return 1;
}
}
// 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.
forward DelayedBan(playerid);
public DelayedBan(playerid)
{
Ban(playerid);
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp(cmdtext, "/banme", true) == 0)
{
// Ban player yang menggunakan command ini.
// Pertama, kirim player nya sebuah pesan.
SendClientMessage(playerid, 0xFF0000FF, "Anda telah di banned!");
// Mem-ban player nya sedetik kemudian menggunakan timer.
SetTimerEx("DelayedBan", 1000, false, "d", playerid);
return 1;
}
return 0;
}
```
## Notes
:::warning
Tindakan apa pun yang diambil langsung sebelum Ban() (seperti mengirim pesan dengan SendClientMessage) tidak akan sampai ke player. Timer harus digunakan untuk menunda ban.
:::
## Fungsi Terkait
- [BanEx](BanEx): Melarang player dengan alasan.
- [Kick](Kick): Kick player dari server.
| openmultiplayer/web/docs/translations/id/scripting/functions/Ban.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/id/scripting/functions/Ban.md",
"repo_id": "openmultiplayer",
"token_count": 819
} | 400 |
---
title: SetWeather
description: Mengatur cuaca untuk semua player.
tags: []
---
## Deskripsi
Mengatur cuaca untuk semua player.
| Nama | Deskripsi |
| --------- | ------------------------------------------------ |
| weatherid | ID [cuaca](../resources/weatherid)|
## Returns
Fungsi ini tidak mengembalikan nilai tertentu.
## Contoh
```c
if (!strcmp(cmdtext, "/sandstorm", true))
{
SetWeather(19);
return 1;
}
```
## Catatan
:::tip
Jika TogglePlayerClock menyala, Cuaca perlahan-lahan akan berubah dari waktu ke waktu, alih alih berubah secara instant. Hanya ada 21 ID cuaca yang valid dalam game (0 - 20), Namun game tidak memiliki bentuk cek jangkauan.
:::
## Fungsi Terkait
- [SetPlayerWeather](SetPlayerWeather): Set cuaca untuk player.
- [SetGravity](SetGravity): Set global gravitasi.
| openmultiplayer/web/docs/translations/id/scripting/functions/SetWeather.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/id/scripting/functions/SetWeather.md",
"repo_id": "openmultiplayer",
"token_count": 334
} | 401 |
---
title: Server variable system
description: Server variable system (disingkat, SVar) adalah cara baru untung membuat server variabel dalam cara mudah membuat method yang efisien, dengan begitu cara ini bisa dipakai di gamemode server dan filterscripts dalam waktu bersamaan.
---
**Server variable system** (disingkat, **SVar**) adalah cara baru untung membuat server variabel dalam cara mudah membuat method yang efisien, dengan begitu cara ini bisa dipakai di gamemode server dan filterscripts dalam waktu bersamaan.
Sistem ini mirip seperti [PVars](perplayervariablesystem), tetapi tidak terikat player ID.
:::warning
Sistem ini dikenalkan pada SA-MP 0.3.7 R2-1 dan tidak akan bisa berjalan pada versi dibawahnya!
:::
:::note
Sistem SVar ini mirip seperti PVars, tetapi variabel dibuat secara keseluruhan server, tidak terikat pada semua player ID, dan akan tetap sampai gamemode berganti.
:::
## Keuntungan
- SVars dapat di bagi/akses seluruh skrip gamemode dan filterscripts.
- Anda bisa dengan mudahnya menghitung dan menyimpan daftar SVar. Dengan ini memudahkan proses debugging.
- Walaupun SVar belum dibuat sama sekali, nilainya akan kembali ke nilai default yaitu 0.
- SVars dapat menampung string yang sangat besar menggunakan memori yang dialokasikan secara dinamis.
- Anda dapat Set, Get, dan Create SVars ingame.
## Kekurangan
- SVars lebih lambat dari variabel regular. Secara umum lebih menguntungkan untuk mengoptimalisasi memori untuk kecepatan, daripada sebaliknya.
## Fungsi yang Berelasi
- [SetSVarInt](../scripting/functions/SetSVarInt): mengatur sebuah nilai integer didalam variabel server.
- [GetSVarInt](../scripting/functions/GetSVarInt): mengambil nilai pemain yang sedang bermain dala bentuk integer.
- [SetSVarString](../scripting/functions/SetSVarString): mengatur sebuah nilai string didalam variabel server.
- [GetSVarString](../scripting/functions/GetSVarString): mengambil nilai yang sebelumnya telah diatur stringnya di dalam variabel server.
- [SetSVarFloat](../scripting/functions/SetSVarFloat): mengatur sebuah nilai float didalam server variabel.
- [GetSVarFloat](../scripting/functions/GetSVarFloat): mengambil nilai yang sebelumnya telah diatur floatnya di dalam variabel server.
- [DeleteSVar](../scripting/functions/DeleteSVar): hapus sebuah variabel server.
| openmultiplayer/web/docs/translations/id/tutorials/servervariablesystem.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/id/tutorials/servervariablesystem.md",
"repo_id": "openmultiplayer",
"token_count": 839
} | 402 |
---
title: AllowInteriorWeapons
description: Przełącza możliwość używania broni we wnętrzach.
tags: []
---
## Opis
Przełącza możliwość używania broni we wnętrzach.
| Nazwa | Opis |
| ----- | ---------------------------------------------------------------------------- |
| allow | 1 - włącza bronie we wnętrzach (domyślnie), 0 - wyłącza bronie we wnętrzach. |
## Zwracane wartości
Ta funkcja nie zwraca żadnych konkretnych wartości.
## Przykłady
```c
public OnGameModeInit()
{
// To zezwoli na bronie we wnętrzach.
AllowInteriorWeapons(1);
return 1;
}
```
## Uwagi
:::warning
Ta funkcja nie działa w aktualnej wersji SA:MP!
:::
## Powiązane funkcje
- [SetPlayerInterior](SetPlayerInterior.md): Ustawia graczowi wnętrze.
- [GetPlayerInterior](GetPlayerInterior.md): Pobiera aktualne wnętrze gracza.
- [OnPlayerInteriorChange](../callbacks/OnPlayerInteriorChange.md): Wywoływane, gdy gracz zmienia wnętrze.
| openmultiplayer/web/docs/translations/pl/scripting/functions/AllowInteriorWeapons.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/pl/scripting/functions/AllowInteriorWeapons.md",
"repo_id": "openmultiplayer",
"token_count": 496
} | 403 |
---
title: atan2
description: .
tags: []
---
<LowercaseNote />
:::warning
Zwróć uwagę, że wartość y jest pierwszym parametrem, a x drugim.
:::
## Opis
Podaje odwróconą wartość arcus tangensa z y/x w radianach.
| Nazwa | Opis |
| ------- | ---------------------------------------------- |
| Float:y | Wartość reprezentująca proporcję koordynatu Y. |
| Float:x | Wartość reprezentująca proporcję koordynatu X. |
## Zwracane wartości
Zwraca główną wartość arcus tangensa z y/x, wyrażoną w radianach.
Aby obliczyć tę wartość, funkcja bierze pod uwagę znak obu argumentów, aby określić kwadrant.
## Przykłady
```c
//Arcus tangens dla (x=-10.000000, y=10.000000) wynosi 135.000000 stopni.
public OnGameModeInit()
{
new Float:x, Float:y, Float:result;
x = -10.0;
y = 10.0;
result = atan2(y,x);
printf("Arcus tangens dlar (x=%f, y=%f) wynosi %f stopni.", x, y, result);
return 1;
}
```
## Powiązane funkcje
- [floatsin](floatsin.md): Podaje sinus dla określonego kąta.
- [floatcos](floatcos.md): Podaje cosinus dla określonego kąta.
- [floattan](floattan.md): Podaje tangens dla określonego kąta.
| openmultiplayer/web/docs/translations/pl/scripting/functions/atan2.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/pl/scripting/functions/atan2.md",
"repo_id": "openmultiplayer",
"token_count": 592
} | 404 |
---
title: OnGameModeExit
description: Esta callback é chamada quando uma gamemode finaliza, também através do 'gmx', do servidor ser desligado ou GameModeExit.
tags: []
---
## Descrição
Esta callback é chamada quando uma gamemode finaliza, também através do 'gmx', do servidor ser desligado ou GameModeExit.
## Exemplos
```c
public OnGameModeExit()
{
print("Gamemode Finalizada.");
return 1;
}
```
## Notas
:::tip
Esta função também pode ser usada em um filterscript para detectar se a gamemode mudou através de comandos do RCON como o "changemode" ou "gmx", pois mudar o gamemode não recarrega um filterscript. Quando usar OnGameModeExit em conjunto com o comando "rcon gmx" do console, mantenha em mente que há um potencial problema que pode acarretar em bugs para os clientes, um exemplo disso é as excessivas chamadas de "RemoveBuildingForPlayer" durante o OnGameModeInit que poderia resultar no crash do cliente. Esta callback não será chamada se o servidor crashar ou o processor ser finalizado por outros meios, como usando o comandos do Linux ou pressionando o botão de fechar no console do Windows.
:::
## Funções Relacionadas
- [GameModeExit](../functions/GameModeExit.md): Sair da atual gamemode.
| openmultiplayer/web/docs/translations/pt-BR/scripting/callbacks/OnGameModeExit.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/pt-BR/scripting/callbacks/OnGameModeExit.md",
"repo_id": "openmultiplayer",
"token_count": 432
} | 405 |
---
title: OnPlayerConnect
description: Esta callback é chamda quando um jogador conecta no servidor.
tags: ["player"]
---
## Descrição
Esta callback é chamda quando um jogador conecta no servidor.
| Nome | Descrição |
| -------- | ----------------------------- |
| playerid | O ID do jogador que conectou. |
## 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 OnPlayerConnect(playerid)
{
new
string[64],
playerName[MAX_PLAYER_NAME];
GetPlayerName(playerid, playerName, MAX_PLAYER_NAME);
format(string, sizeof string, "%s entrou no servidor!", playerName);
SendClientMessageToAll(0xFFFFFFAA, string);
return 1;
}
```
## Notas
<TipNPCCallbacksPT />
## Funções Relacionadas
| openmultiplayer/web/docs/translations/pt-BR/scripting/callbacks/OnPlayerConnect.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/pt-BR/scripting/callbacks/OnPlayerConnect.md",
"repo_id": "openmultiplayer",
"token_count": 346
} | 406 |
---
title: OnPlayerLeaveRaceCheckpoint
description: Esta callback é chamada quando um jogador sai de um checkpoint de corrida.
tags: ["player", "checkpoint", "racecheckpoint"]
---
## Descrição
Esta callback é chamada quando um jogador sai de um checkpoint de corrida
| Nome | Descrição |
| -------- | --------------------------------------- |
| playerid | O ID do jogador que saiu do checkpoint. |
## Retorno
É sempre chamado primeiro nos filterscripts.
## Examples
```c
public OnPlayerLeaveRaceCheckpoint(playerid)
{
printf("Player %d left a race checkpoint!", playerid);
return 1;
}
```
## Notes
<TipNPCCallbacksPT />
## Related Functions
- [SetPlayerCheckpoint](../functions/SetPlayerCheckpoint): Create a checkpoint for a player.
- [DisablePlayerCheckpoint](../functions/DisablePlayerCheckpoint): Disable the player's current checkpoint.
- [IsPlayerInCheckpoint](../functions/IsPlayerInRaceCheckpoint): Check if a player is in a checkpoint.
- [SetPlayerRaceCheckpoint](../functions/SetPlayerRaceCheckpoint): Create a race checkpoint for a player.
- [DisablePlayerRaceCheckpoint](../functions/DisablePlayerRaceCheckpoint): Disable the player's current race checkpoint.
- [IsPlayerInRaceCheckpoint](../functions/IsPlayerInRaceCheckpoint): Check if a player is in a race checkpoint.
| openmultiplayer/web/docs/translations/pt-BR/scripting/callbacks/OnPlayerLeaveRaceCheckpoint.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/pt-BR/scripting/callbacks/OnPlayerLeaveRaceCheckpoint.md",
"repo_id": "openmultiplayer",
"token_count": 406
} | 407 |
---
title: OnRecordingPlaybackEnd
description: Essa callback é executada quando uma gravação de NPC reproduzida com a função NPCStartRecordingPlayback finaliza sua reprodução.
tags: []
---
## Descrição
Essa callback é executada quando uma gravação de NPC reproduzida com a função NPCStartRecordingPlayback finaliza sua reprodução.
## Exemplos
```c
public OnRecordingPlaybackEnd()
{
StartRecordingPlayback(PLAYER_RECORDING_TYPE_DRIVER, "all_around_lv_bus"); //Isso fará com que o record seja iniciado novamente ao finalizar sua reprodução.
}
```
| openmultiplayer/web/docs/translations/pt-BR/scripting/callbacks/OnRecordingPlaybackEnd.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/pt-BR/scripting/callbacks/OnRecordingPlaybackEnd.md",
"repo_id": "openmultiplayer",
"token_count": 192
} | 408 |
---
title: AddSimpleModel
description: Adiciona um novo modelo de objeto simples personalizado para download.
tags: []
---
Esta função foi implementada no SA-MP 0.3.DL-R1 e não funcionará em versões anteriores.
## Descrição
Adiciona um novo modelo de objeto simples personalizado para download. Os arquivos do modelo são armazenados em Documentos\GTA San Andreas User Files\SAMP\cache do jogador sob a pasta IP e Porta do Servidor em um arquivo no formato CRC.
| Nome | Descrição |
| ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------ |
| virtualworld | O ID do mundo virtual ao qual pretende colocar o modelo. Use -1 para todos os mundos. |
| baseid | O ID do modelo do objeto original a ser usado como base (objeto original é usado se o download falhar). |
| newid | O ID do modelo do novo objeto. Varia entre -1000 a -30000 (29000 slots) para serem usados posteriormente com CreateObject ou CreatePlayerObject. |
| dffname | Nome do arquivo de extensão .dff localizado na pasta do servidor de modelos por padrão (configuração artpath). |
| txdname | Nome do arquivo de textura de extensão .txd localizado na pasta do servidor de modelos por padrão (configuração artpath). |
## Retorno
1: A função foi executada com sucesso.
0: Falha ao executar a função.
## Exemplos
```c
public OnGameModeInit()
{
AddSimpleModel(-1, 19379, -2000, "wallzzz.dff", "wallzzz.txd");
return 1;
}
```
```c
AddSimpleModel(-1, 19379, -2000, "wallzzz.dff", "wallzzz.txd");
```
## Notas
:::tip
"useartwork" deve ser habilitado primeiro nas configurações do servidor para que essa função funcione.
:::
:::warning
Atualmente não há restrições sobre quando você pode chamar esta função, mas esteja ciente de que se você não chamá-los dentro de OnFilterScriptInit ou OnGameModeInit, você corre o risco de que alguns jogadores, que já estão no servidor, não tenham baixado os modelos.
:::
## Funções Relacionadas
- [OnPlayerFinishedDownloading](../callbacks/OnPlayerFinishedDownloading.md): É chamada quando um jogador termina o download dos modelos personalizados.
| openmultiplayer/web/docs/translations/pt-BR/scripting/functions/AddSimpleModel.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/pt-BR/scripting/functions/AddSimpleModel.md",
"repo_id": "openmultiplayer",
"token_count": 1062
} | 409 |
---
title: ChangeVehicleColor
description: Altere a cor primária e secundária de um veículo.
tags: ["vehicle"]
---
## Descrição
Altere a cor primária e secundária de um veículo.
| Nome | Descrição |
| --------- | -------------------------------------------- |
| vehicleid | O ID do veículo cujas cores serão alteradas. |
| color1 | O ID da nova cor primária do veículo. |
| color2 | O ID da nova cor secundária do veículo. |
## Retorno
1: A função foi executada com sucesso. A cor do veículo foi alterada com sucesso.
0: A função falhou ao ser executada. O veículo não existe.
## Exemplos
```c
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
// Muda a cor primária para preto e a cor secundária para branco.
ChangeVehicleColor(vehicleid, 0, 1);
return 1;
}
```
## Notas
:::tip
Alguns veículos apenas possuem uma cor primária e outros não podem ter a cor alterada. Alguns (Cement, Squalo) têm 4 cores, das quais 2 não podem ser alteradas no SA:MP.
:::
## Funções Relacionadas
- [ChangeVehiclePaintjob](ChangeVehiclePaintjob.md): Mude o paintjob de um veículo.
- [OnVehicleRespray](../callbacks/OnVehicleRespray.md): É chamado quando um veículo é pintado (Pay'n'Spray).
| openmultiplayer/web/docs/translations/pt-BR/scripting/functions/ChangeVehicleColor.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/pt-BR/scripting/functions/ChangeVehicleColor.md",
"repo_id": "openmultiplayer",
"token_count": 525
} | 410 |
---
title: GangZoneStopFlashForAll
description: Pare uma Gangzone de piscar para todos os jogadores.
tags: ["gangzone"]
---
## Descrição
Pare uma Gangzone de piscar para todos os jogadores.
| Nome | Descrição |
| ---- | ------------------------------------------------------------------------ |
| zone | O ID da gangzone que quer parar de piscar. Retornado por GangZoneCreate. |
## Retorno
1: A função foi executada com sucesso. Sucesso é relatado mesmo que a gangzone não começe a piscar.
0: A função falhou ao ser executada. A gangzone especificada não existe.
## Exemplos
```c
new gGangZoneId;
public OnGameModeInit()
{
gGangZoneId = GangZoneCreate(1248.011, 2072.804, 1439.348, 2204.319);
return 1;
}
public OnPlayerDeath(playerid, killerid, WEAPON:reason)
{
GangZoneFlashForAll(gGangZoneId, COLOR_RED);
return 1;
}
public OnPlayerSpawn(playerid)
{
GangZoneStopFlashForAll(gGangZoneId);
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.
- [GangZoneFlashForPlayer](GangZoneFlashForPlayer): Faz uma gangzone piscar para um jogador.
- [GangZoneFlashForAll](GangZoneFlashForAll): Faz uma gangzone piscar para todos os jogadores.
- [GangZoneStopFlashForPlayer](GangZoneStopFlashForPlayer): Pare uma Gangzone de piscar para um jogador.
| openmultiplayer/web/docs/translations/pt-BR/scripting/functions/GangZoneStopFlashForAll.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/pt-BR/scripting/functions/GangZoneStopFlashForAll.md",
"repo_id": "openmultiplayer",
"token_count": 683
} | 411 |
---
title: RemoveBuildingForPlayer
description: Remove um modelo de San Andreas para um único jogador em um raio específico.
tags: ["player"]
---
## Descrição
Remove um modelo de San Andreas para um único jogador em um raio específico.
| Nome | Descrição |
| ------------- | ------------------------------------------------------------------------------------- |
| playerid | O ID do jogador para o qual remover os objetos. |
| modelid | O modelo a ser removido. |
| Float:fX | A coordenada X em torno da qual os objetos serão removidos. |
| Float:fY | A coordenada Y em torno da qual os objetos serão removidos. |
| Float:fZ | A coordenada Z em torno da qual os objetos serão removidos. |
| Float:fRadius | O raio ao redor do ponto especificado para remover objetos com o modelo especificado. |
## Retorno
Essa função não retorna um valor específico.
## Exemplos
```c
public OnPlayerConnect(playerid)
{
// Quando o jogador se conectar, os objetos com o modelo 615 serão removidos dentro de um
// raio de 200.0 metros do ponto 0.0, 0.0, 0.0, que é o centro de San Andreas(mapa).
RemoveBuildingForPlayer(playerid, 615, 0.0, 0.0, 0.0, 200.0);
return 1;
}
public OnPlayerConnect(playerid)
{
// Quando o jogador se conectar, todos os objetos do mapa serão removidos.
RemoveBuildingForPlayer(playerid, -1, 0.0, 0.0, 0.0, 6000.0);
return 1;
}
```
## Notas
:::tip
No SA-MP 0.3.7 você pode usar -1 no modelid para remover todos os objetos dentro do raio especificado.
:::
:::warning
Há um limite de cerca de 1000 linhas/objetos. Não há solução alternativa. Ao remover o mesmo objeto para um jogador, eles travarão. Comummente, os jogadores travam ao se reconectar ao servidor porque o servidor remove o objeto no OnPlayerConnect.
:::
## Funções relacionadas
- [DestroyObject](DestroyObject): Destrua um objeto.
- [DestroyPlayerObject](DestroyPlayerObject): Destrua um objeto para um jogador.
| openmultiplayer/web/docs/translations/pt-BR/scripting/functions/RemoveBuildingForPlayer.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/pt-BR/scripting/functions/RemoveBuildingForPlayer.md",
"repo_id": "openmultiplayer",
"token_count": 997
} | 412 |
---
title: getdate
description: Retorna a data atual do servidor, que será armazenada nas variáveis &ano, &mes e &dia
tags: []
---
<LowercaseNote />
## Descrição
Retorna a data atual do servidor, que será armazenada nas variáveis &ano, &mes e &dia
| Nome | Descrição |
| ---------- | -------------------------------------------------------------- |
| &ano=0 | A variável para armazenar a hora, passada por referência. |
| &mes=0 | A variável para armazenar o minuto, passada por referência. |
| &dia=0 | A variável para armazenar os segundos, passada por referência. |
## Retorno
O número de dias desde o início do ano.
## Exemplos
```
new ano, mes, dia, dias;
dias = getdate(ano, mes, dia);
printf("%02d/%02d/%d", dia, mes, ano);
printf("Dias desde o início do ano: %d", dias);
```
## Funções Relacionadas
- [gettime](gettime): Obtenha a hora atual do servidor como um registro de data e hora unix.
| openmultiplayer/web/docs/translations/pt-BR/scripting/functions/getdate.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/pt-BR/scripting/functions/getdate.md",
"repo_id": "openmultiplayer",
"token_count": 447
} | 413 |
---
title: Dialog Styles
---
:::note
- Em [OnDialogResponse](../callbacks/OnDialogResponse), pressionar **button1** define **response** para **1**, enquanto pressionar **button2** define **response** para **0**.
- Todo dialog tem um button2 opcional. Para que ele não seja mostrado, mantenha o parâmetro vazio, como no primeiro exemplo. Os jogadores não poderão clicá-lo, mas eles ainda poderão apertar ESC e chamar [OnDialogResponse](../callbacks/OnDialogResponse) com **response** = **0**.
- [ShowPlayerDialog](../functions/ShowPlayerDialog): As cores embutidas podem ser utilizadas nos parâmetros: **caption**, **info**, **button1** e **button2**.
:::
- Esta página descreve o comportamento de [ShowPlayerDialog](../functions/ShowPlayerDialog) e [OnDialogResponse](../callbacks/OnDialogResponse).
- Por várias limitações, visite a página de [Limites](../resources/limits).
- Para exemplos de resposta, o seguinte código será usado:
```c
public OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] )
{
printf( "playerid = %d, dialogid = YOUR_DIALOGID, response = %d, listitem = %d, inputtext = '%s' (size: %d)", playerid, response, listitem, inputtext, strlen( inputtext ) );
return 1;
}
```
## Estilo 0: `DIALOG_STYLE_MSGBOX`

Visualização:
:::note
- **\t** adiciona um TAB (mais espaço).
- **\n** cria uma nova linha.
- Cores embutidas não resetarão após \n ou \t
:::
```c
ShowPlayerDialog(playerid, YOUR_DIALOGID, DIALOG_STYLE_MSGBOX, "Caption", "Info\n\tInfo", "Button 1", "");
```
### Saída de Resposta
:::note
- **listitem** é sempre **-1**.
- **inputtext** é sempre vazio.
:::
```c
// Botão pressionado
playerid = 0, dialogid = YOUR_DIALOGID, response = 1, listitem = -1, inputtext = '' (size: 0)
// ESC pressionado (já que o segundo botão não está visível)
playerid = 0, dialogid = YOUR_DIALOGID, response = 0, listitem = -1, inputtext = '' (size: 0)
```
## Estilo 1: `DIALOG_STYLE_INPUT`

Visualização:
:::note
- **\t** adiciona um TAB (mais espaço).
- **\n** cria uma nova linha.
- Cores embutidas não resetarão após \n ou \t
:::
```c
ShowPlayerDialog(playerid, YOUR_DIALOGID, DIALOG_STYLE_INPUT, "Caption", "Enter information below:", "Button 1", "Button 2");
```
### Saída de Resposta
:::note
- **listitem** é sempre **-1**.
- **inputtext** é o texto escrito pelo usuário, incluindo possíveis cores.
:::
```c
// Escreveu "input" e apertou o botão esquerdo
playerid = 0, dialogid = YOUR_DIALOGID, response = 1, listitem = -1, inputtext = 'input' (size: 5)
// Escreveu "input" e apertou o botão direito
playerid = 0, dialogid = YOUR_DIALOGID, response = 0, listitem = -1, inputtext = 'input' (size: 5)
```
## Estilo 2: `DIALOG_STYLE_LIST`

Visualização:
:::note
- **\t** adiciona um TAB (mais espaço).
- **\n** cria uma nova linha.
- Cores embutidas não resetarão após \n ou \t
:::
```c
ShowPlayerDialog(playerid, YOUR_DIALOGID, DIALOG_STYLE_LIST, "Caption", "Item 0\n{FFFF00}Item 1\nItem 2", "Button 1", "Button 2");
```
### Saída da Resposta:
:::note
- **listitem** é o número da linha selecionado, iniciando em **0**.
- **inputtext** é o texto contido no item, incluindo as cores.
:::
```c
// Selecionou o primeiro item e apertou o botão esquerdo
playerid = 0, dialogid = YOUR_DIALOGID, response = 1, listitem = 0, inputtext = 'Item 0' (size: 6)
// Selecionou o segundo item e apertou o botão direito
playerid = 0, dialogid = YOUR_DIALOGID, response = 0, listitem = 1, inputtext = 'Item 1' (size: 6)
```
## Estilo 3: `DIALOG_STYLE_PASSWORD`
:::note
- Similar ao **DIALOG_STYLE_INPUT**.
:::

Visualização:
:::note
- **\t** adiciona um TAB (mais espaço).
- **\n** cria uma nova linha.
:::
```c
ShowPlayerDialog(playerid, YOUR_DIALOGID, DIALOG_STYLE_PASSWORD, "Caption", "Enter private information below:", "Button 1", "Button 2");
```
### Saída da Resposta:
:::note
- **listitem** é sempre **-1**.
- **inputtext** é o texto digitado pelo jogador, sem possíveis cores.
:::
```c
// Escreveu "input" e apertou o botão esquerdo
playerid = 0, dialogid = YOUR_DIALOGID, response = 1, listitem = -1, inputtext = 'input' (size: 5)
// Escreveu "input" e apertou o botão direito
playerid = 0, dialogid = YOUR_DIALOGID, response = 0, listitem = -1, inputtext = 'input' (size: 5)
```
## Estilo 4: `DIALOG_STYLE_TABLIST`
:::tip Este estilo foi adicionado na versão **SA-MP 0.3.7** e não funcionará em versões anteriores!
:::
:::note
- Similar ao **DIALOG_STYLE_LIST**.
:::

Visualização:
:::note
- **\t** adiciona um TAB (mais espaço).
- **\n** cria uma nova linha.
- Cores embutidas não resetarão após \n ou \t.
:::
```c
ShowPlayerDialog(playerid, YOUR_DIALOGID, DIALOG_STYLE_TABLIST, "Caption",
"Deagle\t$5000\t100\n\
{FF0000}Sawnoff\t{33AA33}$5000\t100\n\
Pistol\t$1000\t50",
"Button 1", "Button 2");
```
:::note
- **inputtext** é o texto existente na _primeira coluna_ do item **listitem** selecionado, sem as cores.
:::
```c
// Selecionou o primeiro item e apertou o botão esquerdo
playerid = 0, dialogid = YOUR_DIALOGID, response = 1, listitem = 0, inputtext = 'Deagle' (size: 6)
// Selecionou o segundo item e apertou o botão direito
playerid = 0, dialogid = YOUR_DIALOGID, response = 0, listitem = 1, inputtext = 'Sawnoff' (size: 7)
```
## Estilo 5: `DIALOG_STYLE_TABLIST_HEADERS`
:::tip Este estilo foi adicionado na versão **SA-MP 0.3.7** e não funcionará em versões anteriores!
:::
:::note
- Similar ao **DIALOG_STYLE_LIST**.
:::

Showing:
:::note
- **\t** cria uma nova coluna.
- **\n** cria um novo item na lista.
- Cores embutidas reiniciarão após \n e \t. A primeira linha **info** define o cabeçalho.
:::
```c
ShowPlayerDialog(playerid, YOUR_DIALOGID, DIALOG_STYLE_TABLIST_HEADERS, "Caption",
"Header 1\tHeader 2\tHeader 3\n\
Item 1 Column 1\tItem 1 Column 2\tItem 1 Column 3\n\
{FF0000}Item 2 Column 1\t{33AA33}Item 2 Column 2\tItem 2 Column 3",
"Button 1", "Button 2");
```
:::note
- **inputtext** é o texto contido na _primeira coluna_ do item **listitem** selecionado, sem as possíveis cores.
:::
```c
// Selecionou o primeiro item da lista e clicou com o botão esquerdo
playerid = 0, dialogid = YOUR_DIALOGID, response = 1, listitem = 0, inputtext = 'Item 1 Column 1' (size: 15)
// Selecionou o primeiro item da lista e clicou com o botão direito
playerid = 0, dialogid = YOUR_DIALOGID, response = 0, listitem = 1, inputtext = 'Item 2 Column 1' (size: 15)
```
| openmultiplayer/web/docs/translations/pt-BR/scripting/resources/dialogstyles.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/pt-BR/scripting/resources/dialogstyles.md",
"repo_id": "openmultiplayer",
"token_count": 2777
} | 414 |
---
title: OnGameModeExit
description: Acest callback este apelat atunci când un mod de joc se termină, fie prin „gmx”, serverul fiind oprit, fie GameModeExit.
tags: []
---
## Descriere
Acest callback este apelat atunci când un mod de joc se termină, fie prin „gmx”, serverul fiind oprit, fie GameModeExit.
## Exemple
```c
public OnGameModeExit()
{
print("Modul de joc s-a încheiat.");
return 1;
}
```
## Note
:::tip
Această funcție poate fi, de asemenea, utilizată într-un filterscript pentru a detecta dacă modul de joc se schimbă cu comenzi RCON precum changemode sau gmx, deoarece schimbarea modului de joc nu reîncarcă un filterscript. Când utilizați OnGameModeExit împreună cu comanda consolei „rcon gmx”, rețineți că există potențialul de apariție a erorilor clientului, un exemplu în acest sens este apelurile excesive la RemoveBuildingForPlayer în timpul OnGameModeInit, care ar putea duce la o blocare a clientului. Acest callback NU va fi apelat dacă serverul se blochează sau procesul este oprit prin alte mijloace, cum ar fi utilizarea comenzii Linux kill sau apăsarea butonului de închidere de pe consola Windows.
:::
## Funcții similare
- [GameModeExit](../functions/GameModeExit): Ieși din modul de joc curent.
## Callback-uri similare
- [OnGameModeInit](OnGameModeInit): Apelat când pornește un mod de joc.
- [OnFilterScriptInit](OnFilterScriptInit): Apelat când este încărcat un filterscript.
- [OnFilterSciptExit](OnFilterScriptExit): Apelat când un filterscript este descărcat. | openmultiplayer/web/docs/translations/ro/scripting/callbacks/OnGameModeExit.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/ro/scripting/callbacks/OnGameModeExit.md",
"repo_id": "openmultiplayer",
"token_count": 608
} | 415 |
---
title: OnPlayerEnterVehicle
description: Acest callback este apelat atunci când un jucător începe să intre într-un vehicul, ceea ce înseamnă că jucătorul nu se află încă în vehicul în momentul în care este apelat.
tags: ["player", "vehicle"]
---
## Descriere
Acest callback este apelat atunci când un jucător începe să intre într-un vehicul, ceea ce înseamnă că jucătorul nu se află încă în vehicul în momentul în care este apelat.
| Nume | Descriere |
| ----------- | ------------------------------------------------------------ |
| playerid | ID-ul jucătorului care încearcă să intre într-un vehicul. |
| vehicleid | ID-ul vehiculului în care jucătorul încearcă să intre. |
| ispassenger | 0 dacă introduceți ca șofer. 1 dacă intri ca pasager. |
## Returnări
Este întotdeauna numit primul în filterscript-uri.
## Exemple
```c
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
new string[128];
format(string, sizeof(string), "Intri in vehicul %i", vehicleid);
SendClientMessage(playerid, 0xFFFFFFFF, string);
return 1;
}
```
## Note
:::tip
Acest apel invers este apelat atunci când un jucător ÎNCEPE să intre într-un vehicul, nu când a intrat în el. Consultați OnPlayerStateChange. Acest apel invers este în continuare apelat dacă jucătorului i se interzice intrarea în vehicul (de exemplu, acesta este blocat sau plin).
:::
## Funcții similare
- [PutPlayerInVehicle](../functions/PutPlayerInVehicle): Pune un jucător într-un vehicul.
- [GetPlayerVehicleSeat](../functions/GetPlayerVehicleSeat): Verificați pe ce loc se află un jucător. | openmultiplayer/web/docs/translations/ro/scripting/callbacks/OnPlayerEnterVehicle.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/ro/scripting/callbacks/OnPlayerEnterVehicle.md",
"repo_id": "openmultiplayer",
"token_count": 760
} | 416 |
---
title: OnPlayerSelectedMenuRow
description: Acest callback este apelat atunci când un jucător selectează un articol dintr-un meniu (ShowMenuForPlayer).
tags: ["player", "menu"]
---
## Descriere
Acest callback este apelat atunci când un jucător selectează un articol dintr-un meniu (ShowMenuForPlayer).
| Nume | Descriere |
| -------- | ----------------------------------------------------------- |
| playerid | ID-ul jucătorului care a selectat un element de meniu. |
| row | ID-ul rândului care a fost selectat. Primul rând este ID 0. |
## Returnări
Este întotdeauna numit primul în modul de joc.
## Exemple
```c
new Menu:MyMenu;
public OnGameModeInit()
{
MyMenu = CreateMenu("Exemplu de meniu", 1, 50.0, 180.0, 200.0, 200.0);
AddMenuItem(MyMenu, 0, "Element 1");
AddMenuItem(MyMenu, 0, "Element 2");
return 1;
}
public OnPlayerSelectedMenuRow(playerid, row)
{
if (GetPlayerMenu(playerid) == MyMenu)
{
switch(row)
{
case 0: print("Elementul 1 selectat");
case 1: print("Elementul 2 selectat");
}
}
return 1;
}
```
## Note
:::tip
ID-ul meniului nu este transmis acestui callback. GetPlayerMenu trebuie utilizat pentru a determina în ce meniu jucătorul a selectat un element.
:::
## Funcții similare
- [CreateMenu](../functions/CreateMenu): Creați un meniu.
- [DestroyMenu](../functions/DestroyMenu): Distrugeți un meniu.
- [AddMenuItem](../functions/AddMenuItem): Adaugă un element la un meniu specificat.
- [ShowMenuForPlayer](../functions/ShowMenuForPlayer): Afișează un meniu pentru un jucător.
- [HideMenuForPlayer](../functions/HideMenuForPlayer): Ascunde un meniu pentru un jucător. | openmultiplayer/web/docs/translations/ro/scripting/callbacks/OnPlayerSelectedMenuRow.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/ro/scripting/callbacks/OnPlayerSelectedMenuRow.md",
"repo_id": "openmultiplayer",
"token_count": 731
} | 417 |
---
title: OnVehicleMod
description: Acest callback este apelat atunci când un vehicul este modificat.
tags: ["vehicle"]
---
## Descriere
Acest callback este apelat atunci când un vehicul este modificat.
| Nume | Descriere |
| ----------- | ------------------------------------------------------- |
| playerid | Actul de identitate al șoferului vehiculului. |
| vehicleid | ID-ul vehiculului care este modificat. |
| componentid | ID-ul componentei care a fost adăugată vehiculului. |
## Returnări
Este întotdeauna numit primul în modul de joc, așa că întoarcerea 0 blochează și alte filterscript-uri să-l vadă.
## Exemple
```c
public OnVehicleMod(playerid, vehicleid, componentid)
{
printf("Vehiculul %d a fost modificat de ID %d cu componentul %d",vehicleid, playerid,componentid);
if (GetPlayerInterior(playerid) == 0)
{
BanEx(playerid, "Trucuri de reglare"); // Script anti-tuning hacks
return 0; // Împiedică modificarea proastă să fie sincronizată cu alți jucători
//(Testat și funcționează chiar și pe servere care vă permit să vă modificați vehiculul folosind comenzi, meniuri, dialoguri etc.
}
return 1;
}
```
## Note
:::tip
Acest apel invers NU este apelat de AddVehicleComponent.
:::
## Funcții similare
- [AddVehicleComponent](../functions/AddVehicleComponent): Adăugați o componentă la un vehicul.
- [OnEnterExitModShop](OnEnterExitModShop): apelat atunci când un vehicul intră sau iese dintr-un magazin de mod.
- [OnVehiclePaintjob](OnVehiclePaintjob): apelat atunci când se modifică vopsirea unui vehicul.
- [OnVehicleRespray](OnVehicleRespray): apelat atunci când un vehicul este recolorat. | openmultiplayer/web/docs/translations/ro/scripting/callbacks/OnVehicleMod.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/ro/scripting/callbacks/OnVehicleMod.md",
"repo_id": "openmultiplayer",
"token_count": 771
} | 418 |
---
title: AddVehicleComponent
description: Adaugă o 'componentă' (adesea denumită 'mod' (modificare)) unui vehicul.
tags: ["vehicle"]
---
## Descriere
Adaugă o 'componentă' (adesea denumită 'mod' (modificare)) unui vehicul. Componentele valide pot fi găsite aici.
| Nume | Descriere |
| --------------------------------------------- | -------------------------------------------------------------------------------- |
| vehicleid | ID-ul vehiculului la care se adaugă componenta. Nu trebuie confundat cu modelid. |
| [componentid](../resources/carcomponentid.md) | ID-ul componentei de adăugat la vehicul. |
## Se intoarce
0 - Componenta nu a fost adăugată deoarece vehiculul nu există.
1 - Componenta a fost adăugată cu succes la vehicul.
## Exemple
```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;
}
```
## Note
:::warning
Utilizarea unui ID de componentă nevalid blochează jocul jucătorului. Nu există verificări interne pentru acest lucru.
:::
## Funcții conexe
- [RemoveVehicleComponent](RemoveVehicleComponent.md): Scoateți o componentă dintr-un vehicul.
- [GetVehicleComponentInSlot](GetVehicleComponentInSlot.md): Verificați ce componente are un vehicul.
- [GetVehicleComponentType](GetVehicleComponentType.md): Verificați tipul de componentă prin ID.
- [OnVehicleMod](../callbacks/OnVehicleMod.md): Apelat când un vehicul este modificat.
- [OnEnterExitModShop](../callbacks/OnEnterExitModShop.md): Apelat când un vehicul intră sau iese dintr-un magazin de moduri.
| openmultiplayer/web/docs/translations/ro/scripting/functions/AddVehicleComponent.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/ro/scripting/functions/AddVehicleComponent.md",
"repo_id": "openmultiplayer",
"token_count": 959
} | 419 |
---
title: Ghid pentru meniuri
---
Un scurt tutorial care explică modul de utilizare a sistemului de meniuri al jocului. Acest sistem de meniu este diferit de dialogurile SA-MP și reflectă mai bine interfața tradițională a jocului original.
## Meniuri în SA-MP
Meniurile arată foarte complicat și greu de redactat pentru cei mai mulți jucători, deși nu este. Aici vă voi arăta cum să creați un meniu simplu. La final vom crea un meniu de teleportare.
## Primii pași din meniu
Mai întâi trebuie să creăm un meniu. Prefixul dinainte este `Menu:` aceasta face ca variabila să fie corectă [etichetata](../scripting/language/tags). Există diferite tipuri pentru utilizări diferite, cum ar fi "Float:" bool: "Text3D:" etc. Scrieți următorul cod în partea de sus a scriptului:
```c
new Menu:teleportmenu;
```
Bine, am creat variabila pentru a stoca meniul. Acum trebuie să creăm meniul și să atribuim meniului variabila pe care am creat-o. Tastați acest lucru în `OnGameModeInit`:
```c
teleportmenu = CreateMenu("Teleportmenu", 2, 200.0, 100.0, 150.0, 150.0);
```
Acum o explicație despre argumentele [CreateMenu](../scripting/functions/CreateMenu). **Parametrii:**
| Parameter | Specifies |
| --------------- | ---------------------------------------------------------------------------- |
| title | Antetul meniului |
| columns | Numărul de aici definește cât de multe coloane sunt utilizate (2 este maxim) |
| Float:x | Poziția înaltă a meniului pe ecran (de la stânga la dreapta) |
| Float:y | Poziția lățimii meniului pe ecran (sus și jos) |
| Float:col1width | Lățimea primei coloane |
| Float:col2width | Lățimea celei de-a doua coloane |
## Adăugați câteva elemente de meniu
Ok, acum avem meniul, dar avem nevoie de câteva elemente, sub care puteți alege în meniu. Le adăugați sub „CreateMenu” pe care l-am creat mai devreme.
```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");
```
Explicația pentru [AddMenuItem](../scripting/functions/AddMenuItem):
| menuid | Meniul din meniul în care va fi afișat elementul |
| ------ | ------------------------------------------------ |
| column | Coloana în care va fi afișat elementul |
| text | Textul articolului |
## Crearea efectelor pentru elemente
Bine, acum că am creat un meniu complet cu elemente, ce ar trebui să se întâmple atunci când alegeți un articol? În exemplul nostru, vrem să realizăm un meniu de teleportare, deci ar trebui să fim teleportați în poziția pe care o alegem. Când un jucător selectează un element dintr-un meniu, scriptul apelează callback-ul [OnPlayerSelectedMenuRow](../scripting/callbacks/OnPlayerSelectedMenuRow). Cel mai bun mod de a face acest lucru este să-l faceți cu un comutator, este ca mai multe instrucțiuni if pentru a verifica dacă o variabilă merită anumite valori. Dar mai întâi vrem aceste efecte doar pentru meniul pe care îl dorim, așa că trebuie să creăm o variabilă care să conțină ce meniu privește playerul, acest lucru se face cu `GetPlayerMenu`:
```c
new Menu:CurrentMenu = GetPlayerMenu(playerid);
```
Acum, când cineva selectează ceva din meniu, meniul său va fi salvat în `CurrentMenu`.
Acum trebuie să verificăm dacă meniul pe care l-au selectat este meniul pe care îl dorim:
```c
public OnPlayerSelectedMenuRow(playerid, row)
{
new Menu:CurrentMenu = GetPlayerMenu(playerid);
if (CurrentMenu == teleportmenu)
{
//stuff
}
return 1;
}
```
Acum între aceste paranteze este locul unde se află comutatorul, acest lucru verifică ce element selectat de jucător sau `rând` se poate face cu instrucțiunile `dacă` verificând ce `rând` este, dar `comutatorul` este mult mai simplu mod de a-l scrie.
```c
if(CurrentMenu == teleportmenu)
{
switch(row)
{
case 0: //Grove Street
{
SetPlayerPos(playerid, 2493.9133, -1682.3986, 13.3382);
SetPlayerInterior(playerid, 0);
SendClientMessage(playerid, 0xFFFFFFFF, "Welcome to Grove Street");
}
case 1: //Starfish Tower
{
SetPlayerPos(playerid, 1541.2833, -1362.4741, 329.6457);
SetPlayerInterior(playerid, 0);
SendClientMessage(playerid, 0xFFFFFFFF, "Welcome to the top of Starfish Tower");
}
case 2: //Wheel Arch Angels
{
SetPlayerPos(playerid, -2705.5503, 206.1621, 4.1797);
SetPlayerInterior(playerid, 0);
SendClientMessage(playerid, 0xFFFFFFFF, "Welcome to the Wheel Arch Angels tuning-shop");
}
case 3: //Jizzys
{
SetPlayerPos(playerid, -2617.5156, 1390.6353, 7.1105);
SetPlayerInterior(playerid, 0);
SendClientMessage(playerid, 0xFFFFFFFF, "Welcome to Jizzy's Nightclub!");
}
case 4: //4Dragons
{
SetPlayerPos(playerid, 2028.5538, 1008.3543, 10.8203);
SetPlayerInterior(playerid, 0);
SendClientMessage(playerid, 0xFFFFFFFF, "Welcome to the Four Dragons Casino");
}
case 5: //Come-a-Lot
{
SetPlayerPos(playerid, 2169.1838, 1122.5426, 12.6107);
SetPlayerInterior(playerid, 0);
SendClientMessage(playerid, 0xFFFFFFFF, "Welcome to the Come-a-Lot casino!");
}
}
}
```
## Ultimii pași
Acum avem nevoie de o comandă pentru a afișa meniul. Acesta este cel mai ușor pas. Doar o comparație cu `strcmp` și un `ShowMenuForPlayer`. Acest lucru se face în `OnPlayerCommandText`. Sau, dacă aveți deja un procesor de comandă, utilizați-l în schimb pentru a apela `ShowMenuForPlayer`.
```c
if(strcmp(cmdtext, "/teleport", true) == 0)
{
ShowMenuForPlayer(teleportmenu,playerid);
return 1;
}
```
Foarte ușor, nu-i așa?
## Ultimele cuvinte
Bine, după ce ați citit acest lucru ȘI l-ați înțeles, încercați propriul meniu. După cum ați putut vedea, nu este atât de dificil, dar îi va impresiona pe jucătorii de pe serverul dvs. cu atât mai mult. Și poți să creezi efecte foarte interesante cu asta. De asemenea, este foarte interesant pentru magazinele generale sau supermarketurile pentru lucrurile pe care le puteți cumpăra. Apoi, puteți scădea niște bani ca efect, iar prețul este afișat într-o altă coloană din meniu. Dar acum, lucrează pe cont propriu.
De asemenea, puteți adăuga [TogglePlayerControllable](../scripting/functions/TogglePlayerControllable) cu `false` după`ShowPlayerMenu` și [TogglePlayerControllable](../scripting/functions/TogglePlayerControllable) cu `true` la sfârșitul ʻOnPlayerSelectedMen jucătorul respectiv nu se poate mișca în timp ce navighează prin meniuri.
Sper că ați învățat ceva din acest tutorial. Dacă aveți întrebări, întrebați pe forumuri / discordie.
| openmultiplayer/web/docs/translations/ro/tutorials/MenuGuide.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/ro/tutorials/MenuGuide.md",
"repo_id": "openmultiplayer",
"token_count": 3462
} | 420 |
---
title: OnClientMessage
description: Этот коллбэк вызывается, когда NPC видит сообщение в чате.
tags: []
---
<VersionWarn name='callback' version='SA-MP 0.3.7' />
## Описание
Этот коллбэк вызывается, когда NPC видет сообщение от клиента. Коллбэк будет вызван каждый раз, когда будет использована функция `SendClientMessageToAll` или когда функция `SendClientMessage` будет адресована NPC. Этот коллбэк не будет вызван, если кто-то просто что-то скажет в чат. Для вариации коллбэка с сообщением игрока в чат, см. NPC:OnPlayerText.
| Аргумент | Описание |
| ------ | ------------------------------- |
| color | Цвет сообщения клиента. |
| text[] | Текст сообщения. |
## Результат
This callback does not handle returns.
## Пример
```c
public OnClientMessage(color, text[])
{
if (strfind(text,"На счету: $0") != -1)
{
SendClientMessage(playerid, -1, "Я бедный :(");
}
}
```
## Функции
| openmultiplayer/web/docs/translations/ru/scripting/callbacks/OnClientMessage.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/ru/scripting/callbacks/OnClientMessage.md",
"repo_id": "openmultiplayer",
"token_count": 709
} | 421 |
---
title: OnPlayerClickMap
description: OnPlayerClickMap se pokliče, ko si igralec postavi tarčo(target/waypoint) na zemljevidu menija za premor (desni klik).
tags: ["player"]
---
## Opis
OnPlayerClickMap se pokliče, ko si igralec postavi tarčo(target/waypoint) na zemljevidu menija za premor (desni klik).
| Ime | Opis |
| -------- | -------------------------------------------------------------------------------------------- |
| playerid | ID igralec, ki je postavil tarčo(waypoint) na zemljevidu |
| Float:fX | X plavajoče koordinate, kjer je igralec kliknil |
| Float:fY | Y plavajoče koordinate, kjer je igralec kliknil |
| Float:fZ | Z plavajoče koordinate, kjer je igralec kliknil (nepravilno / netočno - glej opombe spodaj) |
## Returns
1 - Preprečil bo druge "filterskript" prejeli to "callback".
0 - Pomeni, da bo ta "callback" se posreduje na naslednjo "filterskripte".
Vedno je bila povabljena prva v "filterscript".
## Primeri
```c
public OnPlayerClickMap(playerid, Float:fX, Float:fY, Float:fZ)
{
SetPlayerPosFindZ(playerid, fX, fY, fZ);
return 1;
}
```
## Opombe
:::tip
Kakšno ime "callback" piše, da se pokliče le, če igralec klikne, da označi tarčo(waypoint) in ne, ko pritisne gumb. Return vrednost "Z" če bi bilo 0 (nepravilno) če je kraj, kjer je igralec kliknil, daleč stran od igralca; Uporaba MapAndreas ali ColAndreas "plugin" da bi bili bolj natančni "Z" koordinate.
:::
## Srodne Funkcije
| openmultiplayer/web/docs/translations/sl/scripting/callbacks/OnPlayerClickMap.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/sl/scripting/callbacks/OnPlayerClickMap.md",
"repo_id": "openmultiplayer",
"token_count": 798
} | 422 |
---
title: CreatePlayerTextDraw
description: Kreira textdraw za samo jednog igraca.
tags: ["player", "textdraw", "playertextdraw"]
---
## Opis
Kreira textdraw za samo jednog igraca. Ovo moze da se koristi kao izbegavanje limita za globalne textdraw-ove.
| Ime | Opis |
| -------- | --------------------------------------- |
| playerid | ID igraca kome kreiramo player textdraw |
| Float:x | X koordinata |
| Float:y | Y koordinata |
| text[] | Tekst u textdraw-u |
## Vraca
ID kreiranog textdraw-a
## Primeri
```c
// Ova varijabla sluzi da sadrzi ID textdraw-a u sebi
// tako da mozemo da ga koristimo kroz skriptu
new PlayerText:welcomeText[MAX_PLAYERS];
public OnPlayerConnect(playerid)
{
// Prvo kreiramo textdraw
welcomeText[playerid] = CreatePlayerTextDraw(playerid, 320.0, 240.0, "Welcome to my SA-MP server");
// Zatim ga prikazemo
PlayerTextDrawShow(playerid, welcomeText[playerid]);
}
```
## Belekse
:::tip
Player textdraw-ovi se automatski uniste kada se igrac diskonektuje.
:::
:::warning
Key mapping kodovi ( kao sto su ~k~~VEHICLE_ENTER_EXIT~ ne rade preko 255og karaktera.
:::
## Srodne Funkcije
- [PlayerTextDrawDestroy](PlayerTextDrawDestroy.md): Unistava player textdraw.
- [PlayerTextDrawColor](PlayerTextDrawColor.md): Podesava boju teksta od player textdraw-a.
- [PlayerTextDrawBoxColor](PlayerTextDrawBoxColor.md): Podesava boju boxa od player textdraw-a.
- [PlayerTextDrawBackgroundColor](PlayerTextDrawBackgroundColor.md): Podesava pozadinsku boju od player textdraw-a.
- [PlayerTextDrawAlignment](PlayerTextDrawAlignment.md): Podesava poravnavanje od player textdraw-a.
- [PlayerTextDrawFont](PlayerTextDrawFont.md): Podesava font od player textdraw-a.
- [PlayerTextDrawLetterSize](PlayerTextDrawLetterSize.md): Podesava velicinu slova teksta od player textdraw-a.
- [PlayerTextDrawTextSize](PlayerTextDrawTextSize.md): Podesava velicinu od player textdraw-a ( Za OnPlayerClickPlayerTextdraw ).
- [PlayerTextDrawSetOutline](PlayerTextDrawSetOutline.md): Podesava outline od player textdraw-a.
- [PlayerTextDrawSetShadow](PlayerTextDrawSetShadow.md): Podesava senku od player textdraw-a.
- [PlayerTextDrawSetProportional](PlayerTextDrawSetProportional.md): Podesava razmak teksta od player textdraw-a.
- [PlayerTextDrawUseBox](PlayerTextDrawUseBox.md): Pali bog od player textdraw-a.
- [PlayerTextDrawSetString](PlayerTextDrawSetString.md): Podesava tekst od player textdraw-a.
- [PlayerTextDrawShow](PlayerTextDrawShow.md): Prikaze player textdraw.
- [PlayerTextDrawHide](PlayerTextDrawHide.md): Sakrije player textdraw.
| openmultiplayer/web/docs/translations/sr/scripting/functions/CreatePlayerTextDraw.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/sr/scripting/functions/CreatePlayerTextDraw.md",
"repo_id": "openmultiplayer",
"token_count": 1015
} | 423 |
---
title: OnGameModeInit
description: Callback นี้ถูกเรียกเมื่อเกมโหมดเริ่มต้นทำงาน
tags: []
---
## คำอธิบาย
Callback นี้ถูกเรียกเมื่อเกมโหมดเริ่มต้นทำงาน
| ชื่อ | คำอธิบาย |
| ---- | -------- |
## ตัวอย่าง
```c
public OnGameModeInit()
{
print("เกมโหมดได้เริ่มต้นทำงานแล้ว!");
return 1;
}
```
## บันทึก
:::tip
ฟังก์ชั่นนี้ยังสามารถถูกใช้ในฟิลเตอร์สคริปต์ได้เพื่อตรวจสอบว่าเกมโหมดมีการเปลี่ยนแปลงด้วยคำสั่ง RCON ไหม เช่น changemode, gmx หรือมีการเปลี่ยนเกมโหมดแล้วแต่ฟิลเตอร์สคริปต์ยังไม่ถูกรีโหลด
:::
## ฟังก์ชั่นที่เกี่ยวข้องกัน
| openmultiplayer/web/docs/translations/th/scripting/callbacks/OnGameModeInit.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/th/scripting/callbacks/OnGameModeInit.md",
"repo_id": "openmultiplayer",
"token_count": 750
} | 424 |
---
title: OnPlayerExitVehicle
description: This callback is called when a player starts to exit a vehicle.
tags: ["player", "vehicle"]
---
## คำอธิบาย
This callback is called when a player starts to exit a vehicle.
| Name | Description |
| --------- | ----------------------------------------------- |
| playerid | The ID of the player that is exiting a vehicle. |
| vehicleid | The ID of the vehicle the player is exiting. |
## ส่งคืน
มันถูกเรียกในฟิลเตอร์สคริปต์ก่อนเสมอ
## ตัวอย่าง
```c
public OnPlayerExitVehicle(playerid, vehicleid)
{
new string[35];
format(string, sizeof(string), "INFO: You are exiting vehicle %i", vehicleid);
SendClientMessage(playerid, 0xFFFFFFFF, string);
return 1;
}
```
## บันทึก
:::warning
Not called if the player falls off a bike or is removed from a vehicle by other means such as using SetPlayerPos. You must use OnPlayerStateChange and check if their old state is PLAYER_STATE_DRIVER or PLAYER_STATE_PASSENGER and their new state is PLAYER_STATE_ONFOOT.
:::
## ฟังก์ชั่นที่เกี่ยวข้องกัน
- [RemovePlayerFromVehicle](../../scripting/functions/RemovePlayerFromVehicle.md): Throw a player out of their vehicle.
- [GetPlayerVehicleSeat](../../scripting/functions/GetPlayerVehicleSeat.md): Check what seat a player is in.
| openmultiplayer/web/docs/translations/th/scripting/callbacks/OnPlayerExitVehicle.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/th/scripting/callbacks/OnPlayerExitVehicle.md",
"repo_id": "openmultiplayer",
"token_count": 579
} | 425 |
---
title: OnPlayerSpawn
description: This callback is called when a player spawns.
tags: ["player"]
---
## คำอธิบาย
This callback is called when a player spawns.(i.e. after caling SpawnPlayer function)
| Name | Description |
| -------- | ---------------------------------- |
| playerid | The ID of the player that spawned. |
## ส่งคืน
0 - Will prevent other filterscripts from receiving this callback.
1 - Indicates that this callback will be passed to the next filterscript.
มันถูกเรียกในฟิลเตอร์สคริปต์ก่อนเสมอ
## ตัวอย่าง
```c
public OnPlayerSpawn(playerid)
{
new PlayerName[MAX_PLAYER_NAME],
string[40];
GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
format(string, sizeof(string), "%s has spawned successfully.", PlayerName);
SendClientMessageToAll(0xFFFFFFFF, string);
return 1;
}
```
## บันทึก
:::tip
The game sometimes deducts \$100 from players after spawn.
:::
## ฟังก์ชั่นที่เกี่ยวข้องกัน
- [SpawnPlayer](../../scripting/functions/SpawnPlayer.md): Force a player to spawn.
- [AddPlayerClass](../../scripting/functions/AddPlayerClass.md): Add a class.
- [SetSpawnInfo](../../scripting/functions/SetSpawnInfo.md): Set the spawn setting for a player.
| openmultiplayer/web/docs/translations/th/scripting/callbacks/OnPlayerSpawn.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/th/scripting/callbacks/OnPlayerSpawn.md",
"repo_id": "openmultiplayer",
"token_count": 550
} | 426 |
---
title: OnVehiclePaintjob
description: Called when a player previews a vehicle paintjob inside a mod shop.
tags: ["vehicle"]
---
## คำอธิบาย
Called when a player previews a vehicle paintjob inside a mod shop. Watch out, this callback is not called when the player buys the paintjob.
| Name | Description |
| ---------- | ---------------------------------------------------------------- |
| playerid | The ID of the player that changed the paintjob of their vehicle. |
| vehicleid | The ID of the vehicle that had its paintjob changed. |
| paintjobid | The ID of the new paintjob. |
## ส่งคืน
It is always called first in gamemode so returning 0 there blocks other filterscripts from seeing it.
## ตัวอย่าง
```c
public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
new string[128];
format(string, sizeof(string), "You have changed your vehicle's paintjob to %d!", paintjobid);
SendClientMessage(playerid, 0x33AA33AA, string);
return 1;
}
```
## บันทึก
:::tip
This callback is not called by ChangeVehiclePaintjob. You might use OnVehicleChangePaintjob from vSync in order to know when the player buys the paintjob.
:::
## ฟังก์ชั่นที่เกี่ยวข้องกัน
- [ChangeVehiclePaintjob](../../scripting/functions/ChangeVehiclePaintjob.md): Change the paintjob on a vehicle.
- [ChangeVehicleColor](../../scripting/functions/ChangeVehicleColor.md): Set the color of a vehicle.
- [OnVehicleRespray](../../scripting/callbacks/OnVehicleRespray.md): Called when a vehicle is resprayed.
- [OnVehicleMod](../../scripting/callbacks/OnVehicleMod.md): Called when a vehicle is modded.
| openmultiplayer/web/docs/translations/th/scripting/callbacks/OnVehiclePaintjob.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/th/scripting/callbacks/OnVehiclePaintjob.md",
"repo_id": "openmultiplayer",
"token_count": 676
} | 427 |
---
title: AllowAdminTeleport
description: This function will determine whether RCON admins will be teleported to their waypoint when they set one.
tags: []
---
:::warning
This function, as of 0.3d, is deprecated. Please see OnPlayerClickMap.
:::
## คำอธิบาย
This function will determine whether RCON admins will be teleported to their waypoint when they set one.
| Name | Description |
| ----- | ----------------------------- |
| allow | 0 to disable and 1 to enable. |
## ส่งคืน
This function does not return any specific values.
## ตัวอย่าง
```c
public OnGameModeInit()
{
AllowAdminTeleport(1);
// Other stuff
return 1;
}
```
## ฟังก์ชั่นที่เกี่ยวข้องกัน
- [IsPlayerAdmin](../../scripting/functions/IsPlayerAdmin.md): Checks if a player is logged into RCON.
- [AllowPlayerTeleport](../../scripting/functions/AllowPlayerTeleport.md): Toggle waypoint teleporting for players.
| openmultiplayer/web/docs/translations/th/scripting/functions/AllowAdminTeleport.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/th/scripting/functions/AllowAdminTeleport.md",
"repo_id": "openmultiplayer",
"token_count": 367
} | 428 |
---
title: CreateObject
description: Creates an object at specified coordinates in the game world.
tags: []
---
## คำอธิบาย
Creates an object at specified coordinates in the game world.
| Name | Description |
| ------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| modelid | The model to create. |
| Float:X | The X coordinate to create the object at. |
| Float:Y | The Y coordinate to create the object at. |
| Float:Z | The Z coordinate to create the object at. |
| Float:rX | The X rotation of the object. |
| Float:rY | The Y rotation of the object. |
| Float:rZ | The Z rotation of the object. |
| Float:DrawDistance | (optional) The distance that San Andreas renders objects at. 0.0 will cause objects to render at their default distances. |
## ตัวอย่าง
```c
public OnGameModeInit()
{
CreateObject(2587, 2001.195679, 1547.113892, 14.283400, 0.0, 0.0, 96.0); // Object will render at its default distance.
CreateObject(2587, 2001.195679, 1547.113892, 14.283400, 0.0, 0.0, 96.0, 300.0); // Object will render at 300.0 units.
return 1;
}
```
## บันทึก
:::tip
There is a limit of 1000 objects (MAX_OBJECTS). To circumvent this limit, you can use a streamer.
:::
## ฟังก์ชั่นที่เกี่ยวข้องกัน
- [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.
- [AttachObjectToPlayer](../../scripting/functions/AttachObjectToPlayer.md): Attach an object to a player.
- [SetObjectMaterialText](../../scripting/functions/SetObjectMaterialText.md): Replace the texture of an object with text.
- [SetObjectMaterial](../../scripting/functions/SetObjectMaterial.md): Replace the texture of an object with the texture from another model in the game.
- [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.
- [AttachPlayerObjectToPlayer](../../scripting/functions/AttachPlayerObjectToPlayer.md): Attach a player object to a player.
- [SetPlayerObjectMaterialText](../../scripting/functions/SetPlayerObjectMaterialText.md): Replace the texture of a player object with text.
- [SetPlayerObjectMaterial](../../scripting/functions/SetPlayerObjectMaterial.md): Replace the texture of a player object with the texture from another model in the game.
| openmultiplayer/web/docs/translations/th/scripting/functions/CreateObject.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/th/scripting/functions/CreateObject.md",
"repo_id": "openmultiplayer",
"token_count": 2365
} | 429 |
---
title: DetachTrailerFromVehicle
description: Detach the connection between a vehicle and its trailer, if any.
tags: ["vehicle"]
---
## คำอธิบาย
Detach the connection between a vehicle and its trailer, if any.
| Name | Description |
| --------- | -------------------------- |
| vehicleid | ID of the pulling vehicle. |
## ส่งคืน
This function does not return any specific values.
## ตัวอย่าง
```c
DetachTrailerFromVehicle(vehicleid);
```
## ฟังก์ชั่นที่เกี่ยวข้องกัน
- [AttachTrailerToVehicle](../../scripting/functions/AttachTrailerToVehicle.md): Attach a trailer to a vehicle.
- [IsTrailerAttachedToVehicle](../../scripting/functions/IsTrailerAttachedToVehicle.md): Check if a trailer is attached to a vehicle.
- [GetVehicleTrailer](../../scripting/functions/GetVehicleTrailer.md): Check what trailer a vehicle is pulling.
| openmultiplayer/web/docs/translations/th/scripting/functions/DetachTrailerFromVehicle.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/th/scripting/functions/DetachTrailerFromVehicle.md",
"repo_id": "openmultiplayer",
"token_count": 353
} | 430 |
---
title: EnableZoneNames
description: This function allows to turn on zone / area names such as the "Vinewood" or "Doherty" text at the bottom-right of the screen as they enter the area.
tags: []
---
## คำอธิบาย
This function allows to turn on zone / area names such as the "Vinewood" or "Doherty" text at the bottom-right of the screen as they enter the area. This is a gamemode option and should be set in the callback OnGameModeInit.
| Name | Description |
| ------ | ----------------------------------------------------------------------------------------- |
| enable | A toggle option for whether or not you'd like zone names on or off. 0 is off and 1 is on. |
## ส่งคืน
This function does not return any specific values.
## ตัวอย่าง
```c
public OnGameModeInit()
{
EnableZoneNames(1);
return 1;
}
```
## บันทึก
:::warning
This function was removed in SA-MP 0.3. This was due to crashes it caused.
:::
## ฟังก์ชั่นที่เกี่ยวข้องกัน
| openmultiplayer/web/docs/translations/th/scripting/functions/EnableZoneNames.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/th/scripting/functions/EnableZoneNames.md",
"repo_id": "openmultiplayer",
"token_count": 444
} | 431 |
---
title: GangZoneStopFlashForPlayer
description: Stops a gangzone flashing for a player.
tags: ["player", "gangzone"]
---
## คำอธิบาย
Stops a gangzone flashing for a player.
| Name | Description |
| -------- | ------------------------------------------------------- |
| playerid | The ID of the player to stop the gangzone flashing for. |
| zone | The ID of the gangzonezone to stop flashing. |
## ส่งคืน
This function does not return any specific values.
## ตัวอย่าง
```c
new gangzone;
public OnGameModeInit()
{
gangzone = GangZoneCreate(1248.011, 2072.804, 1439.348, 2204.319);
return 1;
}
public OnPlayerSpawn(playerid)
{
GangZoneFlashForPlayer(playerid, gangzone, COLOR_RED);
return 1;
}
public OnPlayerEnterVehicle(playerid, vehicleid)
{
GangZoneStopFlashForPlayer(playerid, gangzone);
return 1;
}
```
## ฟังก์ชั่นที่เกี่ยวข้องกัน
- [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.
- [GangZoneHideForAll](../functions/GangZoneHideForAll): Hide a gangzone for all players.
- [GangZoneFlashForPlayer](../functions/GangZoneFlashForPlayer): Make a gangzone flash for a player.
- [GangZoneFlashForAll](../functions/GangZoneFlashForAll): Make a gangzone flash for all players.
- [GangZoneStopFlashForAll](../functions/GangZoneStopFlashForAll): Stop a gangzone flashing for all players.
| openmultiplayer/web/docs/translations/th/scripting/functions/GangZoneStopFlashForPlayer.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/th/scripting/functions/GangZoneStopFlashForPlayer.md",
"repo_id": "openmultiplayer",
"token_count": 683
} | 432 |
---
title: GetObjectRot
description: Use this function to get the objects current rotation.
tags: []
---
## คำอธิบาย
Use this function to get the objects current rotation. The rotation is saved by reference in three RotX/RotY/RotZ variables.
| Name | Description |
| -------- | ------------------------------------------------------------- |
| objectid | The objectid of the object you want to get the rotation from. |
| &Float:X | The variable to store the X rotation, passed by reference. |
| &Float:Y | The variable to store the Y rotation, passed by reference. |
| &Float:Z | The variable to store the Z rotation, passed by reference. |
## ส่งคืน
The object's rotation is stored in the referenced variables, not in the return value.
## ตัวอย่าง
```c
new Float:RotX,Float:RotY,Float:RotZ;
GetObjectRot(objectid, RotX, RotY, RotZ);
```
## ฟังก์ชั่นที่เกี่ยวข้องกัน
- [GetObjectPos](../functions/GetObjectPos): Locate an object.
- [CreateObject](../functions/CreateObject): Create an object.
- [DestroyObject](../functions/DestroyObject): Destroy an object.
- [IsValidObject](../functions/IsValidObject): Checks if a certain object is vaild.
- [MoveObject](../functions/MoveObject): Move an object.
- [StopObject](../functions/StopObject): Stop an object from moving.
- [SetObjectPos](../functions/SetObjectPos): Set the position of an object.
- [SetObjectRot](../functions/SetObjectRot): Set the rotation of an object.
- [GetObjectRot](../functions/GetObjectRot): Check the rotation of an object.
- [AttachObjectToPlayer](../functions/AttachObjectToPlayer): Attach an object to a player.
- [CreatePlayerObject](../functions/CreatePlayerObject): Create an object for only one player.
- [DestroyPlayerObject](../functions/DestroyPlayerObject): Destroy a player object.
- [IsValidPlayerObject](../functions/IsValidPlayerObject): Checks if a certain player object is vaild.
- [MovePlayerObject](../functions/MovePlayerObject): Move a player object.
- [StopPlayerObject](../functions/StopPlayerObject): Stop a player object from moving.
- [SetPlayerObjectPos](../functions/SetPlayerObjectPos): Set the position of a player object.
- [SetPlayerObjectRot](../functions/SetPlayerObjectRot): Set the rotation of a player object.
- [GetPlayerObjectPos](../functions/GetPlayerObjectPos): Locate a player object.
- [GetPlayerObjectRot](../functions/GetPlayerObjectRot): Check the rotation of a player object.
- [AttachPlayerObjectToPlayer](../functions/AttachPlayerObjectToPlayer): Attach a player object to a player.
| openmultiplayer/web/docs/translations/th/scripting/functions/GetObjectRot.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/th/scripting/functions/GetObjectRot.md",
"repo_id": "openmultiplayer",
"token_count": 830
} | 433 |
---
title: GetPlayerCameraTargetObject
description: Allows you to retrieve the ID of the object the player is looking at.
tags: ["player"]
---
:::warning
ฟังก์ชั่นนี้ถูกเพิ่มใน SA-MP 0.3.7 และจะไม่ทำงานในเวอร์ชั่นก่อนหน้านี้!
:::
## คำอธิบาย
Allows you to retrieve the ID of the object the player is looking at.
| Name | Description |
| -------- | ----------------------------- |
| playerid | The ID of the player to check |
## ส่งคืน
The ID of the object playerid is looking at. If INVALID_OBJECT_ID (65535) is returned, playerid isn't looking at any object.
## ตัวอย่าง
```c
new globalObjectID;
public OnGameModeInit()
{
globalObjectID = CreateObject(1337, 0.0, 0.0, 3.0, 0.0, 0.0, 0.0);
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if (!strcmp(cmdtext, "/check", true))
{
new objectid = GetPlayerCameraTargetObject(playerid);
if (objectid == globalObjectID)
{
SendClientMessage(playerid, -1, "You're looking at your object.");
}
else if (objectid == INVALID_OBJECT_ID) // INVALID_OBJECT_ID = 65535
{
SendClientMessage(playerid, -1, "You're not looking at any object.");
}
return 1;
}
return 0;
}
```
## บันทึก
:::warning
This function is disabled by default to save bandwidth. Use EnablePlayerCameraTarget to enable it for each player.
:::
## ฟังก์ชั่นที่เกี่ยวข้องกัน
- [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/GetPlayerCameraTargetObject.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/th/scripting/functions/GetPlayerCameraTargetObject.md",
"repo_id": "openmultiplayer",
"token_count": 833
} | 434 |
---
title: GetPlayerLastShotVectors
description: Retrieves the start and end (hit) position of the last bullet a player fired.
tags: ["player"]
---
## คำอธิบาย
Retrieves the start and end (hit) position of the last bullet a player fired.
| Name | Description |
| --------------- | --------------------------------------------------------------------------------------- |
| playerid | The ID of the player to get the last bullet shot information of. |
| &Float:fOriginX | A float variable in which to save the X coordinate of where the bullet originated from. |
| &Float:fOriginY | A float variable in which to save the Y coordinate of where the bullet originated from. |
| &Float:fOriginZ | A float variable in which to save the Z coordinate of where the bullet originated from. |
| &Float:fHitPosX | A float variable in which to save the X coordinate of where the bullet hit. |
| &Float:fHitPosY | A float variable in which to save the Y coordinate of where the bullet hit. |
| &Float:fHitPosY | A float variable in which to save the Z coordinate of where the bullet hit. |
## ส่งคืน
1: The function executed successfully.
0: The function failed to execute. The player specified does not exist.
The position of the last bullet is stored in the specified variables.
## ตัวอย่าง
```c
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp(cmdtext, "/lastshot", true) == 0)
{
new lsString[128],
Float:fOriginX, Float:fOriginY, Float:fOriginZ,
Float:fHitPosX, Float:fHitPosY, Float:fHitPosZ;
GetPlayerLastShotVectors(playerid, fOriginX, fOriginY, fOriginZ, fHitPosX, fHitPosY, fHitPosZ);
format(lsString, 128, "Last Shot Information: Origin: %f, %f, %f. Hit position: %f, %f, %f", fOriginX, fOriginY, fOriginZ, fHitPosX, fHitPosY, fHitPosZ);
SendClientMessage(playerid, -1, lsString);
return 1;
}
return 0;
}
```
## บันทึก
:::warning
This function will only work when lag compensation is enabled. If the player hit nothing, the hit positions will be 0. This means you can't currently calculate how far a bullet travels through open air.
:::
## ฟังก์ชั่นที่เกี่ยวข้องกัน
- GetPlayerWeaponData: Find out information about weapons a player has.
- GetPlayerWeapon: Check what weapon a player is currently holding.
- VectorSize: Get the length (norm) of a vector.
- OnPlayerWeaponShot: Called when a player fires a weapon.
| openmultiplayer/web/docs/translations/th/scripting/functions/GetPlayerLastShotVectors.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/th/scripting/functions/GetPlayerLastShotVectors.md",
"repo_id": "openmultiplayer",
"token_count": 983
} | 435 |
---
title: GetPlayerSurfingVehicleID
description: Get the ID of the vehicle that the player is surfing (stuck to the roof of).
tags: ["player", "vehicle"]
---
## คำอธิบาย
Get the ID of the vehicle that the player is surfing (stuck to the roof of).
| Name | Description |
| -------- | ---------------------------------------------------------------- |
| playerid | The ID of the player you want to know the surfing vehicle ID of. |
## ส่งคืน
The ID of the vehicle that the player is surfing. If they are not surfing a vehicle or the vehicle they are surfing has no driver, INVALID_VEHICLE_ID. If the player specified is not connected, INVALID_VEHICLE_ID also.
## ตัวอย่าง
```c
new surf = GetPlayerSurfingVehicleID(playerid);
if (surf == INVALID_VEHICLE_ID)
{
SendClientMessage(playerid, COLOR_RED, "You are not surfing.");
}
```
## ฟังก์ชั่นที่เกี่ยวข้องกัน
- GetPlayerVehicleID: Get the ID of the vehicle the player is in.
- GetPlayerVehicleSeat: Check what seat a player is in.
| openmultiplayer/web/docs/translations/th/scripting/functions/GetPlayerSurfingVehicleID.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/th/scripting/functions/GetPlayerSurfingVehicleID.md",
"repo_id": "openmultiplayer",
"token_count": 428
} | 436 |
---
title: GetSVarNameAtIndex
description: Retrieve the name of a sVar via the index.
tags: []
---
## คำอธิบาย
Retrieve the name of a sVar via the index.
| Name | Description |
| ------------- | ---------------------------------------------------------- |
| index | The index of the sVar. |
| ret_varname[] | A string to store the sVar's name in, passed by reference. |
| ret_len | The max length of the returned string, use sizeof(). |
## ส่งคืน
This function does not return any specific values.
## ฟังก์ชั่นที่เกี่ยวข้องกัน
- GetSVarType: Get the type of the server variable.
- GetSVarInt: Get a player server as an integer.
- GetSVarFloat: Get the previously set float from a server variable.
- GetSVarString: Get the previously set string from a server variable.
| openmultiplayer/web/docs/translations/th/scripting/functions/GetSVarNameAtIndex.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/th/scripting/functions/GetSVarNameAtIndex.md",
"repo_id": "openmultiplayer",
"token_count": 395
} | 437 |
---
title: GetVehicleParamsCarDoors
description: Allows you to retrieve the current state of a vehicle's doors.
tags: ["vehicle"]
---
:::warning
This function was added in SA-MP 0.3.7 and will not work in earlier versions!
:::
## คำอธิบาย
Allows you to retrieve the current state of a vehicle's doors
| Name | Description |
| ---------- | ----------------------------------------------------------------------- |
| vehicleid | The ID of the vehicle |
| &driver | The integer to save the state of the driver's door to. |
| &passenger | The integer to save the state of the passenger's door to. |
| &backleft | The integer to save the state of the rear left door to (if available). |
| &backright | The integer to save the state of the rear right door to (if available). |
## ส่งคืน
The vehicle's doors state is stored in the specified variables.
## บันทึก
:::tip
The values returned in each variable are as follows:
-1: Door state not set 1: Open 0: Closed
:::
## ฟังก์ชั่นที่เกี่ยวข้องกัน
- SetVehicleParamsCarDoors: Open and close the doors of a vehicle.
- SetVehicleParamsCarWindows: Open and close the windows of a vehicle.
- GetVehicleParamsCarWindows: Retrive the current state of a vehicle's windows
| openmultiplayer/web/docs/translations/th/scripting/functions/GetVehicleParamsCarDoors.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/th/scripting/functions/GetVehicleParamsCarDoors.md",
"repo_id": "openmultiplayer",
"token_count": 564
} | 438 |
---
title: InterpolateCameraLookAt
description: Interpolate a player's camera's 'look at' point between two coordinates with a set speed.
tags: []
---
## คำอธิบาย
Interpolate a player's camera's 'look at' point between two coordinates with a set speed. Can be be used with InterpolateCameraPos.
| Name | Description |
| ----------- | ---------------------------------------------------------------------------------------------------------------------------------- |
| playerid | The ID of the player the camera should be moved for |
| Float:FromX | The X position the camera should start to move from |
| Float:FromY | The Y position the camera should start to move from |
| Float:FromZ | The Z position the camera should start to move from |
| Float:ToX | The X position the camera should move to |
| Float:ToY | The Y position the camera should move to |
| Float:ToZ | The Z position the camera should move to |
| time | Time in milliseconds to complete interpolation |
| cut | The ['jumpcut'](../resources/cameracutstyles.md) to use. Defaults to CAMERA_CUT (pointless). Set to CAMERA_MOVE for interpolation. |
## ส่งคืน
This function does not return any specific values.
## ตัวอย่าง
```c
public OnPlayerCommandText(playerid, cmdtext[])
{
if (!strcmp(cmdtext, "/rotateme", true))
{
TogglePlayerSpectating(playerid, 1);
InterpolateCameraLookAt(playerid, 50.0, 50.0, 10.0, -50.0, 50.0, 10.0, 10000, CAMERA_MOVE);
// x1 y1 z1 x2 y2 z2
// The camera starts off looking at (x1, y1, z1). It will then rotate and after
// 10000 milliseconds (10 seconds) it will be looking at (x2, y2, z2).
return 1;
}
return 0;
}
```
## บันทึก
:::tip
Use TogglePlayerSpectating to make objects stream in for the player while the camera is moving. You can reset the camera behind the player with SetCameraBehindPlayer.
:::
## ฟังก์ชั่นที่เกี่ยวข้องกัน
- [InterpolateCameraPos](../../scripting/functions/InterpolateCameraPos.md): Move a player's camera from one location to another.
- [SetPlayerCameraLookAt](../../scripting/functions/SetPlayerCameraLookAt.md): Set where a player's camera should face.
- [SetPlayerCameraPos](../../scripting/functions/SetPlayerCameraPos.md): Set a player's camera position.
| openmultiplayer/web/docs/translations/th/scripting/functions/InterpolateCameraLookAt.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/th/scripting/functions/InterpolateCameraLookAt.md",
"repo_id": "openmultiplayer",
"token_count": 1644
} | 439 |
---
title: IsTrailerAttachedToVehicle
description: Checks if a vehicle has a trailer attached to it.
tags: ["vehicle"]
---
## คำอธิบาย
Checks if a vehicle has a trailer attached to it. Use GetVehicleTrailer to get the vehicle ID of the trailer (if any).
| Name | Description |
| --------- | -------------------------------------------- |
| vehicleid | The ID of the vehicle to check for trailers. |
## ส่งคืน
1: The vehicle has a trailer attached.
0: The vehicle does not have a trailer attached.
## ตัวอย่าง
```c
if (IsTrailerAttachedToVehicle(vehicleid))
{
printf("Vehicle %i has a trailer!", vehicleid);
}
```
## ฟังก์ชั่นที่เกี่ยวข้องกัน
- [GetVehicleTrailer](../../scripting/functions/GetVehicleTrailer.md): Check what trailer a vehicle is pulling.
- [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/functions/IsTrailerAttachedToVehicle.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/th/scripting/functions/IsTrailerAttachedToVehicle.md",
"repo_id": "openmultiplayer",
"token_count": 421
} | 440 |
---
title: NetStats_ConnectionStatus
description: Gets the player's current connection status.
tags: []
---
## คำอธิบาย
Gets the player's current connection status.
| Name | Description |
| -------- | ----------------------------------------------------- |
| playerid | The ID of the player to get the connection status of. |
## ส่งคืน
The player's [connection status](../resources/connectionstatus.md), as an integer value.
## ตัวอย่าง
```c
public OnPlayerCommandText(playerid,cmdtext[])
{
if (!strcmp(cmdtext, "/connectionstatus"))
{
new szString[144];
format(szString, sizeof(szString), "Your current connection status: %i.", NetStats_ConnectionStatus(playerid));
SendClientMessage(playerid, -1, szString);
}
return 1;
}
```
## ฟังก์ชั่นที่เกี่ยวข้องกัน
- [GetPlayerNetworkStats](../functions/GetPlayerNetworkStats.md): Gets a player networkstats and saves it into a string.
- [GetNetworkStats](../functions/GetNetworkStats.md): Gets the servers networkstats and saves it into a string.
- [NetStats_GetConnectedTime](../functions/NetStats_GetConnectedTime.md): Get the time that a player has been connected for.
- [NetStats_MessagesReceived](../functions/NetStats_MessagesReceived.md): Get the number of network messages the server has received from the player.
- [NetStats_BytesReceived](../functions/NetStats_BytesReceived.md): Get the amount of information (in bytes) that the server has received from the player.
- [NetStats_MessagesSent](../functions/NetStats_MessagesSent.md): Get the number of network messages the server has sent to the player.
- [NetStats_BytesSent](../functions/NetStats_BytesSent.md): Get the amount of information (in bytes) that the server has sent to the player.
- [NetStats_MessagesRecvPerSecond](../functions/NetStats_MessagesRecvPerSecond.md): Get the number of network messages the server has received from the player in the last second.
- [NetStats_PacketLossPercent](../functions/NetStats_PacketLossPercent.md): Get a player's packet loss percent.
- [NetStats_GetIpPort](../functions/NetStats_GetIpPort.md): Get a player's IP and port.
- [IsPlayerConnected](../functions/IsPlayerConnected.md): Check if a player is connected to the server.
- [OnPlayerConnect](../callbacks/OnPlayerConnect.md): Called when a player connects to the server.
- [OnPlayerDisconnect](../callbacks/OnPlayerDisconnect.md): Called when a player leaves the server.
| openmultiplayer/web/docs/translations/th/scripting/functions/NetStats_ConnectionStatus.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/th/scripting/functions/NetStats_ConnectionStatus.md",
"repo_id": "openmultiplayer",
"token_count": 833
} | 441 |
---
title: PlayerTextDrawDestroy
description: Destroy a player-textdraw.
tags: ["player", "textdraw", "playertextdraw"]
---
## คำอธิบาย
Destroy a player-textdraw.
| Name | Description |
| -------- | ------------------------------------------------------ |
| playerid | The ID of the player who's player-textdraw to destroy. |
| text | The ID of the textdraw to destroy. |
## ส่งคืน
This function does not return any specific values.
## ตัวอย่าง
```c
new PlayerText:pTextdraw[MAX_PLAYERS];
public OnPlayerConnect(playerid)
{
pTextdraw[playerid] = CreatePlayerTextDraw(playerid, x, y, "...");
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
PlayerTextDrawDestroy(playerid, pTextdraw[playerid]);
return 1;
}
```
## ฟังก์ชั่นที่เกี่ยวข้องกัน
- CreatePlayerTextDraw: Create 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.
- PlayerTextDrawSetString: Set the text of a player-textdraw.
- PlayerTextDrawShow: Show a player-textdraw.
- PlayerTextDrawHide: Hide a player-textdraw.
| openmultiplayer/web/docs/translations/th/scripting/functions/PlayerTextDrawDestroy.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/th/scripting/functions/PlayerTextDrawDestroy.md",
"repo_id": "openmultiplayer",
"token_count": 687
} | 442 |
---
title: RemoveBuildingForPlayer
description: Removes a standard San Andreas model for a single player within a specified range.
tags: ["player"]
---
:::warning
This function was added in SA-MP 0.3d and will not work in earlier versions!
:::
## คำอธิบาย
Removes a standard San Andreas model for a single player within a specified range.
| Name | Description |
| ------------- | --------------------------------------------------------------------------------- |
| playerid | The ID of the player to remove the objects for. |
| modelid | The model to remove. |
| Float:fX | The X coordinate around which the objects will be removed. |
| Float:fY | The Y coordinate around which the objects will be removed. |
| Float:fZ | The Z coordinate around which the objects will be removed. |
| Float:fRadius | The radius around the specified point to remove objects with the specified model. |
## ส่งคืน
This function does not return any specific values.
## ตัวอย่าง
```c
public OnPlayerConnect(playerid)
{
// When the player connects, objects with model 615 will be removed within a
// range of 200.0 from the point 0.0, 0.0, 0.0, which is the center of San Andreas.
RemoveBuildingForPlayer(playerid, 615, 0.0, 0.0, 0.0, 200.0);
return 1;
}
public OnPlayerConnect(playerid)
{
// When the player connects, all map objects will be removed.
RemoveBuildingForPlayer(playerid, -1, 0.0, 0.0, 0.0, 6000.0);
return 1;
}
```
## บันทึก
:::tip
In SA-MP 0.3.7 you can use -1 for the modelid to remove all objects within the specified radius.
:::
:::warning
There appears to be a limit of around 1000 lines/objects. There is no workaround. When removing the same object for a player, they will crash. Commonly, players crash when reconnecting to the server because the server removes buildings on OnPlayerConnect.
:::
## ฟังก์ชั่นที่เกี่ยวข้องกัน
- [DestroyObject](../functions/DestroyObject.md): Destroy an object.
- [DestroyPlayerObject](../functions/DestroyPlayerObject.md): Destroy a player object.
| openmultiplayer/web/docs/translations/th/scripting/functions/RemoveBuildingForPlayer.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/th/scripting/functions/RemoveBuildingForPlayer.md",
"repo_id": "openmultiplayer",
"token_count": 938
} | 443 |
---
title: SetObjectPos
description: Change the position of an object.
tags: []
---
## คำอธิบาย
Change the position of an object.
| Name | Description |
| -------- | ---------------------------------------------------------------------- |
| objectid | The ID of the object to set the position of. Returned by CreateObject. |
| Float:X | The X coordinate to position the object at. |
| Float:Y | The Y coordinate to position the object at. |
| Float:Z | The Z coordinate to position the object at. |
## ส่งคืน
This function always returns 1, even if the object specified does not exist.
## ตัวอย่าง
```c
SetObjectPos(objectid, 2001.195679, 1547.113892, 14.283400);
```
## ฟังก์ชั่นที่เกี่ยวข้องกัน
- 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.
- 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.
- 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.
- 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.
| openmultiplayer/web/docs/translations/th/scripting/functions/SetObjectPos.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/th/scripting/functions/SetObjectPos.md",
"repo_id": "openmultiplayer",
"token_count": 675
} | 444 |
---
title: SetPlayerFacingAngle
description: Set a player's facing angle (Z rotation).
tags: ["player"]
---
## คำอธิบาย
Set a player's facing angle (Z rotation).
| Name | Description |
| --------- | ------------------------------------------------ |
| playerid | The ID of the player to set the facing angle of. |
| Float:ang | The angle the player should face. |
## ส่งคืน
1: The function executed successfully.
0: The function failed to execute. The player specified does not exist.
## ตัวอย่าง
```c
SetPlayerFacingAngle( playerid, 0 ); //Player faces north
```
```
north (0)
|
(90) west- -east (270) (Good way to remember: Never Eat Shredded Wheat)
|
south (180)
```
## บันทึก
:::warning
Angles are reversed in GTA:SA; 90 degrees would be East in the real world, but in GTA:SA 90 degrees is in fact West. North and South are still 0/360 and 180. To convert this, simply do 360 - angle.
:::
## ฟังก์ชั่นที่เกี่ยวข้องกัน
- GetPlayerFacingAngle: Check where a player is facing.
- SetPlayerPos: Set a player's position.
| openmultiplayer/web/docs/translations/th/scripting/functions/SetPlayerFacingAngle.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/th/scripting/functions/SetPlayerFacingAngle.md",
"repo_id": "openmultiplayer",
"token_count": 503
} | 445 |
---
title: SetPlayerScore
description: Set a player's score.
tags: ["player"]
---
## คำอธิบาย
Set a player's score. Players' scores are shown in the scoreboard (shown by holding the TAB key).
| Name | Description |
| -------- | ----------------------------------------- |
| playerid | The ID of the player to set the score of. |
| score | The value to set the player's score to. |
## ส่งคืน
1: The function executed successfully.
0: The function failed to execute. This means the player specified does not exist.
## ตัวอย่าง
```c
public OnPlayerDeath(playerid, killerid, WEAPON:reason)
{
// Add 1 to this killer's score. We must check it is valid first.
if (killerid != INVALID_PLAYER_ID)
{
SetPlayerScore(killerid, GetPlayerScore(killerid) + 1);
}
return 1;
}
```
## ฟังก์ชั่นที่เกี่ยวข้องกัน
- GetPlayerScore: Get the score of a player.
| openmultiplayer/web/docs/translations/th/scripting/functions/SetPlayerScore.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/th/scripting/functions/SetPlayerScore.md",
"repo_id": "openmultiplayer",
"token_count": 400
} | 446 |
---
title: SetTeamCount
description: This function is used to change the amount of teams used in the gamemode.
tags: []
---
## คำอธิบาย
This function is used to change the amount of teams used in the gamemode. It has no obvious way of being used, but can help to indicate the number of teams used for better (more effective) internal handling. This function should only be used in the OnGameModeInit callback. Important: You can pass 2 billion here if you like, this function has no effect at all.
| Name | Description |
| ----- | ----------------------------------- |
| teams | Number of teams the gamemode knows. |
## ส่งคืน
This function does not return any specific values.
## ตัวอย่าง
```c
public OnGameModeInit( )
{
// We use 18 teams in this use Team-Deathmatch mode, define it;
SetTeamCount( 18 );
return 1;
}
```
## ฟังก์ชั่นที่เกี่ยวข้องกัน
- GetPlayerTeam: Check what team a player is on.
- SetPlayerTeam: Set a player's team.
| openmultiplayer/web/docs/translations/th/scripting/functions/SetTeamCount.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/th/scripting/functions/SetTeamCount.md",
"repo_id": "openmultiplayer",
"token_count": 374
} | 447 |
---
title: SetWorldTime
description: Sets the world time (for all players) to a specific hour.
tags: []
---
## คำอธิบาย
Sets the world time (for all players) to a specific hour.
| Name | Description |
| ---- | ---------------------- |
| hour | The hour to set (0-23) |
## ส่งคืน
This function does not return any specific values.
## ตัวอย่าง
```c
// Set the time to 12 o'clock (noon)
SetWorldTime(12);
```
## บันทึก
:::tip
This function is only relevant for players that do not use a passing clock - see TogglePlayerClock.
:::
:::tip
To set the minutes and/or to set the time for individual players, see SetPlayerTime.
:::
## ฟังก์ชั่นที่เกี่ยวข้องกัน
- SetPlayerTime: Set a player's time.
- SetWeather: Set the global weather.
- SetGravity: Set the global gravity.
| openmultiplayer/web/docs/translations/th/scripting/functions/SetWorldTime.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/th/scripting/functions/SetWorldTime.md",
"repo_id": "openmultiplayer",
"token_count": 348
} | 448 |
---
title: TextDrawColor
description: Sets the text color of a textdraw.
tags: ["textdraw"]
---
## คำอธิบาย
Sets the text color of a textdraw
| Name | Description |
| ----- | ----------------------------------------------- |
| text | The ID of the textdraw to change the color of.. |
| color | The color to set the textdraw to. |
## ส่งคืน
This function does not return any specific values.
## ตัวอย่าง
```c
new Text:Example;
public OnGameModeInit()
{
Example = TextDrawCreate(123.0, 123.0, "Example");
TextDrawColor(Example, 0x000000FF);
return 1;
}
```
## บันทึก
:::tip
If the TextDraw is already shown, it must be re-shown (TextDrawShowForAll/TextDrawShowForPlayer) for the changes of this function to take effect.
:::
## ฟังก์ชั่นที่เกี่ยวข้องกัน
- [TextDrawCreate](../functions/TextDrawCreate.md): Create a textdraw.
- [TextDrawDestroy](../functions/TextDrawDestroy.md): Destroy 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.
- [TextDrawSetProportional](../functions/TextDrawSetProportional.md): Scale the text spacing in a textdraw to a proportional ratio.
- [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/TextDrawColor.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/th/scripting/functions/TextDrawColor.md",
"repo_id": "openmultiplayer",
"token_count": 872
} | 449 |
---
title: TextDrawShowForPlayer
description: Shows a textdraw for a specific player.
tags: ["player", "textdraw"]
---
## คำอธิบาย
Shows a textdraw for a specific player.
| Name | Description |
| -------- | ----------------------------------------------------------- |
| playerid | The ID of the player to show the textdraw for. |
| text | The ID of the textdraw to show. Returned by TextDrawCreate. |
## ส่งคืน
1: The function executed successfully.
0: The function failed to execute. This means either the player and/or textdraw specified does not exist.
## ตัวอย่าง
```c
public OnPlayerConnect(playerid)
{
new Text:textid = TextDrawCreate(100.0, 100.0, "Welcome!");
TextDrawShowForPlayer(playerid, textid);
}
```
## บันทึก
:::tip
If only a single player will see a textdraw, it might be wise to use player-textdraws instead. This is also useful for textdraws that need to show information specific for an individual 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/TextDrawShowForPlayer.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/th/scripting/functions/TextDrawShowForPlayer.md",
"repo_id": "openmultiplayer",
"token_count": 535
} | 450 |
---
title: db_num_fields
description: Get the number of fields in a result.
tags: ["sqlite"]
---
:::warning
This function starts with lowercase letter.
:::
## คำอธิบาย
Get the number of fields in a result.
| Name | Description |
| ----------------- | ----------------------- |
| DBResult:dbresult | The result of db_query. |
## ส่งคืน
The number of fields in the result.
## ตัวอย่าง
```c
// ...
// Declare "db_result" and select all rows and columns from "spawn_list"
new DBResult:db_result = db_query(db_handle, "SELECT * FROM `spawn_list` WHERE 1;");
// Print the amount of columns selected
printf("Selected columns: %d", db_num_fields(db_result));
// Do...
do
{
// ...
}
// While next row has been fetched
while(db_next_row(db_handle));
// Frees result
db_free_result(db_result);
// ...
```
## บันทึก
:::warning
Using an invalid handle will crash your server! Get a valid handle by using db_query. But it's protected against NULL references.
:::
## ฟังก์ชั่นที่เกี่ยวข้องกัน
- db_open: Open a connection to an SQLite database
- db_close: Close the connection to an SQLite database
- db_query: Query an SQLite database
- db_free_result: Free result memory from a db_query
- db_num_rows: Get the number of rows in a result
- db_next_row: Move to the next row
- db_num_fields: Get the number of fields in a result
- db_field_name: Returns the name of a field at a particular index
- db_get_field: Get content of field with specified ID from current result row
- db_get_field_assoc: Get content of field with specified name from current result row
- db_get_field_int: Get content of field as an integer with specified ID from current result row
- db_get_field_assoc_int: Get content of field as an integer with specified name from current result row
- db_get_field_float: Get content of field as a float with specified ID from current result row
- db_get_field_assoc_float: Get content of field as a float with specified name from current result row
- db_get_mem_handle: Get memory handle for an SQLite database that was opened with db_open.
- db_get_result_mem_handle: Get memory handle for an SQLite query that was executed with db_query.
- db_debug_openfiles
- db_debug_openresults
| openmultiplayer/web/docs/translations/th/scripting/functions/db_num_fields.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/th/scripting/functions/db_num_fields.md",
"repo_id": "openmultiplayer",
"token_count": 774
} | 451 |
---
title: floatcos
description: Get the cosine from a given angle.
tags: []
---
:::warning
This function starts with lowercase letter.
:::
## คำอธิบาย
Get the cosine 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 cosine. |
| anglemode | The angle mode to use, depending on the value entered. |
## ส่งคืน
The cosine of the value entered.
## ตัวอย่าง
```c
public OnGameModeInit()
{
printf("The cosine from 90° is %f", floatcos(90.0, degrees));
// Output: 0
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.
- [floattan](../functions/floattan): Get the tangent from a specific angle.
| openmultiplayer/web/docs/translations/th/scripting/functions/floatcos.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/th/scripting/functions/floatcos.md",
"repo_id": "openmultiplayer",
"token_count": 522
} | 452 |
---
title: fread
description: Read a single line from a file.
tags: []
---
:::warning
This function starts with lowercase letter.
:::
## คำอธิบาย
Read a single line from a file.
| Name | Description |
| ------ | -------------------------------------------------------------- |
| handle | The handle of the file to read from (returned by fopen). |
| string | A string array to store the read text in, passed by reference. |
| size | The number of bytes to read. |
| pack | Should the string be packed? True/false. |
## ส่งคืน
The length of string (the read text) as an integer.
## ตัวอย่าง
```c
// Open "file.txt" in "read only" mode
new File:handle = fopen("file.txt", io_read),
// Initialize "buf"
buf[128];
// Check, if the file is opened
if (handle)
{
// Success
// Read the whole file
while(fread(handle, buf)) print(buf);
// Close the file
fclose(handle);
}
else
{
// Error
print("The file \"file.txt\" does not exists, or can't be opened.");
}
// Open "file.txt" in "read and write" mode
new File:handle = fopen("file.txt"),
// Initialize "buf"
buf[128];
// Check, if file is open
if (handle)
{
// Success
// Read the whole file
while(fread(handle, buf)) print(buf);
// Set the file pointer to the first byte
fseek(handle, _, seek_begin);
// Write "I just wrote here!" into this file
fwrite(handle, "I just wrote here!");
// Close the file
fclose(handle);
}
else
{
// Error
print("The file \"file.txt\" does not exists, or can't be opened.");
}
```
## บันทึก
:::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/fread.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/th/scripting/functions/fread.md",
"repo_id": "openmultiplayer",
"token_count": 1074
} | 453 |
---
title: numargs
description: Get the number of arguments passed to a function.
tags: []
---
:::warning
This function starts with lowercase letter.
:::
## คำอธิบาย
Get the number of arguments passed to a function.
| Name | Description |
| ---- | ----------- |
## ตัวอย่าง
```c
SomeFunction(...)
{
printf("numargs(): %i", numargs());
}
public OnFilterScriptInit()
{
SomeFunction(1, 2, 3);
}
// Output: "numargs(): 3"
// Because 3 parameters (1, 2, 3) were passed.
```
## ฟังก์ชั่นที่เกี่ยวข้องกัน
- [getarg](../functions/getarg.md): Retrieve an argument from a variable argument list.
- [setarg](../functions/setarg.md): Set an argument.
| openmultiplayer/web/docs/translations/th/scripting/functions/numargs.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/th/scripting/functions/numargs.md",
"repo_id": "openmultiplayer",
"token_count": 293
} | 454 |
---
title: strunpack
description: This function can be used to unpack a string.
tags: []
---
:::warning
This function starts with lowercase letter.
:::
## คำอธิบาย
This function can be used to unpack a string.
| Name | Description |
| ----------------------- | --------------------------------------------------------------------------- |
| dest[] | The destination string to save the unpacked string in, passed by reference. |
| const source[] | The source, original packed string. |
| maxlength=sizeof string | The maximum size to insert. |
## ส่งคืน
The number of characters packed.
## ตัวอย่าง
```c
new string[17];
new pstring[17 char] = !"Hi, how are you?";
strunpack(string, pstring);
```
## ฟังก์ชั่นที่เกี่ยวข้องกัน
- ispacked: Check if the given string is packed.
- strpack: This function can be used to pack a string.
- strcmp: Compare two strings to see if they are the same.
- strfind: Search for a substring in a string.
- strtok: Search for a variable typed after a space.
- strdel: Delete part/all of a string.
- strins: Put a string into another string.
- strlen: Check the length of a string.
- strmid: Extract characters from a string.
- strval: Find the value of a string.
- strcat: Contact two strings into a destination reference.
| openmultiplayer/web/docs/translations/th/scripting/functions/strunpack.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/th/scripting/functions/strunpack.md",
"repo_id": "openmultiplayer",
"token_count": 630
} | 455 |
---
title: Original Car Colors
description: A list of the original car colours from single player.
---
Here is a list of the original car colors used by each car type in single player.
**admiral:** 34,34, 35,35, 37,37, 39,39, 41,41, 43,43, 45,45, 47,47
**alpha:** 58,1, 69,1, 75,77, 18,1, 32,1, 45,45, 13,1, 34,1
**ambulan:** 1,3
**androm:** 1,1
**artict1:** 1,1
**artict2:** 1,1
**artict3:** 1,1
**at400:** 1,3, 8,7, 8,10, 8,16, 23,31, 40,44
**baggage:** 1,73, 1,74, 1,75, 1,76, 1,77, 1,78, 1,79
**bandito:** 2,39, 9,39, 17,1, 21,1, 33,0, 37,0, 41,29, 56,29
**banshee:** 12,12, 13,13, 14,14, 1,2, 2,1, 1,3, 3,1, 10,10
**barracks:** 43,0
**beagle:** 3,90, 4,90, 7,68, 8,66, 12,60, 27,97, 34,51, 37,51
**benson:** 109,25, 109,32, 112,32, 10,32, 30,44, 32,52, 84,66, 84,69
**bf400:** 54,1, 58,1, 66,1, 72,1, 75,1, 87,1, 101,1, 36,1
**bfinject:** 1,0, 2,2, 3,2, 3,6, 6,16, 15,30, 24,53, 35,61
**bike:** 7,1, 74,1, 61,1, 16,1, 25,1, 30,1, 36,1, 53,1
**blade:** 9,1, 12,1, 26,96, 30,96, 32,1, 37,1, 57,96, 71,96
**blistac:** 74,72, 66,72, 53,56, 37,19, 22,22, 20,20, 9,14, 0,0
**bloodra:** 51,39, 57,38, 45,29, 34,9, 65,9, 14,1, 12,9, 26,1
**bmx:** 1,1, 3,3, 6,6, 46,46, 65,9, 14,1, 12,9, 26,1
**bobcat:** 96,25, 97,25, 101,25, 111,31, 113,36, 83,57, 67,59
**boxburg:** 36,36
**boxville:** 11,123, 13,120, 20,117, 24,112, 27,107, 36,105, 37,107, 43,93
**bravura:** 41,41, 47,47, 52,52, 66,66, 74,74, 87,87,91,91, 113,113
**broadway:** 12,1, 19,96, 31,64, 25,96, 38,1, 51,96, 57,1, 66,96
**buccanee:** 2,39, 9,39, 17,1, 21,1, 33,0, 37,0, 41,29, 56,29
**buffalo:** 10,10, 13,13, 22,22, 30,30, 39,39, 90,90, 98,98, 110,110
**bullet:** 51,1, 58,8, 60,1, 68,8, 2,1, 13,8, 22,1, 36,8
**burrito:** 41,41, 48,48, 52,52, 64,64, 71,71, 85,85, 10,10, 62,62
**bus:** 71,59, 75,59, 92,72, 47,74, 55,83, 59,83, 71,87, 82,87
**cabbie:** 6,76
**caddy:** 58,1, 2,1, 63,1, 18,1, 32,1, 45,1, 13,1, 34,1
**cadrona:** 52,1, 53,1, 66,1, 75,1, 76,1, 81,1, 95,1, 109,1
**cargobob:** 1,1
**cheetah:** 20,1, 25,1, 36,1, 40,1 62,1, 75,1, 92,1, 0,1
**clover:** 13,118, 24,118, 31,93, 32,92, 45,92, 113,92, 119,113, 122,113
**club:** 37,37, 31,31, 23,23, 22,22, 7,7, 124,124, 114,114, 112,112
**coach:** 54,7, 79,7, 87,7, 95,16, 98,20, 105,20, 123,20, 125,21
**coastg:** 56,15, 56,53
**come:** 73,45, 12,12, 2,2, 6,6, 4,4, 46,46, 53,53
**copcarla:** 0,1
**copcarsf:** 0,1
**copcarvg:** 0,1
**copcarru:** 0,1
**cropdust:** 17,39, 15,123, 32,112, 45,88, 52,71, 57,67, 61,96, 96,96
**dft30:** 1,1
**dinghy:** 56,15, 56,53
**dodo:** 51,1, 58,8, 60,1, 68,8, 2,1, 13,8, 22,1, 36,8
**dozer:** 1,1
**dumper:** 1,1
**duneride:** 91,38, 115,43, 85,6, 79,7, 78,8, 77,18, 79,18, 86,24
**elegant:** 37,37, 42,42, 53,53, 62,62, 7,7, 10,10, 11,11, 15,15
**elegy:** 36,1, 35,1, 17,1, 11,1, 116,1, 113,1, 101,1, 92,1
**emperor:** 37,37, 42,42, 53,53, 62,62, 7,7, 10,10, 11,11, 15,15
**enforcer:** 0,1
**esperant:** 45,75, 47,76, 33,75, 13,76, 54,75, 69,76, 59,75, 87,76
**euros:** 36,1, 40,1, 43,1, 53,1, 72,1, 75,1, 95,1, 101,1
**faggio:** 12,12, 13,13, 14,14, 1,2, 2,1, 1,3, 3,1, 10,10
**fbiranch:** 0,0
**fcr900:** 74,74, 75,13, 87,118, 92,3, 115,118, 25,118, 36,0, 118,118
**feltzer:** 73,1, 74,1, 75,1, 77,1, 79,1, 83,1, 84,1, 91,1
**firela:** 3,1
**firetruk:** 3,1
**flash:** 37,37, 42,42, 53,53, 62,62, 7,7, 10,10, 11,11, 15,15
**flatbed:** 84,15, 84,58, 84,31, 32,74, 43,31, 1,31, 77,31, 32,74
**forklift:** 110,1, 111,1, 112,1, 114,1, 119,1, 122,1, 4,1, 13,1
**fortune:** 2,39, 9,39, 17,1, 21,1, 33,0, 37,0, 41,29, 56,29
**freeway:** 79,79, 84,84, 7,7, 11,11, 19,19, 22,22, 36,36, 53,53
**freight:** 1,1
**glendale:** 67,76, 68,76, 78,76, 2,76, 16,76, 18,76, 25,76, 45,88
**glenshit:** 67,76, 68,76, 78,76, 2,76, 16,76, 18,76, 25,76, 45,88
**greenwoo:** 30,26, 77,26, 81,27, 24,55, 28,56, 49,59, 52,69, 71,107
**hermes:** 97,1, 81,1, 105,1, 110,1, 91,1, 74,1, 84,1, 83,1
**hotdog:** 1,1
**hotknife:** 1,1, 12,12, 2,2, 6,6, 4,4, 46,46, 53,53
**hotrina:** 7,94, 36,88, 51,75, 53,75 ,58,67, 75,67, 75,61, 79,62
**hotrinb:** 83,66, 87,74, 87,75, 98,83, 101,100, 103,101, 117,116, 123,36
**hotring:** 36,117, 36,13, 42,30, 42,33, 54,36, 75,79, 92,101, 98,109
**hunter:** 43,0
**huntley:** 37,37, 42,42, 53,53, 62,62, 7,7, 10,10, 11,11, 15,15
**hustler:** 50,1, 47,1, 44,96, 40,96, 39,1, 30,1, 28,96, 9,96
**infernus:** 12,1, 64,1, 123,1, 116,1, 112,1, 106,1, 80,1, 75,1
**intruder:** 62,37, 78,38, 2,62, 3,87, 2,78, 113,78, 119,62, 7,78
**jester:** 51,1, 58,8, 60,1, 68,8, 2,1, 13,8, 22,1, 36,8
**jetmax:** 36,13
**journey:** 1,1
**kart:** 2,35, 36,2, 51,53, 91,2, 11,22, 40,35
**landstal:** 4,1, 123,1, 113,1, 101,1, 75,1, 62,1, 40,1, 36,1
**launch:** 112,20
**linerun:** 36,1, 37,1, 30,1, 28,1, 25,1, 40,1, 101,1, 113,1
**quad:** 120,117, 103,111, 120,114, 74,91, 120,112, 74,83, 120,113, 66,71
**majestic:** 37,36, 36,36, 40,36, 43,41, 47,41, 51,72, 54,75, 55,84
**mtbike:** 43,43, 46,46, 39,39, 28,28, 16,16, 6,6, 5,5, 2,2
**manana:** 4,1, 9,1, 10,1, 25,1, 36,1, 40,1, 45,1, 84,1
**marquis:** 12,35, 50,32, 40,26, 66,36
**maverick:** 26,14, 29,42, 26,57, 54,29, 26,3, 3,29, 12,39, 74,35
**merit:** 67,1, 72,1, 75,1, 83,1, 91,1, 101,1, 109,1, 20,1
**mesa:** 75,84, 40,84, 40,110, 28,119, 25,119, 21,119, 13,119, 4,119
**monster:** 32,36, 32,42, 32,53, 32,66, 32,14, 32,32
**monstera:** 1,1
**monsterb:** 1,1
**moonbeam:** 119,119, 117,227, 114,114, 108,108, 95,95, 81,81, 61,61, 41,41
**mower:** 94,1, 101,1, 116,1, 117,1, 4,1, 25,1, 30,1, 37,1
**mrwhoop:** 1,16, 1,56, 1,17, 1,53, 1,5, 1,35
**mule:** 25,1, 28,1, 43,1, 67,1, 72,1, 9,1, 95,1, 24,1
**nebula:** 116,1, 119,1, 122,1, 4,1, 9,1, 24,1, 27,1, 36,1
**nevada:** 38,9, 55,23, 61,74, 71,87, 91,87, 98,114, 102,119, 111,3
**newsvan:** 41,10, 41,20, 49,11, 56,123, 110,113, 112,116, 114,118, 119,101
**nrg500:** 3,3, 3,8, 6,25, 7,79, 8,82, 36,105, 39,106, 51,118
**oceanic:** 51,1, 58,8, 60,1, 68,8, 2,1, 13,8, 22,1, 36,8
**packer:** 4,1, 20,1, 24,1, 25,1, 36,1, 40,1, 54,1, 84,1
**patriot:** 43,0
**pcj600:** 36,1, 37,1, 43,1, 53,1, 61,1, 75,1, 79,1, 88,1
**peren:** 113,39, 119,50, 123,92, 109,100, 101,101, 95,105, 83,110, 66,25
**petro:** 10,1, 25,1, 28,1, 36,1, 40,1, 54,1, 75,1, 113,1
**petrotr:** 1,1
**phoenix:** 58,1, 69,1, 75,77, 18,1, 32,1, 45,45, 13,1, 34,1
**picador:** 81,8, 32,8, 43,8, 67,8, 11,11, 8,90, 2,2, 83,13
**pizzaboy:** ,3,6
**polmav:** 0,1
**pony:** 87,1, 88,1, 91,1, 105,1, 109,1, 119,1, 4,1, 25,1
**predator:** 46,26
**premier:** 37,37, 42,42, 53,53, 62,62, 7,7, 10,10, 11,11, 15,15
**previon:** 83,1, 87,1, 92,1, 95,1, 109,1, 119,45, 11,1,
**primo:** 122,1, 123,1, 125,1, 10,1, 24,1, 37,1, 55,1, 66,1
**raindanc:** 1,6
**rancher:** 13,118, 14,123, 120,123, 112,120, 84,110, 76,102
**rcbandit:** 2,96, 79,42, 82,54, 67,86, 126,96, 70,96, 110,54, 67,98
**rcbaron:** 14,75
**rcraider:** 14,75
**rcgoblin:** 14,75
**rdtrain:** 13,76, 24,77, 63,78, 42,76, 54,77, 39,78, 11,76, 62,77
**reefer:** 56,56
**regina:** 27,36, 59,36, 60,35, 55,41, 54,31, 49,23, 45,32, 40,29
**remingtn:** 37,37, 42,42, 53,53, 62,62, 7,7, 10,10, 11,11, 15,15
**rhino:** 43,0
**rnchlure:** 13,118, 14,123, 120,123, 112,120, 84,110, 76,102
**romero:** 0,0, 11,105, 25,109, 36,0, 40,36, 75,36, 0,36, 0,109
**rumpo:** 34,34, 32,32, 20,20, 110,110, 66,66, 84,84, 118,118, 121,121
**rustler:** 6,7, 7,6, 1,6, 89,91, 119,117, 103,102, 77,87, 71,77
**sabre:** 2,39, 9,39, 17,1, 21,1, 33,0, 37,0, 41,29, 56,29
**sadler:** 76,8, 32,8, 43,8, 67,8, 11,11, 8,90, 2,2, 83,13
**sadlshit:** 61,8, 32,8, 43,8, 67,8, 11,11, 8,90, 2,2, 83,13
**sanchez:** 6,6, 46,46, 53,53, 3,3
**sandking:** 123,124, 119,122, 118,117, 116,115, 114,108, 101,106, 88,99, 5,6
**savanna:** 97,96, 88,64, 90,96, 93,64, 97,96, 99,81, 102,114, 114,1
**seaspar:** 75,2
**securica:** 4,75
**sentinel:** 11,1, 24,1, 36,1, 40,1, 75,1, 91,1, 123,1, 4,1
**shamal:** 1,1
**streak:** 1,1
**streakc:** 1,1
**skimmer:** 1,3, 1,9, 1,18, 1,30, 17,23, 46,23, 46,32, 57,34
**slamvan:** 3,1, 28,1, 31,1, 55,1, 66,1 97,1, 123,1, 118,1
**solair:** 91,1, 101,1, 109,1, 113,1, 4,1, 25,1, 30,1, 36,1
**sparrow:** 1,3
**speeder:** 1,3, 1,5, 1,16, 1,22, 1,35, 1,44, 1,53, 1,57
**stafford:** 92,92, 81,81, 67,67, 66,66, 61,61, 53,53, 51,51, 47,47, 43,43
**stallion:** 57,8, 8,17, 43,21, 54,38, 67,8, 37,78, 65,79, 25,78
**stratum:** 57,8, 8,17, 43,21, 54,38, 67,8, 37,78, 65,79, 25,78
**stretch:** 1,1
**stunt:** 38,51, 21,36, 21,34, 30,34, 54,34, 55,20, 48,18, 51,6
**sultan:** 52,39, 9,39, 17,1, 21,1, 33,0, 37,0, 41,29, 56,29
**sunrise:** 37,37, 42,42, 53,53, 62,62, 7,7, 10,10, 11,11, 15,15
**supergt:** 3,3, 6,6, 7,7, 52,52, 76,76
**swatvan:** 1,1
**sweeper:** 26,26
**tahoma:** 109,1, 30,8, 95,1, 84,8, 83,1, 72,8, 71,1, 52,8
**tampa:** 74,39, 72,39, 75,39, 79,39, 83,36, 84,36, 89,35, 91,35
**taxi:** 6,1
**topfun:** 26,26, 28,28, 44,44, 51,51, 57,57, 72,72, 106,106, 112,112
**tornado:** 67,1, 68,96, 72,1, 74,8, 75,96, 76,8, 79,1, 84,96
**towtruck:** 1,1, 17,20, 18,20, 22,30, 36,43, 44,51, 52,54
**tractor:** 2,35, 36,2, 51,53, 91,2, 11,22, 40,35
**tram:** 1,74
**trash:** 26,26
**tropic:** 26,26
**tug:** 1,1
**tugstair:** 1,1
**turismo:** 123,123, 125,125, 36,36, 16,16, 18,18, 46,46, 61,61, 75,75
**uranus:** 112,1, 116,1, 117,1, 24,1, 30,1, 35,1, 36,1, 40,1
**utility:** 56,56, 49,49, 26,124
**vcnmav:** 2,26, 2,29
**vincent:** 37,37, 42,42, 53,53, 62,62, 7,7, 10,10, 11,11, 15,15
**virgo:** 40,65, 71,72, 52,66, 64,72, 30,72, 60,72
**voodoo:** 9,1, 10,8, 11,1, 25,8, 27,1, 29,8, 30,1, 37,8
**vortex:** 96,67, 86,70, 79,74, 70,86, 61,98, 75,75, 75,91
**walton:** 72,1, 66,1, 59,1, 45,1, 40,1, 39,1, 35,1, 20,1
**washing:** 4,1, 13,1, 25,1, 30,1, 36,1, 40,1, 75,1, 95,1
**wayfarer:** 119,1, 122,1, 8,1, 10,1, 13,1, 25,1, 27,1, 32,1
**willard:** 37,37, 42,42, 53,53, 62,62, 7,7, 10,10, 11,11, 15,15
**windsor:** 51,1, 58,1, 60,1, 68,1, 2,1, 13,1, 22,1, 36,1
**yankee:** 84,63, 91,63, 102,65, 105,72, 110,93, 121,93, 12,95, 23,1
**yosemite:** 53,32, 15,32, 45,32, 34,30, 65,32, 14,32, 12,32, 43,32
**zr350:** 92,1, 94,1, 101,1, 121,1, 0,1, 22,1, 36,1, 75,1
The colors for the **camper**, **cement** and **squalo** are unavilable as they have four color IDs instead of two.
| openmultiplayer/web/docs/translations/th/scripting/resources/original-car-colors.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/th/scripting/resources/original-car-colors.md",
"repo_id": "openmultiplayer",
"token_count": 5861
} | 456 |
---
title: Per-player variable system
description: The per-player variable system (put short, PVar) is a new way of creating player variables in an efficient dynamically created method globally, meaning they can be used in server's gamemode and filterscripts at the same time.
---
The per-player variable system (put short, PVar) is a new way of creating player variables in an efficient dynamically created method globally, meaning they can be used in server's gamemode and filterscripts at the same time.
They are similar to [SVars](servervariablesystem), but are on a per-player basis. See the last 2 posts in this thread to read about the difference between pawn properties and PVars.
## Advantages
The new system introduced in SA-MP 0.3a R5 server updated has several major advantages over creating an array sized MAX_PLAYERS.
- PVars can be shared/accessed across gamemode scripts and filterscripts, making it easier to modularize your code.
- PVars are automatically deleted when a player leaves the server (after OnPlayerDisconnect), meaning you don't have to manually reset variables for the next player who joins.
- No real need for complex enums/player info structures.
- Saves memory by not allocating pawn array elements for playerids which will probably never be used.
- You can easily enumerate and print/store the PVar list. This makes both debugging and player info storage easier.
- Even if a PVar hasn't been created, it still will return a default value of 0.
- PVars can hold very large strings using dynamically allocated memory.
- You can Set, Get, Create PVars ingame.
## Drawbacks
- PVars are several times slower than regular variables. It is generally more favorable to trade in memory for speed, rather than the other way round.
## Functions
The functions for setting and retrieving the player variables are:
- [SetPVarInt](../scripting/functions/SetPVarInt) Set an integer for a player variable.
- [GetPVarInt](../scripting/functions/GetPVarInt) Get the previously set integer from a player variable.
- [SetPVarString](../scripting/functions/SetPVarString) Set a string for a player variable.
- [GetPVarString](../scripting/functions/GetPVarString) Get the previously set string from a player variable.
- [SetPVarFloat](../scripting/functions/SetPVarFloat) Set a float for a player variable.
- [GetPVarFloat](../scripting/functions/GetPVarFloat) Get the previously set float from a player variable.
- [DeletePVar](../scripting/functions/GetPVarFloat) Delete a player variable.
```c
#define PLAYER_VARTYPE_NONE (0)
#define PLAYER_VARTYPE_INT (1)
#define PLAYER_VARTYPE_STRING (2)
#define PLAYER_VARTYPE_FLOAT (3)
```
| openmultiplayer/web/docs/translations/th/tutorials/perplayervariablesystem.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/th/tutorials/perplayervariablesystem.md",
"repo_id": "openmultiplayer",
"token_count": 720
} | 457 |
---
title: OnFilterScriptInit
description: Bu callback bir filterscript çalıştırıldığında tetiklenir (yüklendiğinde).
tags: []
---
## Açıklama
Bu callback bir filterscript çalıştırıldığında tetiklenir (yüklendiğinde). Sadece çalıştırılan filterscript içinde çalışır.
## Örnekler
```c
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print("The filterscript is loaded.");
print("--------------------------------------\n");
return 1;
}
```
## Bağlantılı Fonksiyonlar
| openmultiplayer/web/docs/translations/tr/scripting/callbacks/OnFilterScriptInit.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/tr/scripting/callbacks/OnFilterScriptInit.md",
"repo_id": "openmultiplayer",
"token_count": 204
} | 458 |
---
title: OnPlayerEnterRaceCheckpoint
description: Bu callback, bir oyuncu yarış checkpointine girdiğinde çağırılır.
tags: ["player", "checkpoint", "racecheckpoint"]
---
## Açıklama
Bu callback, bir oyuncu yarış checkpointine girdiğinde çağırılır.
| İsim | Açıklama |
| -------- | ----------------------------------------------------- |
| playerid | Yarış checkpointine giren oyuncunun ID'si. |
## Çalışınca Vereceği Sonuçlar
Her zaman ilk olarak filterscriptlerde çağırılır.
## Örnekler
```c
public OnPlayerEnterRaceCheckpoint(playerid)
{
printf("%d ID'li oyuncu bir yarış checkpointine girdi!", playerid);
return 1;
}
```
## Notlar
<TipNPCCallbacks />
## Geri Döndürülen Değerler
- [SetPlayerCheckpoint](../functions/SetPlayerCheckpoint): Create a checkpoint for a player.
- [DisablePlayerCheckpoint](../functions/DisablePlayerCheckpoint): Disable the player's current checkpoint.
- [IsPlayerInCheckpoint](../functions/IsPlayerInRaceCheckpoint): Check if a player is in a checkpoint.
- [SetPlayerRaceCheckpoint](../functions/SetPlayerRaceCheckpoint): Create a race checkpoint for a player.
- [DisablePlayerRaceCheckpoint](../functions/DisablePlayerRaceCheckpoint): Disable the player's current race checkpoint.
- [IsPlayerInRaceCheckpoint](../functions/IsPlayerInRaceCheckpoint): Check if a player is in a race checkpoint.
| openmultiplayer/web/docs/translations/tr/scripting/callbacks/OnPlayerEnterRaceCheckpoint.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/tr/scripting/callbacks/OnPlayerEnterRaceCheckpoint.md",
"repo_id": "openmultiplayer",
"token_count": 507
} | 459 |
---
title: OnPlayerSelectObject
description: Bu fonksiyon, oyuncu SelectObject kullanıldıktan sonra bir obje seçtiğinde çağrılır.
tags: ["player"]
---
## Açıklama
Bu fonksiyon, oyuncu SelectObject kullanıldıktan sonra bir obje seçtiğinde çağrılır.
| Parametre | Açıklama |
| --------- | ---------------------------------------------------------- |
| playerid | Obje seçmiş olan oyuncunun ID'si. |
| type | Seçilmiş objenin [türü](../resources/selectobjecttypes). |
| objectid | Seçilen objenin ID'si. |
| modelid | Seçilmiş objenin modeli. |
| Float:fX | Seçilmiş objenin X koordinatı. |
| Float:fY | Seçilmiş objenin Y koordinatı. |
| Float:fZ | Seçilmiş objenin Z koordinatı. |
## Çalışınca Vereceği Sonuçlar
1 - Diğer komut dosyalarının bu fonksiyonu çağırmasını engelleyecektir.
0 - Bu fonksiyonun bir sonraki komuta geçirileceğini gösterir.
Filterscript komutlarında her zaman ilk olarak çağrılır.
## Örnekler
```c
public OnPlayerSelectObject(playerid, type, objectid, modelid, Float:fX, Float:fY, Float:fZ)
{
printf("%d ID'li oyuncu %d ID'li objeyi seçti.", playerid, objectid);
if (type == SELECT_OBJECT_GLOBAL_OBJECT)
{
EditObject(playerid, objectid);
}
else
{
EditPlayerObject(playerid, objectid);
}
SendClientMessage(playerid, 0xFFFFFFFF, "Artık obje düzenleyebilirsiniz!");
return 1;
}
```
## Bağlantılı Fonksiyonlar
- [SelectObject](../functions/SelectObject): Obje seçme.
| openmultiplayer/web/docs/translations/tr/scripting/callbacks/OnPlayerSelectObject.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/tr/scripting/callbacks/OnPlayerSelectObject.md",
"repo_id": "openmultiplayer",
"token_count": 889
} | 460 |
---
title: OnVehicleMod
description: Bu fonksiyon, herhangi bir araca modifiye uygulandığında çağrılır.
tags: ["vehicle"]
---
## Açıklama
Bu fonksiyon, herhangi bir araca modifiye uygulandığında çağrılır.
| Parametre | Açıklama |
| ----------- | ------------------------------------------------------- |
| playerid | Araç sürücüsünün ID'si. |
| vehicleid | Modifiye uygulanan aracın ID'si. |
| componentid | Araca eklenen bileşenin ID'si. |
## Çalışınca Vereceği Sonuçlar
Oyun modunda her zaman ilk olarak çağrılır, bu nedenle 0 döndürülürse, diğer filterscriptleri görmesi engellenir.
## Örnekler
```c
public OnVehicleMod(playerid, vehicleid, componentid)
{
printf("%d ID'li oyuncu %d ID'li araca %d numaralı bileşeni ekledi.", playerid, vehicleid,componentid);
if (GetPlayerInterior(playerid) == 0)
{
BanEx(playerid, "Tuning Hacks"); // Anti modifiye hilesi.
return 0; // Kötü değişikliklerin diğer oyuncularla senkronize edilmesini engeller
//Test edildi ve aracınızı komutlar, menüler, diyaloglar vb. kullanarak modifiye etmenize izin veren sunucularda bile çalıştı.
}
return 1;
}
```
## Notlar
:::tip
Bu fonksiyon AddVehicleComponent tarafından ÇAĞRILMAZ.
:::
## Bağlantılı Fonksiyonlar
- [AddVehicleComponent](../functions/AddVehicleComponent): Araca bileşen (modifiye parçası) ekleme.
- [OnEnterExitModShop](OnEnterExitModShop): Bu fonksiyon, bir araç modifiye noktasına giriş yaptığında veya modifiye noktasından çıkış yaptığında çağrılır.
- [OnVehiclePaintjob](OnVehiclePaintjob): Bu fonksiyon, bir aracın kaplaması değiştirildiğinde çağrılır.
- [OnVehicleRespray](OnVehicleRespray): Bu fonksiyon, bir araç respray noktasındayken çağrılır.
| openmultiplayer/web/docs/translations/tr/scripting/callbacks/OnVehicleMod.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/tr/scripting/callbacks/OnVehicleMod.md",
"repo_id": "openmultiplayer",
"token_count": 924
} | 461 |
---
title: AddStaticVehicleEx
description: Ekstra parametre(ler) girerek statik araç oluşturmanızı sağlar.
tags: []
---
## Açıklama
Oyun modunda oyuncular için modeli daha önceden yüklenmiş olan statik araç oluşturmanızı sağlar. AddStaticVehicle fonksiyonundan tek farkı vardır: sürücü aracı boş bıraktıktan sonra girdiğiniz parametre sayesinde aracın ne kadar süre sonra respawn olacağını ayarlayabilirsiniz.
| İsim | Açıklama |
| ----------------------------------- | ------------------------------------------------------------------------------------------------------ |
| modelid | araç modeli. |
| Float:spawn_X | aracın spawn olacağı X koordinatı. |
| Float:spawn_Y | aracın spawn olacağı Y koordinatı. |
| Float:spawn_Z | aracın spawn olacağı Z koordinatı. |
| Float:z_angle | aracın spawn olduğunda bakacağı rotasyon. |
| color1 | birinci renk. |
| color2 | ikinci renk. |
| respawn_delay | respawn delay süresi. (kaç saniye sonra re-spawn olacak (saniye bazlı)) |
| addsiren (opsiyonel) | siren değeri. (0 yok, 1 var) |
## Çalışınca Vereceği Sonuçlar
Oluşturulan aracın ID'si: (1 - MAX_VEHICLES) araç oluşturuldu.
Geçersiz araç ID'si (65535): araç oluşturulamadı. (hatalı model ya da araç limiti aşıldığı için).
## Örnekler
```c
public OnGameModeInit()
{
// Oyuna boş bırakıldıktan 15 saniye sonra re-spawn olacak bir hydra ekle (520 model)
AddStaticVehicleEx (520, 2109.1763, 1503.0453, 32.2887, 82.2873, -1, -1, 15);
return 1;
}
```
## Bağlantılı Fonksiyonlar
- [AddStaticVehicle](AddStaticVehicle.md): Statik araç ekleyin.
- [CreateVehicle](CreateVehicle.md): Araç oluşturun.
| openmultiplayer/web/docs/translations/tr/scripting/functions/AddStaticVehicleEx.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/tr/scripting/functions/AddStaticVehicleEx.md",
"repo_id": "openmultiplayer",
"token_count": 1666
} | 462 |
---
title: BanEx
description: Oyuncuyu özel bir nedenle yasaklama.
tags: ["administration"]
---
## Açıklama
Oyuncuyu özel bir nedenle yasaklama.
| Parametre | Açıklama |
| --------- | ----------------------------- |
| playerid | Yasaklanacak oyuncunun ID'si. |
| reason | Yasaklamanın özel nedeni. |
## Çalışınca Vereceği Sonuçlar
Bu fonksiyon özel bir değer döndürmez.
## Örnekler
```c
public OnPlayerCommandText( playerid, cmdtext[] )
{
if (!strcmp(cmdtext, "/banme", true))
{
// Komutu kullanan oyuncu yasaklanır ve özel bir nedeni ("İstek") olarak yazar.
BanEx(playerid, "İstek");
return 1;
}
}
// Oyuncuyu yasaklamadan önce bir mesaj (örn. yasaklanma açıklaması) göndermek için
// bir zamanlayıcı (timer) oluşturmanız gerekir. Bu zamanlayıcının bir kaç milisaniye olması yeterlidir,
// ancak alt taraftaki örnekte güvenli olması açısından tam bir saniye kullanılmıştır.
forward BanExPublic(playerid, reason[]);
public BanExPublic(playerid, reason[])
{
BanEx(playerid, reason);
}
stock BanExWithMessage(playerid, color, message[], reason[])
{
//reason - Yasaklama için özel neden.
SendClientMessage(playerid, color, message);
SetTimerEx("BanExPublic", 1000, false, "ds", playerid, reason);
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp(cmdtext, "/banme", true) == 0)
{
//Komutu kim kullanırsa yasaklanır.
BanExWithMessage(playerid, 0xFF0000FF, "Yasaklandınız!", "İstek");
return 1;
}
return 0;
}
```
## Notlar
:::warning
BanEx() fonksiyonu kullanılmadan önce giden mesaj (örn. SendClientMessage) veya başka bir fonksiyon oyuncuya ulaşmayacaktır. Mesajın veya bir başka fonksiyonun oyuncuya ulaşması için zamanlayıcı (timer) kullanılmalıdır.
:::
## Bağlantılı Fonksiyonlar
- [Ban](Ban): Bir oyuncuyu yasaklama.
- [Kick](Kick): Oyuncuyu sunucudan atma (kick).
| openmultiplayer/web/docs/translations/tr/scripting/functions/BanEx.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/tr/scripting/functions/BanEx.md",
"repo_id": "openmultiplayer",
"token_count": 900
} | 463 |
---
title: GetActorFacingAngle
description: Aktörün açısını kontrol etme.
tags: ["actor"]
---
<VersionWarnTR version='SA-MP 0.3.7' />
## Açıklama
Aktörün açısını kontrol etme.
| Parametre | Açıklama |
| ---------- | ------------------------------------------------------------------------------------------- |
| actorid | Açısı kontrol edilecek aktörün ID'si. |
| &Float:ang | Aktörün kontrol edilen açısının kaydedileceği, referansla geçirilen bir float değişkeni. |
## Çalışınca Vereceği Sonuçlar
1: Fonksiyon başarıyla çalıştı.
0: Fonksiyon çalışmadı. Girilen aktör ID'si geçersiz.
Aktörün açısı belirtilen değişkende saklanır.
## Örnekler
```c
new Float:facingAngle; // Herhangi bir yere
GetActorFacingAngle(actorid, facingAngle); // Herhangi bir yere
```
## Bağlantılı Fonksiyonlar
- [SetActorFacingAngle](SetActorFacingAngle): Aktörün açısını değiştirme.
- [GetActorPos](GetActorPos): Aktörün koordinat değerlerini kontrol etme.
| openmultiplayer/web/docs/translations/tr/scripting/functions/GetActorFacingAngle.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/tr/scripting/functions/GetActorFacingAngle.md",
"repo_id": "openmultiplayer",
"token_count": 571
} | 464 |
---
title: "Pawn Stil Rehberi"
description: Amaç, Pawn kaynak kodunun genellikle kabul edilen adlandırma kuralları ve diğer yönleri hakkında kısa bir rehber sunarak niyetin daha kolay iletilmesine ve kodun paylaşılmasına yönelik hata ayıklamayı kolaylaştırmaktır.
---
Amaç, Pawn kaynak kodunun genellikle kabul edilen adlandırma kuralları ve diğer yönleri hakkında kısa bir rehber sunarak niyetin daha kolay iletilmesine ve kodun paylaşılmasına yönelik hata ayıklamayı kolaylaştırmaktır.
Ayrıca bakınız:
- [Modern Pawn](https://github.com/Southclaws/sampctl/wiki/Modern-Pawn)
- [Pawn Paketi](https://github.com/Southclaws/sampctl/wiki/Packages)
## Terimler
### İfade
Bir ifade, ana programı bir şey yapmaya zorlayan bir kod parçasıdır. Bir ifade, geçerli bir kod parçasıdır ve bazı sonuçlar verir.
```c
a = b + c;
```
Bu, bir değişkene bir [#İfade] sonucu atan bir ifadedir.
```c
SetPlayerColor(playerid, 0xFF4700FF);
```
Bu, programı belirli argümanlarla bir işlevi çağırmaya yönlendiren bir ifadedir.
```c
x + 8
```
Bu bir ifade değildir çünkü sonuç başka bir yerde kullanılmaz, bu sadece bir [#İfade] dir.
### Bileşik İfade
Bir bileşik ifade, süslü parantezlerle çevrili ifadelerin bir koleksiyonudur.
```c
{
new message[] = "Merhaba!";
print(message);
}
```
Bu, iki ifadeden oluşan bir bileşik ifadedir.
```c
if (a == b)
{
print("Merhaba!");
}
```
Bu, genellikle "if ifadesi" olarak adlandırılan bir koşullu ifade içeren bir bileşik ifadedir.
```c
return Function1(), Function2(), Function3();
```
Bu bir bileşik ifade değildir, virgülle ayrılmış ifadelerin bir zinciridir. Bu tür ifadelerin zincirleme kullanımı genellikle kötü bir uygulama olarak kabul edilir.
### İfade
Bir ifade, bir değer üreten bir sözdizimi parçasıdır; kullanılmadığı sürece geçerli bir ifade değildir.
İfadeler genellikle ifadeleri birleştirerek ifadeler oluşturmak için kullanılır.
```c
a + b
```
Bu, iki değeri alır ve bunlara toplama operatörünü uygulayan basit bir toplama ifadesidir.
## İlkeler
### Süslü Parantezler
Allman süslü parantezleri tercih edilir:
```pawn
function()
{
//
}
```
Ancak, kas hafızasından vazgeçemiyorsanız, K&R süslü parantezleri de geçerlidir:
```pawn
function() {
//
}
```
### Switch Yapıları
Switch yapısı için iki girinti seviyesi kullanılmalıdır; biri `switch` bloğu için, diğeri ise her `case` ifadesi veya bileşik ifadesi için.
```pawn
switch (degisken)
{
case 0:
return 0;
case 1:
return 1;
case 2:
return 2;
default:
return -1;
}
```
```pawn
switch (degisken)
{
case 0:
{
// kod...
return 0;
}
case 1:
{
// kod...
return 1;
}
case 2:
{
// kod...
return 2;
}
default:
{
// kod...
return -1;
}
}
```
### Bileşik İfadeler (Bloklar)
Bloklar her zaman süslü parantezleri kullanmalıdır, hatta blok içinde sadece tek bir kod satırı varsa bile. Bu, fonksiyonlar dahil tüm seviyeler için geçerlidir.
```pawn
func()
{
tekSatirIfade();
}
```
```pawn
func()
{
if ()
{
tekSatirIfade();
}
}
```
```pawn
func()
{
if ()
{
tekSatirIfade();
}
else if ()
{
//
}
else
{
//
}
}
```
### Adlandırma
#### Fonksiyonlar
Fonksiyonlar her zaman `PascalCase` ile adlandırılmalıdır.
#### Global Değişkenler
`new` kullanılarak tanımlanan global değişkenler her zaman `g_` öneki ile adlandırılmalıdır, bu nedenle `g_DegiskenAdi`, ancak `static` kullanılarak tanımlanmışlarsa her zaman `s_` öneki ile `PascalCase` kullanmalıdır, yani `s_DegiskenAdi`
Sabit global değişkenler `SCREAMING_SNAKE_CASE` kullanmalıdır.
#### Yerel Değişkenler
Yerel değişkenler her zaman `camelCase` kullanmalıdır ve tek harfli isimler kullanılmamalıdır, ancak şunlar dışında:
- `i`, `j`, `k`, vb. `for` döngülerinde
- Matematik bağlamında `x`, `y`, `z`, vb.
#### Enumerators
Eğer adlandırılıyorsa, Enumerators, `E_` (güçlü etiket) veya `e_` (zayıf etiket) ile öneki almalıdır.
Enumerator alanları aynı zamanda `SCREAMING_SNAKE_CASE` kullanmalı ve enumerator adını önek olarak kullanmalıdır.
```pawn
static enum E_PLAYER_DATA {
E_PLAYER_CASH,
Float:E_PLAYER_HEALTH,
}
```
Zayıf etiket kullanımı
```pawn
static enum e_PLAYER_DATA {
E_PLAYER_CASH,
Float:E_PLAYER_HEALTH,
}
```
Adlandırılmayan enumerator alanları aynı zamanda `SCREAMING_SNAKE_CASE` kullanmalı ve enumerator adını önek olarak kullanmalıdır.
```pawn
static enum {
ENUMATOR_INTEGER,
Float:ENUMATOR_FLOAT,
}
```
Enumerators her zaman modül dışında kullanılmıyorsa `static` olarak bildirilmelidir.
#### Makrolar ve Ön-işlemci Tanımları
Makrolar her zaman kullanımlarına bakılmaksızın `SCREAMING_SNAKE_CASE` kullanmalıdır.
Ön-işlemci tanımları (sabit tanımlamalar) aynı zamanda `SCREAMING_SNAKE_CASE` kullanmalıdır.
Bu, değişkenler ile sabitler arasındaki ve fonksiyonlar ile makrolar arasındaki farkı belirlemeye yardımcı olur.
Genellikle, dilin bir parçası olan kelimelerle kütüphane kelimeleri arasındaki karışıklığı önlemek için yeni sözdizimi elemanları icat etmekten kaçınılması önerilir.
Ancak, bazı eski kütüphaneler bunu yapar ve geriye dönük uyumluluk nedeniyle değiştiremezler.
### Belgelendirme
Her zaman dışa aktarılan fonksiyonları, fonksiyonun adının kendisi olduğu ve ne yaptığına dair kısa bir açıklama içeren `// FonksiyonAdi X, Y ve Z yapar ve A döndürür` formatındaki basit bir satır yorumla belgeleyin. Her bir parametre hakkında ayrıntılı açıklamalar yapmaya gerek yoktur. Örneğin:
```pawn
// LoadPlayerAccount, hesap yükleme sürecini başlatmak için çağrılır. Bu
// fonksiyon, oyuncu verilerini almak için HTTP çağrıları başlatır, oyuncuya
// iletiler gösterir ve nihayet işlem tamamlandığında başarıyla `OnPlayerLogin`
// etkinliğini tetikler. Başarısızlık durumunda oyuncu atılır.
stock Error:LoadPlayerAccount(playerid)
{
// kod...
}
```
Her paketin bir `README` dosyası olmalı ve gerektiğinde her modül, sağladığı şeyi tanımlayan ilk satırda bir yorum içermelidir.
| openmultiplayer/web/docs/translations/tr/scripting/language/Style.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/tr/scripting/language/Style.md",
"repo_id": "openmultiplayer",
"token_count": 3109
} | 465 |
---
title: 一些令人惊叹的库
description: 精选的有帮助的工具、库和插件列表,供SA-MP开发选择。
---
## 工具
- **[Community Compiler](https://github.com/pawn-lang/compiler/)** - 一个大范围更新的编译器版本,修正并改进了很多地方。
- **[sampctl](http://sampctl.com/)** - 用于安装库和运行服务器的包管理器。
- **[Plugin Runner](https://github.com/Zeex/samp-plugin-runner/)** - 用于直接从命令行(不需要`server.cfg`)运行服务器轻量级版本的工具,用于测试插件。
- **[Plugin Boilerplate](https://github.com/Southclaws/samp-plugin-boilerplate)** - 使用模板开发插件会更容易。
- **[SA:MP Plugin Template Library](https://github.com/katursis/samp-ptl)** - 用这个模板库让你开发插件变得更快,更容易。
- **[SA-MP Fiddle](https://fiddle.sa-mp.dev)** - 测试你的脚本(代码片段、PoC、调试等)并将其共享给他人的平台。
- **[Pawn Syntax - Sublime](https://packagecontrol.io/packages/Pawn%20syntax/)** - Sublime Text 编辑器的 Pawn 自动补全插件。
- **[Pawn Syntax - Visual Marketplace](https://marketplace.visualstudio.com/items?itemName=southclaws.vscode-pawn/)** - Visual Studio Code 编辑器的 Pawn 自动补全插件。
- **[SA-MP Zone Editor](https://bitbucket.org/Grimrandomer/samp-zone-editor/downloads/)** - 用于创建地盘和其他相关东西的编辑器。
- **[SA-MP Map Editor](https://github.com/openmultiplayer/archive/raw/master/tools/Map%20Editor.zip)** - 广受欢迎的 SA:MP 地图编辑器。
## 库
- **[samp-stdlib](https://github.com/pawn-lang/samp-stdlib/)** - 默认库文件的更新版本。正确的`常量(const)`,文档化且更完整。
- **[fixes.inc](https://github.com/pawn-lang/sa-mp-fixes/)** - 针对大量 SA:MP 服务器错误的优化修复。即插即用。
- **[YSI-Includes](https://github.com/pawn-lang/YSI-Includes/)** - SA:MP/Pawn 历史最悠久、规模最大、经过大量测试且支持性最好的库,提供了大量的新游戏和语言功能。
- **[foreach](https://github.com/Open-GTO/foreach)** - foreach 独立库(非 y_iterate 版本)。
- **[amx_assembly](https://github.com/Zeex/amx_assembly/)** - 对 Pawn 脚本自身的低级别访问。
- **[md-sort](https://github.com/oscar-broman/md-sort)** - 对 Pawn 中的多维数组进行排序。修改数组的内部指针,而不是复制数据。
- **[indirection](https://github.com/Y-Less/indirection/)** - 间接传递指针和调用函数的系统,使用抽象方法进行自定义调用。
- **[code-parse.inc](https://github.com/Y-Less/code-parse.inc/)** - 在编译时解析并自定义 Pawn 代码。
- **[Extended Vehicle Information](https://github.com/Vince0789/sa-mp-extended-vehicle-information/)** - 使用 SQLite 并且包含大量单人模式的载具标志。
- **[sqlitei](https://github.com/oscar-broman/sqlitei)** - SA-MP SQLite 的高级 API 函数。
- **[weapon-config](https://github.com/oscar-broman/samp-weapon-config)** - 更一致和反应更灵敏的伤害系统,有许多新特性。
- **[samp-geoip](https://github.com/Southclaws/SAMP-geoip/)** - 基于 IP 地址的地理信息。
- **[progress2](https://github.com/Southclaws/progress2/)** - 以进度条显示时间、生命值、载具燃料等。
- **[weapon-data](https://github.com/Southclaws/samp-weapon-data/)** - 微调,可定制的武器数据库。
- **[MV_Youtube](https://github.com/MichaelBelgium/MV_Youtube)** - 转换 Youtube 影片至音频流的 API。
- **[MySQL Prepared Statements](https://github.com/PatrickGTR/MySQL-Prepared-Statements)** - 模拟 PAWN MySQL 插件的准备语句。
- **[samp-server-weapons](https://github.com/Brunoo16/samp-server-weapons)** - 武器完全由服务器控制。
- **[actor_robbery](https://github.com/PatrickGTR/actor_robbery)** - 灵感来自 GTAV 商店抢劫,该库模仿了它!
- **[samp-aviation](https://github.com/Southclaws/samp-aviation/)** - 在 SA:MP 中自动驾驶。
- **[samp-logger](https://github.com/Southclaws/samp-logger)** - 简单的结构化日志记录器,它提供了一组简单的日志记录和调试功能。
- **[TDW Recursion Scanner](https://github.com/tdworg/samp-include-rscan)** - 在代码中查找递归的库。
- **[easyDialog](https://github.com/Awsomedude/easyDialog)** - 让对话框更容易使用。
- **[mdialog](https://github.com/Open-GTO/mdialog)** - 现代对话框系统,类似于 easyDialog。
- **[Model Sizes Plus](https://github.com/Crayder/Model-Sizes-Plus)** - 更新、更高级、更精确的旧模型大小的库。
- **[physics.inc](https://github.com/uPeppe/physics.inc)** - 模拟 2D 和 3D 物理(逼真的运动,碰撞等)。
- **[samp-async-dialogs](https://github.com/AGraber/samp-async-dialogs)** - 使用 PawnPlus 任务处理异步对话框。
- **[speedcap.inc](https://github.com/openmultiplayer/archive/blob/master/includes/speedcap.inc)** - 一个控制车速的库。
- **[SA:MP Command Guess](https://github.com/Kirima2nd/samp-command-guess)** - 使用 Levenshtein 算法函数实现的 SA:MP 的指令猜测器。
- **[vending](https://github.com/wuzi/vending)** - 面向 SA-MP 的服务器端自动售货机。
- **[strlib.inc](https://github.com/oscar-broman/strlib/)** - SA:MP 中的字符串函数。
- **[mathutil](https://github.com/ScavengeSurvive/mathutil)** - 一系列有用的数学函数列表。
- **[rotations.inc](https://github.com/sampctl/rotations.inc)** - 由 Nero_3D 开发的 rotations.inc,提供了一系列有用的旋转函数列表。
- **[SA-MP Distance Functions](https://github.com/Y-Less/samp-distance)** - 一系列有用的距离检查函数。
- **[New SA-MP callbacks](https://github.com/emmet-jones/New-SA-MP-callbacks)** - 一系列有用的新回调函数。
- **[Alternative Dialogs](https://github.com/NexiusTailer/Alternative-Dialogs)** - 新设计的 文本绘画 对话框。
- **[eSelection](https://github.com/TommyB123/eSelection)** - 增加了在 SA-MP 游戏模式中创建动态模式选择菜单的能力。
- **[mSelection](https://github.com/alextwothousand/mSelection)** - 同 eSelection,但风格不同。
## 指令处理
- **[I-ZCMD](https://github.com/YashasSamaga/I-ZCMD/)** - ZCMD 的改良版本。
- **[Pawn.CMD](https://github.com/katursis/Pawn.CMD/)** - 性能最强的指令处理库。
- **[y_commands](https://github.com/pawn-lang/YSI-Includes/blob/5.x/YSI_Visual/y_commands.md)** - 来自 YSI Includes 的指令处理器
## 服务端插件
- **[JIT](https://github.com/Zeex/samp-plugin-jit/)** - 一旦代码稳定,就可以使用它来大大提高速度。
- **[CrashDetect](https://github.com/Zeex/samp-plugin-crashdetect/)** - 在测试过程中寻找错误的开发工具。
- **[Profiler](https://github.com/Zeex/samp-plugin-profiler)** - SA-MP 服务器的性能分析器插件。
- **[sscanf](https://github.com/Y-Less/sscanf/)** - 将字符串转换为多个值、整数、浮点数、玩家等。
- **[MySQL Plugin](https://github.com/pBlueG/SA-MP-MySQL/)** - 将服务器连接到 MySQL 数据库。
- **[Streamer Plugin](https://github.com/samp-incognito/samp-streamer-plugin/)** - 绕过许多 SA:MP 限制,如物体和拾取工具。
- **[nativechecker](https://github.com/openmultiplayer/archive/raw/master/plugins/nativechecker.zip)** - 在服务器启动时检查原生函数(natives)。
- **[FCNPC](https://github.com/ziggi/FCNPC)** - 一个用于 SA-MP 服务器的插件,它为现有的标准 NPC 增加了许多功能。
- **[FileManager](https://github.com/JaTochNietDan/SA-MP-FileManager)** - 允许你从根文件夹(不限于脚本文件服务器目录)管理文件和文件夹。
- **[Pawn.Raknet](https://github.com/katursis/Pawn.RakNet)** - 允许您分析 RakNet 流量。
- **[samp-precise-timers](https://github.com/bmisiak/samp-precise-timers)** - 一个 SA-MP 插件,提供精确的计时器,用 Rust 编写。
- **[PawnPlus](https://github.com/IllidanS4/PawnPlus)** - 使用新的构造器、数据类型和编程技术扩展了 Pawn 脚本语言的可能性。
- **[PAWN memory access](https://github.com/BigETI/pawn-memory)** - 允许在 Pawn 中分配和释放堆内存。
- **[Native Fallback](https://github.com/IllidanS4/NativeFallback)** - 一个 SA-MP 插件,给未注册的原生函数提供了回调函数。
- **[YSF](https://github.com/IllidanS4/YSF)** - 一个插件,其目的是最大限度地利用服务器,主要是内存编辑和钩子。
- **[SKY](https://github.com/oscar-broman/SKY)** - 这个插件提供了一些底层函数,让 Pawn 脚本可以做一些强大的事情。
- **[Pawn.Regex](https://github.com/katursis/Pawn.Regex)** - 在 Pawn 中添加了对正则表达式的支持。
- **[pawn-scraper](https://github.com/Sreyas-Sreelal/pawn-scraper)** - 一个强大的 scraper 插件,提供了在 pawn 中使用 html_parser 和 css 选择器的接口。
- **[TOTP](https://github.com/philip1337/samp-plugin-totp)** - 允许您在 sa-mp 游戏模式中使用 TOTP 身份验证。
- **[DNS Plugin](https://github.com/samp-incognito/samp-dns-plugin)** - 这个插件提供了 DNS 查找和反向 DNS 查找功能。
- **[MapAndreas](https://github.com/Southclaws/samp-plugin-mapandreas)** - 允许您加载不同高度的地图,并检查最小高度的 x,y 坐标。
- **[ColAndreas](https://github.com/Pottus/ColAndreas)** - 使用子弹物理引擎库,创建了一个圣安地列斯世界的模拟。
- **[PathFinder](https://bitbucket.org/Pamdex/pathfinder/src/master)** - 你可以计算出圣安地列斯地图上从 A 点到 B 点的路线。
- **[Custom Query Flood Check](https://github.com/spmn/samp-custom-query-flood-check)** - 编写自定义保护来防止洪水查询攻击。
- **[sampml](https://github.com/YashasSamaga/sampml)** - 简化的机器学习工具包和相关的 SAMP 项目(自瞄检测)。
- **[TgConnector](https://github.com/Sreyas-Sreelal/tgconnector)** - 一个 Telegram 连接器插件,帮助通过 SA-MP 与 Telegram 机器人互动。
- **[Discord Connector](https://github.com/maddinat0r/samp-discord-connector)** - 在脚本中轻松制作 Discord 机器人。
- **[TSConnector](https://github.com/maddinat0r/samp-tsconnector)** - 允许您从 Pawn 脚本中控制 Teamspeak3 服务器。
- **[IRC Plugin](https://github.com/samp-incognito/samp-irc-plugin)** - 允许通过 SA-MP 服务器创建和管理 IRC 机器人。
- **[pawn-requests](https://github.com/Southclaws/pawn-requests)** - 提供一个 API,用于与支持文本和 JSON 数据类型的 HTTP(S)API 进行交互。
- **[pawn-redis](https://github.com/Southclaws/pawn-redis)** - 授予对快速内存数据库和其他程序之间的异步消息通道的访问权限。
- **[Chrono](https://github.com/Southclaws/pawn-chrono)** - 用于处理日期和时间的现代 Pawn 库。
- **[rustext](https://github.com/ziggi/rustext)** - 修复 SA-MP 的俄语显示插件:游戏文字、文本绘画 和 菜单 的。
- **[Advanced SA NickName](https://github.com/KrYpToDeN/Advanced-SA-NickName)** - 支持任何字符的用户名插件。
- **[SAMPSON](https://github.com/Hual/SAMPSON)** - 一个用于 SA-MP 的 JSON 插件。
## 客户端插件
- **[SA-MP+](https://github.com/Hual/SA-MP-Plus)** - 修改了客户端,使用 SA-MP 的软件开发工具包插件与服务器交互并添加新功能。
- **[CHandling](https://github.com/dotSILENT/chandling)** - 通过修改游戏的默认行为,增加了将车辆分配单独的数据的功能。
- **[SAMPVOICE](https://github.com/CyberMor/sampvoice)** - 为 SA:MP 服务器实现 Pawn 语言的语音通信系统。
- **[KeyListener](https://github.com/CyberMor/keylistener)** - 客户端到服务端的插件,用于跟踪用户的任何按键。
- **[SAMP CEF](https://github.com/ZOTTCE/samp-cef)** - SA:MP 嵌入 CEF 的客户端和服务器插件。
- **[SAMP_AC_v2](https://github.com/Whitetigerswt/SAMP_AC_v2)** - SA:MP 客户端反作弊。
## 加密插件
- **[whirlpool](https://github.com/Southclaws/samp-whirlpool/)** - 用于 SA:MP 的漩涡加密插件.
- **[bcrypt](https://github.com/LassiR/bcrypt-samp/)** - 用于 SA:MP 的 Bcrypt 加密插件。
- **[samp-crypto](https://github.com/alextwothousand/samp-crypto)** - 用于 SA:MP 的加密函数集,如 Argon2、Scrept 和 Bcrypt。
- **[SHA512](https://github.com/openmultiplayer/archive/raw/master/plugins/SHA512.zip)** - 用于 SA:MP 的 SHA512 加密插件。
## 游戏开发工具包/软件开发工具包
- **[sampsdk](https://github.com/Zeex/samp-plugin-sdk)** - 这是开发插件所需的最低要求
- **[sampgdk](https://github.com/Zeex/sampgdk)** - 为 SA:MP 编写游戏模式的 C/C++语言支持
- **[SampSharp](https://github.com/ikkentim/SampSharp)** - 为 SA:MP 编写游戏模式的 C# 语言支持
- **[.NET Plugin](https://github.com/Seregamil/.NET-plugin)** - 为 SA:MP 编写游戏模式的 C# 语言支持
- **[sampgo](https://github.com/sampgo/sampgo)** - 为 SA:MP 编写游戏模式的 GO 语言支持
- **[samp-node](https://github.com/AmyrAhmady/samp-node)** - 为 SA:MP 编写游戏模式的 Javascript,Typescript 语言支持
- **[Shoebill Project](https://github.com/Shoebill/ShoebillPlugin)** - 为 SA:MP 编写游戏模式的 Java 语言支持
- **[pySAMP](https://github.com/habecker/PySAMP)** - 为 SA:MP 编写游戏模式的 Python 语言支持
- **[samp-rs](https://github.com/ZOTTCE/samp-rs)** - 为 SA:MP 编写插件的 Rust 语言支持
- **[Yet Another Lua Plugin](https://github.com/IllidanS4/YALP)** - 为 SA:MP 编写游戏模式的 Lua 语言支持
- **[SAMPHP](https://github.com/Lapayo/SAMPHP)** - 为 SA:MP 编写游戏模式的 PHP 语言支持
- **[SA-MP S[D]K](https://github.com/Hual/SA-MP-S-D-K)** - 为 SA:MP 编写游戏模式的 D 语言支持
- **[Kamp](https://github.com/Double-O-Seven/kamp)** - 为 SA:MP 编写游戏模式的 Kotlin 语言支持
## 游戏模式
- **[Example Gamemode](https://github.com/openmultiplayer/example-gamemodes)** - 与 open.mp 兼容的游戏模式列表。
- **[ScavengeSurvive](https://github.com/Southclaws/ScavengeSurvive)** - 基于 PvP 生存的游戏模式。
- **[gta-open](https://github.com/PatrickGTR/gta-open)** - 位于洛圣都的警察与劫匪的游戏模式。
- **[SF-CnR](https://github.com/zeelorenc/sf-cnr)** - SA:MP 位于圣费耶罗的警察与劫匪的游戏模式。
- **[Next Generation Roleplay](https://github.com/NextGenerationGamingLLC/SA-MP-Development)** - 次世代游戏责任有限公司的 SA:MP 游戏模式。
- **[SC-RP](https://github.com/seanny/SC-RP)** - 支持 MySQL 的角色扮演的游戏模式。
## 过滤脚本
- **[MapFix](https://github.com/NexiusTailer/MapFix)** - 修复了圣安地列斯地图的纹理错误。
- **[SA:MP Animbrowse](https://github.com/Southclaws/samp-animbrowse)** - SA:MP 的动作浏览工具。
- **[IsPlayerUsingAndroid](https://github.com/Fairuz-Afdhal/IsPlayerUsingAndroid)** - 判断玩家是否为安卓用户。
- **[TextDraw-Editor](https://github.com/Nickk888SAMP/TextDraw-Editor)** - 一个 文本绘画 编辑器,它有一些丰富的功能。
- **[Ultimate Creator](https://github.com/NexiusTailer/Ultimate-Creator)** - 先进的地图编辑器,具有很多功能。
- **[Fusez's Map Editor](https://github.com/fusez/Map-Editor-V3)** - SA:MP 游戏内地图编辑器。
- **[Texture Studio](https://github.com/Pottus/Texture-Studio)** - SA:MP 游戏内贴图编辑器,可以让你的纹理达到材质索引 15(16 种材质),以及设置物体上该材质索引的颜色。
| openmultiplayer/web/docs/translations/zh-cn/awesome.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/zh-cn/awesome.md",
"repo_id": "openmultiplayer",
"token_count": 8287
} | 466 |
---
title: OnGameModeInit
description: 当初始化游戏模式时,该回调函数被触发。
tags: []
---
## 描述
当初始化游戏模式时,调用这个回调函数。
## 案例
```c
public OnGameModeInit()
{
print("游戏模式 加载!");
return 1;
}
```
## 要点
:::tip
因为更改游戏模式不会重新加载过滤脚本(filterscript),所以该函数也可以在过滤脚本中使用,用于检测是否使用了 RCON 指令(例如 changemode 或 gmx)更改游戏模式。
:::
## 相关回调
| openmultiplayer/web/docs/translations/zh-cn/scripting/callbacks/OnGameModeInit.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/zh-cn/scripting/callbacks/OnGameModeInit.md",
"repo_id": "openmultiplayer",
"token_count": 351
} | 467 |
---
title: OnPlayerDeath
description: 当一个玩家自杀或被另一个玩家杀死时,这个回调函数会被调用。
tags: ["player"]
---
## 描述
当一个玩家自杀或被另一个玩家杀死时,这个回调函数会被调用。
| 参数名 | 描述 |
| -------- | --------------------------------------------------------------- |
| playerid | 死亡玩家的 ID。 |
| killerid | 杀死死亡玩家的玩家的 ID,如果没有的话,则为 INVALID_PLAYER_ID。 |
| WEAPON:reason | 玩家死亡原因的 ID。 |
## 返回值
0 - 将阻止其他过滤脚本接收到这个回调。
1 - 表示这个回调函数将被传递给下一个过滤脚本。
它在过滤脚本中总是先被调用。
## 案例
```c
new PlayerDeaths[MAX_PLAYERS];
new PlayerKills[MAX_PLAYERS];
public OnPlayerDeath(playerid, killerid, WEAPON:reason)
{
SendDeathMessage(killerid, playerid, reason); // 杀戮信息显示在死亡反馈中
// 在对killerid进行任何操作之前,检查它是否有效
if (killerid != INVALID_PLAYER_ID)
{
PlayerKills[killerid] ++;
}
// 检查之外,处理playerid的内容(它总是有效的)
PlayerDeaths[playerid] ++;
return 1;
}
```
## 要点
:::tip
任何火源(如土制燃烧弹,18),reason 参数都会返回 37(火焰喷射器)。
任何制造爆炸的武器(如 RPG,手榴弹),reason 参数都会返回 51。
无需检查 killerid 是否在 SendDeathMessage 中使用之前是否有效,因为 INVALID_PLAYER_ID 是函数中有效的 killerid ID 参数。
只有 playerid 可以调用回调函数。(它有助于防假死)。
:::
:::warning
您必须首先检查'killerid'是否有效(它不能是 INVALID_PLAYER_ID),然后才可以在数组(或任何地方)使用它,否则这会导致 OnPlayerDeath 脚本崩溃(而不是整个脚本)。
因为 INVALID_PLAYER_ID 被定义为 65535,如果一个数组中只有‘MAX_PLAYERS’个元素,比如 500 个,那么当您尝试访问一个高于 499 的索引,它就超出了上限,导致越界。
:::
## 相关函数
- [SendDeathMessage](../functions/SendDeathMessage): 添加一个杀戮信息到死亡反馈。
- [SetPlayerHealth](../functions/SetPlayerHealth): 设置玩家的生命值。
| openmultiplayer/web/docs/translations/zh-cn/scripting/callbacks/OnPlayerDeath.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/zh-cn/scripting/callbacks/OnPlayerDeath.md",
"repo_id": "openmultiplayer",
"token_count": 1466
} | 468 |
---
title: OnPlayerObjectMoved
description: 当玩家物体在MovePlayerObject之后移动时(当它停止移动时),该回调被调用。
tags: ["player"]
---
## 描述
当玩家物体在 MovePlayerObject 之后移动时(当它停止移动时),该回调被调用。
| 参数名 | 描述 |
| -------- | ----------------- |
| playerid | 移动物体的玩家 ID |
| objectid | 被移动的物体 ID |
## 返回值
它在过滤脚本中总是先被调用。
## 案例
```c
public OnPlayerObjectMoved(playerid, objectid)
{
printf("玩家物体移动完毕: 物体id: %d 玩家id: %d", objectid, playerid);
return 1;
}
```
## 要点
<TipNPCCallbacksCN />
## 相关函数
- [MovePlayerObject](../functions/MovePlayerObject): 移动玩家物体。
- [IsPlayerObjectMoving](../functions/IsPlayerObjectMoving): 检查玩家物体是否在移动。
- [StopPlayerObject](../functions/StopPlayerObject): 阻止玩家物体移动。
- [CreatePlayerObject](../functions/CreatePlayerObject): 只为一个玩家创建一个物体。
- [DestroyPlayerObject](../functions/DestroyPlayerObject): 销毁玩家物体。
| openmultiplayer/web/docs/translations/zh-cn/scripting/callbacks/OnPlayerObjectMoved.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/zh-cn/scripting/callbacks/OnPlayerObjectMoved.md",
"repo_id": "openmultiplayer",
"token_count": 588
} | 469 |
---
title: OnRconLoginAttempt
description: 不管成功与否,只要有人尝试登录RCON,就会调用这个回调函数。
tags: []
---
## 描述
不管成功与否,只要有人尝试登录 RCON,就会调用这个回调函数。
| 参数名 | 描述 |
| ---------- | ------------------------------ |
| ip[] | 试图登录 RCON 的玩家的 IP。 |
| password[] | 登录时的密码。 |
| success | 密码不正确则为 0,正确则为 1。 |
## 返回值
它在过滤脚本中总是先被调用。
## 案例
```c
public OnRconLoginAttempt(ip[], password[], success)
{
if (!success) //如果输入的密码不正确
{
printf("IP %s 尝试使用密码 %s 登录RCON失败",ip, password);
new pip[16];
for(new i = GetPlayerPoolSize(); i != -1; --i) //遍历所有玩家
{
GetPlayerIp(i, pip, sizeof(pip));
if (!strcmp(ip, pip, true)) //如果某个玩家的IP是刚刚登录失败的IP
{
SendClientMessage(i, 0xFFFFFFFF, "Wrong Password. Bye!"); //发送消息给他
Kick(i); //他现在被踢出服务器了
}
}
}
return 1;
}
```
## 要点
:::tip
这个回调函数只在游戏中使用/rcon login 指令时调用。
这个回调函数只在玩家尚未登录时调用。
当玩家登录时,OnRconCommand 回调被调用。
:::
## 相关函数
- [IsPlayerAdmin](../functions/IsPlayerAdmin): 检查一个玩家是否登录到 RCON。
- [SendRconCommand](../functions/SendRconCommand): 通过脚本发送 RCON 指令。
| openmultiplayer/web/docs/translations/zh-cn/scripting/callbacks/OnRconLoginAttempt.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/zh-cn/scripting/callbacks/OnRconLoginAttempt.md",
"repo_id": "openmultiplayer",
"token_count": 1002
} | 470 |
---
title: AddPlayerClassEx
description: 该函数与 AddPlayerClass 函数完全相同,只是增加了一个 team 参数。
tags: ["player"]
---
## 描述
该函数与 AddPlayerClass 函数完全相同,只是增加了一个 team 参数。
| 参数名 | 说明 |
| ------------- | ----------------------------- |
| teamid | 想让玩家加入的团队 id。 |
| modelid | 玩家将用来重生的皮肤模型 id。 |
| Float:spawn_x | 该类的重生点的 X 坐标。 |
| Float:spawn_y | 该类的重生点的 Y 坐标。 |
| Float:spawn_z | 该类的重生点的 Z 坐标。 |
| Float:z_angle | 重生后玩家面对的方向。 |
| weapon1 | 玩家的第一个重生武器。 |
| weapon1_ammo | 第一个重生武器的弹药量。 |
| weapon2 | 玩家的第二个重生武器。 |
| weapon2_ammo | 第二个重生武器的弹药量。 |
| weapon3 | 玩家的第三个重生武器。 |
| weapon3_ammo | 第三个重生武器的弹药量。 |
## 返回值
刚添加的类的 ID。
如果达到类的最大数量限制(320),则为 319(最大的类 ID 是 319)。
## 案例
```c
public OnGameModeInit()
{
// 玩家可以选择:
// 在团队1 里的 CJ皮肤(ID 0)。
// 在团队2 里的 The Truth皮肤(ID 1)。
AddPlayerClassEx(1, 0, 1958.33, 1343.12, 15.36, 269.15, 26, 36, 28, 150, 0, 0); // CJ
AddPlayerClassEx(2, 1, 1958.33, 1343.12, 15.36, 269.15, 26, 36, 28, 150, 0, 0); // The Truth
return 1;
}
```
## 要点
:::tip
最大类 ID 为 319(从 0 开始,共 320 个类)。上限之后添加的任何类都将替换 ID 319。
:::
## 相关函数
- [AddPlayerClass](AddPlayerClass): 向玩家类选择器添加一个类。
- [SetSpawnInfo](SetSpawnInfo): 设置玩家的重生信息。
- [SetPlayerTeam](SetPlayerTeam): 设置玩家的团队。
- [SetPlayerSkin](SetPlayerSkin): 设置玩家的皮肤。
| openmultiplayer/web/docs/translations/zh-cn/scripting/functions/AddPlayerClassEx.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/zh-cn/scripting/functions/AddPlayerClassEx.md",
"repo_id": "openmultiplayer",
"token_count": 1153
} | 471 |
---
title: Ban
description: 封禁目前在服务器中的某个玩家。
tags: ["管理员"]
---
## 描述
封禁目前在服务器中的某个玩家。他将无法再次加入服务器。封禁基于 IP,并保存在服务器根目录下的 samp.ban 文件中。BanEx 可以用来给出封禁的原因。可以使用 RCON 的 banip 和 unbanip 命令(SendRconCommand)添加/移除 IP。
| 参数名 | 说明 |
| -------- | ----------------- |
| playerid | 要封禁的玩家 ID。 |
## 返回值
该函数不返回任何特定的值。
## 案例
```c
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp(cmdtext, "/banme", true) == 0)
{
// 封禁输入此命令的玩家。
Ban(playerid);
return 1;
}
}
// 为了在连接关闭前给玩家显示一条信息(例如原因),你必须使用一个计时器来创建一个延迟,这个延迟只需要几毫秒的时间。
// 这里的案例为了安全起见,延迟了整整一秒钟。
forward DelayedBan(playerid);
public DelayedBan(playerid)
{
Ban(playerid);
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp(cmdtext, "/banme", true) == 0)
{
// 封禁执行此命令的玩家。
// 首先,给他发一个信息。
SendClientMessage(playerid, 0xFF0000FF, "你被封禁了!");
// 实际上是在一秒钟后用计时器封禁的他。
SetTimerEx("DelayedBan", 1000, false, "d", playerid);
return 1;
}
return 0;
}
```
## 要点
:::warning
从 SA-MP 0.3x 开始,在 Ban() 之前的任何发送给玩家的代码(比如用 SendClientMessage 发送消息)都不会送达给玩家。必须使用计时器来延迟封禁玩家。
:::
## 相关函数
- [BanEx](BanEx): 以某个原因封禁玩家。
- [Kick](Kick): 将玩家踢出服务器。
| openmultiplayer/web/docs/translations/zh-cn/scripting/functions/Ban.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/zh-cn/scripting/functions/Ban.md",
"repo_id": "openmultiplayer",
"token_count": 1140
} | 472 |
---
title: InterpolateCameraLookAt
description: 以设定的速度在两个坐标之间插值玩家视角的朝向。可以与 InterpolateCameraPos 一起使用。
tags: []
---
## 描述
以设定的速度在两个坐标之间插值玩家视角的朝向。可以与 InterpolateCameraPos 一起使用。
| 参数名 | 说明 |
| ----------- | ------------------------------------------------------------------------------------------------------- |
| playerid | 需要移动视角的玩家 ID |
| Float:FromX | 视角开始移动的 X 坐标 |
| Float:FromY | 视角开始移动的 Y 坐标 |
| Float:FromZ | 视角开始移动的 Z 坐标 |
| Float:ToX | 视角停止移动的 X 坐标 |
| Float:ToY | 视角停止移动的 Y 坐标 |
| Float:ToZ | 视角停止移动的 Z 坐标 |
| time | 以毫秒为单位的时间 |
| cut | 要使用的[跳切](./resources/cameracutstyles)。默认为 CAMERA_CUT(无意义)。设置为 CAMERA_MOVE 用于插值。 |
## 返回值
该函数不返回任何特定的值。
## 案例
```c
public OnPlayerCommandText(playerid, cmdtext[])
{
if (!strcmp(cmdtext, "/rotateme", true))
{
TogglePlayerSpectating(playerid, 1);
InterpolateCameraLookAt(playerid, 50.0, 50.0, 10.0, -50.0, 50.0, 10.0, 10000, CAMERA_MOVE);
// x1 y1 z1 x2 y2 z2
// 视角开始时朝向(x1,y1,z1)。然后它将旋转,在10000毫秒(10秒)之后,它将看向(x2, y2, z2)。
return 1;
}
return 0;
}
```
## 要点
:::tip
使用 TogglePlayerSpectating 来使物体在视角移动时为玩家流入,并移除玩家的 HUD。可以用 SetCameraBehindPlayer 将玩家的视角重置到身后。
:::
## 相关函数
- [InterpolateCameraPos](InterpolateCameraPos): 将玩家的视角从一个位置移动到另一个位置。
- [SetPlayerCameraLookAt](SetPlayerCameraLookAt): 设置玩家的视角所看的方向。
- [SetPlayerCameraPos](SetPlayerCameraPos): 设置玩家的视角位置。
| openmultiplayer/web/docs/translations/zh-cn/scripting/functions/InterpolateCameraLookAt.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/zh-cn/scripting/functions/InterpolateCameraLookAt.md",
"repo_id": "openmultiplayer",
"token_count": 1930
} | 473 |
---
title: 常见问题
---
## 服务器启动时立即崩溃
最常见的是您的 server.cfg 文件中的错误或您的游戏模式 (主图文件) 丢失。检查 server_log.txt 文件,原因应该位于底部。如果没有,请检查 crashinfo.txt 文件。找出导致崩溃的原因的更好解决方案是使用 Zeex/0x5A656578 的崩溃检测插件 ([点击链接](https://github.com/Zeex/samp-plugin-crashdetect)),它将提供更多信息像行号、函数名、参数值等。如果脚本是在调试模式下编译的(-d3标志),会使编译器将关于所有这些东西的额外信息放入output.amx。
## 服务器不起作用 - 防火墙被禁用
您需要转发您的端口以允许玩家加入您的服务器。 您可以使用 PF Port Checker 转发您的端口。 从以下网址下载:www.portforward.com 如果端口未转发,则意味着您必须在路由器中打开它们。 您可以在 [http://portforward.com/english/routers/port_forwarding/routerindex.htm](http://portforward.com/english/routers/port_forwarding/routerindex.htm "http://portforward .com/english/routers/port_forwarding/routerindex.htm") 查看路由器列表。
它包含有关如何转发端口的所有信息。
## 'Packet was modified'
错误信息通常显示为:
```
[hh:mm:ss] Packet was modified, sent by id: <id>, ip: <ip>:<port>
```
当玩家超时或当前有连接问题时发生.
## 'Warning: client exceeded messageslimit'
错误信息通常显示为:
```
Warning: client exceeded 'messageslimit' (1) <ip>:<port> (<count>) Limit: x/sec
```
当客户端每秒发送给服务器的消息数超过最大限制时发生.
## 'Warning: client exceeded ackslimit'
错误信息通常显示为:
```
Warning: client exceeded 'ackslimit' <ip>:<port> (<count>) Limit: x/sec
```
当 ack 超过最大限制时发生.
## 'Warning: client exceeded messageholelimit'
错误信息通常显示为:
```
Warning: client exceeded 'messageholelimit' (<type>) <ip>:<port> (<count>) Limit: x
```
当消息洞超过最大限制时发生.
## 'Warning: Too many out-of-order messages'
错误信息通常显示为:
```
Warning: Too many out-of-order messages from player <ip>:<port> (<count>) Limit: x (messageholelimit)
```
当“乱序消息”复用 messageholelimit 设置时发生。
有关这方面的更多信息,请参阅 [此处](https://open.mp/docs/server/ControllingServer#RCON_Commands)
## 玩家持续收到“Unacceptable NickName”错误,但游戏名是有效的
如果您确定使用了有效的游戏名并且服务器在 Windows 上运行,尝试将 samp-server.exe 的兼容性选项更改为 Windows 98,并且应该在服务器重新启动后修复它。
正常运行时间较长的 Windows 服务器也可能导致出现此问题。 已经注意到大约 50 天的服务器正常运行时间。如果要解决它,需要重新启动。
## `MSVCR___.dll`/`MSVCP___.dll` not found
当尝试加载使用比您计算机上当前安装的更高版本的 Visual C++ 运行时开发的插件时,Windows 服务器上经常会出现此问题。 要解决此问题,请下载相应的 Microsoft Visual C++ 运行库。 请注意,SA-MP 服务器是 32 位的,因此无论架构如何,您还需要下载 32 位 (x86) 版本的运行库。 您最需要的运行库版本由文件名中的数字表示(参见下表),尽管安装所有版本的运行库没有什么坏处。 这些库不会堆叠,换句话说:如果你只安装2015版本,2013年或更早版本的运行库仍需要安装。
| 版本号 | 运行库 |
| ------ | --------------------------------------------- |
| 10.0 | Microsoft Visual C++ 2010 x86 Redistributable |
| 11.0 | Microsoft Visual C++ 2012 x86 Redistributable |
| 12.0 | Microsoft Visual C++ 2013 x86 Redistributable |
| 14.0 | Microsoft Visual C++ 2015 x86 Redistributable |
| openmultiplayer/web/docs/translations/zh-cn/server/CommonServerIssues.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/zh-cn/server/CommonServerIssues.md",
"repo_id": "openmultiplayer",
"token_count": 2205
} | 474 |
---
title: Plugin Development Guide
description: A guide to developing plugins
---
## Introduction
I decided to create this topic to address issues and questions that are frequently asked about plugin development. I'm no where near an expert when it comes to C/++, or the plugin SDK, i am simply sharing what i have come to learn over my time of developing plugins. Hopefully once this topic is done it will become more of a group project with other users contributing information that i might not know, or have forgotten to include. This is a pretty big topic to try and cover, so i will need assistance.
## This is not a C/++ help forum
People seem to be very confused when it comes to this post. I've seen a lot of people ask completely valid questions regarding the plugin SDK who end up with multiple "This is not a C/++ help forum!" quotes. Just because someone is expected to know the languages **doesn't** mean they're not allowed to ask questions about the actual SDK! There is a difference between asking what a pointer is, and asking something like how to create callbacks!
With that being said there are excellent sites and forums dedicated to teaching and answering questions about C/++. Here are a few that i have used:
These sites have excellent tutorials to learn from:
cprogramming.com
cplusplus.com
learncpp.com
If you get stuck on a C/++ issue you can use one of these forums to ask for assistance:
dreamincode.net
stackoverflow.com
## FAQ
### Quick Questions
**Question:** How are plugins made?
- **Answer:** Plugins are made in C/++ using the plugin SDK. This FAQ assumes you know C/++ already, and will provide some information on the actual SDK later on in the article.
**Question:** Can i create a plugin in a programming language other than C/++?
- **Answer:** It's possible in theory. There have been attempts at porting the SA-MP plugin SDK to the programming language D, which supports C's application binary interface. While I've never seen a fully working plugin written in D, this example has shed light on the possibility of writing plugins in languages that support C/++. There also has been talk about the possibility of bindings, but i've yet to see any backing on this.
**Question:** How can i get my plugin to be multiplatform (Available on linux and windows)?
- Answer: Linux and windows are two different operating systems which both have their own differing API's and implementations. Getting your code to work on both platforms means you have to use platform independent code or a sort of framework that handles everything having to do with platforms FOR you. After you're sure your code doesn't rely on any one API, you simply have to compile your code in your desired environment (once again, this guide assumes you know how to do this).
**Question:** Can my plugin use memory hacking?
- Answer: To be honest this is a sort of grey area. Using memory hacking to hook callbacks or call functions seems to be completely acceptable. Anything that modifies the servers memory seems to be off limits (See This). If your planing on making a plugin that needs to use memory hacking for anything other callback hooking or function calling, ask permission before hand and get approval before posting; That honestly is the best way to find out!
**Question:** Is it possible to make a plugin that **\_\_\_\_\_\_** ?
- **Answer:** In most cases any idea is completely possible to implement. It may require a stand alone application that communicates to the plugin, but its likely possible. Questions like these should **not** be posted. You heard the answer, now move on! This is not a plugin request section. Hopefully there will be a day when there is enough plugin creators to have a section or sticky topic for requests (This guide is designed to introduce and help new plugin developers, so lets hope).
**Question:** What IDE/Compiler should i use for **\_\_\_\_\_\_** ?
- **Answer:** That is completely up to you! I personally will be using VC++ 2010 express as my windows IDE and Compiler, and plan on using g++ for my Linux compiler. Just mess around with different options and see which one you like the best!
**Question:** What is a module definition file (.def)?
- **Answer:** A module definition file is a special file in the Visual Studio IDE that provides the linker with information about the program that's being linked. When it comes to writing plugins for SA-MP we only really use the "EXPORTS" statement which provides information about our exported functions. We'll be looking at this statement later in the article.
**Question:** When i release a plugin, does it have to have the source with it?
- **Answer:** If you're releasing something on this forum it **always** has to have the source with it. Plugins are no exception (unless the plugin is approved by a developer to be posted without a source - maybe an anti-cheat?).
## Getting started
You would be shocked how many times i get asked "How do i get started with plugin development?". I decided to add this entire section to answer that question! Just because you know the language doesn't mean you know your way around the IDE after all; I think that's especially true when it comes to VC++ 2010. Visual studio can be a very intimidating place to new users. I hardly think its fair to just hand you the plugin SDK without showing you around first! Messing with property pages/the linker can easily scare people away, so I'm going to guide you through it.
**Note:** If you chose to use a different IDE/compiler that targets Windows, you're out of luck! It seems that the only way to successfully export functions is to use a module definition file (.DEF). I've tried to include an alternative method in this article using \_\_declspec(dllexport), but this simply didn't work due to the \_\_stdcall calling convention mangling the exported function's names (See: [Here](https://pastebin.com/y3xkVY70)).
Here are the downloads you'll need for this section:
**Visual C++ 2010 express:** [Free download](https://visualstudio.microsoft.com/vs/express/)
**Plugin SDK (Plain):** [Download](https://github.com/Zeex/samp-plugin-sdk)
- The first thing we want to do is create a new project. Select file->new->project to do just that.
- Once you create a new project its going to ask you what type of project you're creating. Select Win32 project, enter a project name, and press OK to continue.
- Once your project setting are taken care of this dialog should appear. Press next to continue.
- After you clicked continue you should see this dialog popup asking for your application type and settings. For the type select DLL (Dynamic-link library) and for the settings select empty project. Once you're done press the finish button at the bottom.
- The next thing we want to do is go to our solution explorer. The solution explorer is normally on the left side of the IDE. If you accidentally disabled it you can enable it once again by pressing CTRL+ALT+L or by selecting view->other windows->solution explorer. Once you find the solution explorer right click the project name (In this example its "Test") and select properties.
- Once you see the property pages navigate to Configuration properties->Linker->Input on the left side. Once you're there you want to add a module definition file. You can name this file anything you like as long as it has a ".def" extension at the end of it; People normally name def files after their project. Once you've named your definition file press OK.
- Now all we have to do is add our files (this includes our definition file!). To add a file to your project navigate to the solution explorer again, right click the project name, click add, and then select new item. In this example we'll be adding our definition file. Since there isnt an option for definition files, just pick a source file (.cpp) and type the name of the module definition file you decided on (Note: Make sure you include the ".def" extension, other wise a ".cpp" extension will be added!). After this is done add a source file for the project the same way (except dont add an extension). Most people use the name "Main" for there main source file.
- Before we can start adding anything to our two currently empty files, we have to actually add the SDK to the project. If you haven't already, download the SDK from the link that was provided in the beginning of this section. Once its downloaded, extract the SDK folder into your current project's directory. Note This part is optional: I personally like to create filters to organize all our files and code. A filter is an organizational tool in visual studio that creates folders in your project, but doesn't create corresponding Windows folders (its recommended to create matching window folders). To create a filter right click your project in the solution explorer->add->New Filter and select a name for your filter (Name it SDK in this case).
- The next step is to add all the SDK files to our current project. To add existing files to a project simply right click the folder or project you wish to add them to and select add -> Existing item. You'll want to add everything that is inside the SDK folder in your project directory (Note: You can select multiple files by holding Ctrl while clicking the files to add). For folder consistency we're gonna create another filter inside the SDK filter, and name it amx. You'll of course want to add all the contents of the SDK\amx\ folder into the amx filter.
Now it's time to get this plugin compiled! You should have a module definition file and a source file open if you followed the instructions correctly; If not, go back a few steps and follow the instructions carefully. Go ahead and copy and paste the following information into their corresponding files. Don't worry if you don't understand any of it, we'll be addressing it all in the next section.
### Source file (\*.cpp)
```cpp
#include "SDK\amx\amx.h"
#include "SDK\plugincommon.h"
typedef void (*logprintf_t)(const char* format, ...);
logprintf_t logprintf;
extern void *pAMXFunctions;
cell AMX_NATIVE_CALL HelloWorld(AMX* amx, cell* params)
{
logprintf("This was printed from the Test plugin! Yay!");
return 1;
}
PLUGIN_EXPORT unsigned int PLUGIN_CALL Supports()
{
return SUPPORTS_VERSION | SUPPORTS_AMX_NATIVES;
}
PLUGIN_EXPORT bool PLUGIN_CALL Load(void **ppData)
{
pAMXFunctions = ppData[PLUGIN_DATA_AMX_EXPORTS];
logprintf = (logprintf_t) ppData[PLUGIN_DATA_LOGPRINTF];
logprintf(" * Test plugin was loaded.");
return true;
}
PLUGIN_EXPORT void PLUGIN_CALL Unload()
{
logprintf(" * Test plugin was unloaded.");
}
AMX_NATIVE_INFO PluginNatives[] =
{
{"HelloWorld", HelloWorld},
{0, 0}
};
PLUGIN_EXPORT int PLUGIN_CALL AmxLoad( AMX *amx )
{
return amx_Register(amx, PluginNatives, -1);
}
PLUGIN_EXPORT int PLUGIN_CALL AmxUnload( AMX *amx )
{
return AMX_ERR_NONE;
}
```
### Module definition file (\*.def)
```cpp
EXPORTS
Supports
Load
Unload
AmxLoad
AmxUnload
```
## Examining the code
In this section we'll be taking a look at some of the defines, structures, and functions that the SA-MP plugin SDK has to offer. You should have a comfortable understanding of C/++ before proceeding, as i will **just** be explaining SDK related information once we hit the coded segments. From here on out, there wont be any hand holding!
### The module definition file
Before we take a look at the code, we're gonna check out the module definition file we created in the previous section. First of all, what exactly is a module definition file? We know its a visual studio exclusive feature, but what exactly does it do? Its simple! A module definition file provides information to the linker about the code that is being linked. There are a lot of rules and statements that can be used in these files, but we're just gonna talk about one, the EXPORTS statement.
#### What is "**EXPORTS**"
Exports is a statement that allows us to... well, export stuff to our application! Why do we do this? Because we have to, its as simple as that. The functions we export are entry points in our DLL file. Applications can only touch the functions in our DLL that we export; if we don't export them they remain private to the DLL file. We don't want that now, do we? No. So we export everything that that application is going to be directly accessing.
#### Exported functions
There are currently 6 functions that need to be exported. We use 5 of them inside of our project that we've been setting up. Don't worry about the `PLUGIN_EXPORT`, and `PLUGIN_CALL` definitions you see in the function declarations. We will be covering these along with some other important definitions (marked by green text) later in the article.
| Functions | Description |
| -------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Supports()** | This function tells the server what capabilities our plugin will have based on what it returns. Generally we only use 3 support flags in plugins: **SUPPORTS_VERSION**, **SUPPORTS_AMX_NATIVES**, and **SUPPORTS_PROCESS_TICK**. |
| **Load(void\*\*)** | The Load function is pretty straight forward. This is called when the plugin is loaded and gets passed an array of addresses that the plugin will use to function. The two indexes we typically use are **PLUGIN_DATA_AMX_EXPORTS**, and **PLUGIN_DATA_LOGPRINTF**. |
| **Unload()** | Unload is called when the plugin is unloaded (server is shutdown). |
| **AmxLoad(AMX\*)** | This is called when a new AMX instance is loaded into the server. This will be called for every filterscript/gamemode! Because of this it isn't a good idea to store a single AMX instance for the entire plugin, instead use a queue/list/vector. In this function we also register our custom native functions we wish to provide PAWN with. |
| **AmxUnload(AMX\*)** | This function is called when ever an AMX instance is unloaded. If you store AMX instances, make sure you remove them. Otherwise you'll have instances to non-existing gamemodes/filterscripts. |
| **ProcessTick()** | ProcessTick is a function that gets called on every iteration of the server's loop. People generally use this function as a method of managing time by keeping track of the amount of ticks that have passed. The SA-MP server is said to have a sleep time of 5ms, so if 50 ticks go by you have an idea of the elapsed time (5 \* 50 = 250ms). **Note:** Anyone who uses threads in their plugins and require PAWN interaction needs to use this function to ensure PAWN isnt busy doing another task! |
### Defines and structures
Now comes the fun part, we get to take a look at the code! You'll probably notice right off the bat that we're using a ton of defines and structures through our little example from the previous section. If you haven't ever developed a SA-MP plugin before, these can appear very confusing and even intimidating. We'll be shedding some light on these defines and structures in this section.
| Defines/Structures | Description |
| --------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **cell** | A "cell" is a typedef that is simply there for portability. PAWN offers support for 16bit, 32bit, and 64bit integers. The typedef "cell" will always be the correct size while "int" might not be. Generally with SA-MP plugins, this typedef will always be a 32bit integer. **Note:** There is also a "ucell" typedef for unsigned integers, but this is hardly used. |
| **AMX_NATIVE_CALL** | This defines the calling convention that our native functions will use. At the moment its defined to nothing, so the default will be used. |
| **AMX** | The name of this structure should be pretty clear, its an AMX instance. This structure has tons of information relating to the data segments along with tons of other amx related information. This structure must be present in all native function declarations along with a cell pointer to the passed parameters; Without this info we dont know what script is calling our native, nor do we know what was passed. |
| **PLUGIN_EXPORT** | This is defined as "PLUGIN_EXTERN_C". |
| **PLUGIN_EXTERN_C** | If using a C++ compiler this is defined as "extern "C"". This is for compatibility with C. C++ offers things like function overloading so additional information like the number/size of arguments is stored with the function's name, this is refered to as "name mangling". When this define is used, it tells C++ to use C-style linkage and thus avoids C++ name mangling. |
| **PLUGIN_CALL** | This define tells C/++ what calling convention to use for our exported functions. If you use a compiler targeting windows, this is defined as \_\_stdcall. Otherwise its defined as nothing and the default convention is used. |
| **SUPPORTS_VERSION** | This define is to be used in a bit mask that is returned by our "Supports()" function. This flag is used to check for compatibility with the server. |
| **SUPPORTS_AMX_NATIVES** | This is yet another define that is to be used by our "Supports()" function. Any plugin that uses AMX functions must use this flag! Without this flag you'll get a run time 19 error due to your natives not registering with the server (amx_Register). |
| **SUPPORTS_PROCESS_TICK** | Our last flag for our "Supports()" function. If you're going to be using the "ProcessTick()" function, you have to add this to our "Supports()" function's returned bit mask. |
| **PLUGIN_DATA_AMX_EXPORTS** | This is used as an index to the multidimensional array that gets passed on Load. This particular index holds the AMX function table. All plugins must use this index to assign the address of the function table to pAMXFunctions. |
| **PLUGIN_DATA_LOGPRINTF** | Yet another index that is to be used with the multidimensional array that gets passed on Load. This index holds the address of the logprintf function which prints information and saves said information to the server's log file. If your plugin uses this function you must use this index to assign the address to the logprintf function pointer. |
| **AMX_NATIVE_INFO** | This struct is used in conjunction with amx_Register. It contains a string that holds your new native's name, and a pointer to it's address. |
There are a few other important definitions that relate to AMX function errors, but they're already documented inside of the amx header. So instead of reinventing the wheel, I'm just going to post the enum with all the error codes and their corresponding comments. **Note:** Every amx function, with the exception of amx_NativeInfo, returns one of these error codes if a problem was encountered.
```cpp
enum
{
AMX_ERR_NONE,
/* reserve the first 15 error codes for exit codes of the abstract machine */
AMX_ERR_EXIT, /* forced exit */
AMX_ERR_ASSERT, /* assertion failed */
AMX_ERR_STACKERR, /* stack/heap collision */
AMX_ERR_BOUNDS, /* index out of bounds */
AMX_ERR_MEMACCESS, /* invalid memory access */
AMX_ERR_INVINSTR, /* invalid instruction */
AMX_ERR_STACKLOW, /* stack underflow */
AMX_ERR_HEAPLOW, /* heap underflow */
AMX_ERR_CALLBACK, /* no callback, or invalid callback */
AMX_ERR_NATIVE, /* native function failed */
AMX_ERR_DIVIDE, /* divide by zero */
AMX_ERR_SLEEP, /* go into sleepmode - code can be restarted */
AMX_ERR_INVSTATE, /* invalid state for this access */
AMX_ERR_MEMORY = 16, /* out of memory */
AMX_ERR_FORMAT, /* invalid file format */
AMX_ERR_VERSION, /* file is for a newer version of the AMX */
AMX_ERR_NOTFOUND, /* function not found */
AMX_ERR_INDEX, /* invalid index parameter (bad entry point) */
AMX_ERR_DEBUG, /* debugger cannot run */
AMX_ERR_INIT, /* AMX not initialized (or doubly initialized) */
AMX_ERR_USERDATA, /* unable to set user data field (table full) */
AMX_ERR_INIT_JIT, /* cannot initialize the JIT */
AMX_ERR_PARAMS, /* parameter error */
AMX_ERR_DOMAIN, /* domain error, expression result does not fit in range */
AMX_ERR_GENERAL, /* general error (unknown or unspecific error) */
};
```
## Amx functions
The amx functions are very well documented documented inside of the PAWN implementers guide, which can be found here. Instead of reinventing the wheel and explaining all the functions in my own words, im simply going to copy them here from the implementers guide, and make them a bit more presentable; I believe this will make the content much more accessible. With that said, this section will be mostly a reference for the next section which is focused on something that the implementers guide lacks, example code. Note: I will only be covering the functions that i think are vital for plugins (for now). Anything else can be found in the implementers guide, just make sure you use the version i linked to in this section!
### Key
\+ => Not Available
## amx_Allot
\- Reserve heap space in the abstract machine
### Syntax
```cpp
int amx_Allot(AMX *amx, int cells, cell *amx_addr, cell **phys_addr);
```
| Parameter | Description |
| ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **amx** | The abstract machine. |
| **cells** | The number of cells to reserve. |
| **amx_addr** | The address of the allocated cell as the pawn program (that runs in the abstract machine) can access it. phys_addr The address of the cell for C/C++ programs to access. |
**Notes:** In earlier releases of pawn, arrays and strings had to be passed to a script after explicitly allocating memory for it on the amx stack. In the current release, this functionality has been largely replaced by the functions amx_PushArray and amx_PushString. A pawn function can only access memory inside its abstract machine. If a parameter is to be passed “by reference” to a pawn function, one must pass the address of that parameter to amx_Exec. In addition, that address itself must be within the address range of the abstract machine too. An added complexity is that the abstract machine uses addresses that are relative to the data section of the abstract machine, and the host program uses address relative to the environment that the operating system gives it.
amx_Allot allocates memory cells inside the abstract machine and it returns two addresses. The amx_addr parameter is the address of the variable relative to the “data section” of the abstract machine; this is the value you should pass to amx_Exec (via amx_Push). Pa- rameter phys_addr holds the address relative to the host program’s address space. So a C/C++ program can use this address and write into the allocated memory. After amx_Exec returns, you may inspect the memory block (the pawn function called by amx_Exec may have written into it) and finally release it by calling amx_Release.
**See also:** [amx_Exec](#amx_Exec), [amx_PushArray](#amx_PushArray), [amx_PushString](#amx_PushString), [amx_Release](#amx_Release)
## amx_ctof
\- Cast “cell” to “float”
### Syntax
```cpp
[float] amx_ctof([cell] c);
```
| Parameter | Description |
| --------- | ---------------------------------------------- |
| **c** | The value to cast from “cell” type to “float”. |
**Returns:** The same bit pattern, but now as a floating point type.
**Notes:** This macro casts a “cell” type into a “float” type without changing the bit pattern. A normal type cast in C/C++ changes the memory representation of the expression so that its numeric value in IEEE 754 format comes closest to the original integer value. The pawn parser and abstract machine store floating point values in a cell — when retrieving a floating point value from a cell, the bit pattern must not be changed.
**See also:** [amx_ftoc](#amx_ftoc)
## amx_Exec
\- Run code
### Syntax
```cpp
int amx_Exec(AMX *amx, long *retval, int index);
```
| Parameter | Description |
| ---------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **amx** | The abstract machine from which to call a function. |
| **retval** | Will hold the return value of the called function uponreturn. This parameter may be NULL if you are notinterested in the return value. |
| **index** | An index into the “public function table”; it indicatesthe function to execute. See amx_FindPublic formoreinformation. Use AMX_EXEC_MAIN to start executingat the main function, and AMX_EXEC_CONT to continueexecution from a “sleep state”. |
**Notes:** This function runs the script, starting at the indicated function. It calls the callback function for any native function call that the code in the amx makes. amx_Exec assumes that all native functions are correctly initialized with amx_Register.
**See also:** [amx_FindPublic](#amx_FindPublic), [amx_Register](#amx_Register)
## amx_FindPublic
\- Return the index of a public function
### Syntax
```cpp
int amx_FindPublic(AMX *amx, char *funcname, int *index);
```
| Parameter | Description |
| ------------ | ---------------------------------------------------------------------------- |
| **amx** | The abstract machine. |
| **funcname** | The name of the public function to find. |
| **index** | Upon return, this parameter holds the index of therequested public function. |
**See also:** [amx_Exec](#amx_Exec), amx_FindNative+, amx_FindPubVar+, amx_GetPublic+, amx_NumPublics+
## amx_ftoc
\- Cast “float” to “cell”
### Syntax
```cpp
[cell] amx_ftoc([float] f);
```
| Parameter | Description |
| --------- | ---------------------------------------------- |
| **f** | The value to cast from “float” type to “cell”. |
**Returns:** The same bit pattern, but now as a “cell” type.
**Notes:** This macro casts a “float” type into a “cell” type without changing the bit pattern. A normal type cast in C/C++ changes the memory representation of the expression so that its numeric value in integer format is the integral (truncated) value of the original rational value. The pawn parser and abstract machine store floating point values in a cell —when storing a floating point value in a cell, the bit pattern must not be changed.
**See also:** [amx_ctof](#amx_ctof)
## amx_GetAddr
\- Resolve an AMX address
### Syntax
```cpp
int amx_GetAddr(AMX *amx,cell amx_addr,cell **phys_addr);
```
| Parameter | Description |
| ------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **amx** | The abstract machine. |
| **amx_addr** | The address relative to the abstract machine. |
| **phys_addr** | A pointer to the variable that will hold the memoryaddress of the indicated cell. If the amx_addr parame-ter is not a valid address inside the abstract machine,phys_addr will be set to NULL. |
**Notes:** This function returns the memory address of an address in the abstract machine. One typically uses this function in an extension module, because it allows you to access variables inside the abstract machine.
## amx_GetString
\- Retrieve a string from the abstract machine
### Syntax
```cpp
int amx_GetString(char *dest, cell *source, int use_wchar, size_t size);
```
| Parameter | Description |
| ------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **dest** | A pointer to a character array of sufficient size to holdthe converted source string. |
| **source** | A pointer to the source string. Use amx_GetAddr toconvert a string address in the amx to the physicaladdress. |
| **use_wchar** | A non-zero value interprets the dest argument as apointer to “wide characters” —i.e. wchar_t, regard-less of its char type. This allows the function to storeUnicode strings. |
| **size** | The maximum number of characters to store in dest,including the terminating zero byte. If the string inthe source is longer, the string in dest will be trun-cated. |
**Notes:** This function converts both packed strings and unpacked strings from the “pawn” format to the “C format. When retrieving an unpacked string with parameter use_wchar set to zero, the function may truncate characters from wide characters to 8-bit ASCII/ANSI.
**See also:** [amx_SetString](#amx_SetString)
## amx_Push
\- Pass a numeric argument “by-value”
### Syntax
```cpp
int amx_Push(AMX *amx, cell value);
```
| Parameter | Description |
| --------- | ----------------------------------------- |
| **amx** | The abstract machine. |
| **value** | The value to pass to the public function. |
**Notes:** Any parameters to a public function must be pushed to the function before calling amx_Exec. If a public function has multiple arguments, the arguments must be pushed int reverse order.
**See also:** [amx_Exec](#amx_Exec), [amx_PushArray](#amx_PushArray), [amx_PushString](#amx_PushString)
## amx_PushArray
\- Pass an argument or array “by-reference”
### Syntax
```cpp
int amx_PushArray(AMX *amx, cell *amx_addr, cell **phys_addr, const cell array[], int numcells);
```
| Parameter | Description |
| ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **amx** | The abstract machine. |
| **amx_addr** | The address of the allocated cell as the pawn program (that runs in the abstract machine) can access it, needed to release the memory block. This parameter may be NULL. |
| **phys_addr** | The address of the cell for C/C++ programs to access. This parameter may be NULL. |
| **array** | The array of values to pass to the public function. A single cell that must be passed by-reference is regarded as a single-cell array. |
| **numcells** | The number of elements in the array. |
**Notes:** Any parameters to a public function must be pushed to the function before calling amx_Exec. If a public function has multiple arguments, the arguments must be pushed int reverse order. The function allocates memory for the array inside the “heap” of the abstract machine. This memory must be freed with amx_Release. See function amx_Allot for details on the parameters amx_addr and phys_addr.
**See also:** [amx_Exec](#amx_Exec), [amx_Push](#amx_Push), [amx_PushString](#amx_PushString), [amx_Release](#amx_Release)
## amx_PushString
\- Pass a string argument
### Syntax
```cpp
int amx PushString(AMX *amx, cell *amx_addr, cell **phys_addr, const char *string, int pack, int use_wchar);
```
| Parameter | Description |
| ------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **amx** | The abstract machine. |
| **amx_addr** | The address of the allocated cell as the pawn program (that runs in the abstract machine) can access it, needed to release the memory block. This parameter may be NULL. |
| **phys_addr** | The address of the cell for C/C++ programs to access. This parameter may be NULL. |
| **string** | The string to pass to the public function. |
| **pack** | Non-zero to convert the source string to a packed string in the abstract machine, zero to convert the source string to a cell string. |
| **use_wchar** | A non-zero value interprets the string argument as a pointer to “wide characters” i.e. wchar_t, regardless of its char type. This allows the function to accept Unicode strings. |
**Notes:** Any parameters to a public function must be pushed to the function before calling amx_Exec. If a public function has multiple arguments, the arguments must be pushed int reverse order. The function allocates memory for the array inside the “heap” of the abstract machine. This memory must be freed with amx_Release. See function amx_Allot for details on the parameters amx_addr and phys_addr. When you pass in an Unicode string and request a packed format in the abstract machine (i.e. both pack and use_wchar are true), the characters are truncated to 8-bits.
**See also:** [amx_Exec](#amx_Exec), [amx_Push](#amx_Push), [amx_PushArray](#amx_PushArray), [amx_Release](#amx_Release), [amx_SetString](#amx_SetString)
## amx_Register
\- Make native functions known
### Syntax
```cpp
int amx Register(AMX *amx, AMX NATIVE INFO *list, int number);
```
| Parameter | Description |
| ---------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **amx** | The abstract machine. |
| **list** | An array with structures where each structure holdsa pointer to the name of a native function and a function pointer. The list is optionally terminated with astructure holding two NULL pointers. |
| **number** | The number of structures in the list array, or -1 if thelist ends with a structure holding two NULL pointers. |
**Notes:** On success, this function returns 0 (AMX_ERR_NONE). If this function returns the error code AMX_ERR_NOTFOUND, one or more native functions that are used by the pawn program are not found in the provided list. You can call amx_Register again to register additional function lists.
To check whether all native functions used in the compiled script have been registered, call amx_Register with the parameter list set to NULL. This call will not register any new native functions, but still return AMX_ERR_NOTFOUND if any native function is unregistered.
**See also:** amx_NativeInfo+
## amx_Release
\- Free heap space in the abstract machine
### Syntax
```cpp
int amx Release(AMX *amx,cell amx_addr);
```
| Parameter | Description |
| ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **amx** | The abstract machine. |
| **amx_addr** | The address of the allocated cell as the pawn program (that runs in the abstract machine) sees it. This value is returned by amx_Allot, amx_PushArray and amx_PushString. |
**Notes:** amx_Allot allocates memory on the heap in ascending order (the heap grows upwards). amx_Release frees all memory above the value of the input parameter amx_addr. That is, a single call to amx_Release can free multiple calls to amx_Allot if you pass the amx_addr value of the first allocation.amx_PushArray and amx_PushString use amx_Allot internally, so the same procedure applies to these functions as well.
**See also:** [amx_Allot](#amx_Allot), [amx_PushArray](#amx_PushArray), [amx_PushString](#amx_PushString)
## amx_SetString
\- Store a string in the abstract machine
### Syntax
```cpp
int amx SetString(cell *dest, char *source, int pack, int use_wchar, size_t size);
```
| Parameter | Description |
| ------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **dest** | A pointer to a character array in the amx where the converted string is stored. Use amx_GetAddr to convert a string address in the amx to the physical address. |
| **source** | A pointer to the source string. |
| **pack** | Non-zero to convert the source string to a packed string in the abstract machine, zero to convert the source string to a cell string. |
| **string** | The string to pass to the public function. |
| **use_wchar** | A non-zero value interprets the string argument as a pointer to “wide characters” i.e. wchar_t, regardless of its char type. This allows the function to accept Unicode strings. |
| **size** | The maximum number of cells to store in dest, including the terminating zero byte or cell. If the string in the source is longer than can fit in the number of cells in dest, it will be truncated. |
**Notes:** When you pass in an Unicode string and request a packed format in the abstract machine (i.e. both pack and use_wchar are true), the characters are truncated to 8-bits.
**See also:** [amx_GetString](#amx_GetString)
## amx_StrLen
\- Get the string length in characters
### Syntax
```cpp
int amx_StrLen(const cell *cstring, int *length);
```
| Parameter | Description |
| ----------- | ------------------------------------------------------- |
| **cstring** | The string in the abstract machine. |
| **length** | This parameter will hold the string length upon return. |
**Notes:** This function determines the length in characters of the string, not including the zero-terminating character (or cell). A packed string occupies less cells than its number if characters. If the cstring parameter is NULL, the length parameter is set to zero (0) and the function returns with an error code. For converting unpacked strings to UTF-8, function amx_UTF8Len may be more convenient.
**See also:** [amx_GetAddr](#amx_GetAddr), [amx_GetString](#amx_GetString), [amx_SetString](#amx_SetString), [amx_StrParam](#amx_StrParam), amx_UTF8Len+
## amx_StrParam
\- Get a string parameter from an abstract machine
### Syntax
```cpp
amx_StrParam([AMX*] amx, int] param, [char*] result);
```
| Parameter | Description |
| ---------- | ----------------------------------------------- |
| **amx** | The abstract machine. |
| **param** | The parameter number. |
| **result** | A variable that will hold the result on return. |
**Notes:** This macro allocates a block of memory (with alloca) and copies a string parameter (to a native function) in that block. See page 56 for an example of using this macro.
**See also:** [amx_GetAddr](#amx_GetAddr), [amx_GetString](#amx_GetString), [amx_StrLen](#amx_StrLen)
## Amx function examples
In an attempt at avoiding huge text walls, I've decided to add comments to the code explaining what I'm doing instead of typing it out in the topic. It's probably a good idea to have the wiki article open as a reference while reading the examples.
### Registering natives
Every single function we provide PAWN with has to be registered so the abstract machine can be aware of its existence. So i think its probably a good idea to start off with amx_Regester! Luckily we actually already used an example of registering a native one of our previous sections, so I'll be using that example again and adding some comments.
```cpp
//An array of the functions we wish to register with the abstract machine.
AMX_NATIVE_INFO PluginNatives[] =
{
//Here we specify our native functions information and terminate the array with two null values.
{"HelloWorld", HelloWorld},
{0, 0}
};
PLUGIN_EXPORT int PLUGIN_CALL AmxLoad( AMX *amx )
{
//Here we register our natives to the abstract machine. Note how we're using -1. Normally this would have to be the number of
//functions we're registering, but since we terminated the array with two null values, we can specify -1.
return amx_Register(amx, PluginNatives, -1);
}
```
- ### Getting a string and its length
```cpp
//This function demonstrates: how to get a string (and its length) from PAWN.
//PAWN native: native PrintPawnString(const str[]);
cell AMX_NATIVE_CALL PrintPawnString(AMX* amx, cell* params)
{
int
len = NULL,
ret = NULL;
cell *addr = NULL;
//Get the address of our string param (str) and then get its length
amx_GetAddr(amx, params[1], &addr);
amx_StrLen(addr, &len);
//if the length of input isnt 0
if(len)
{
//We increase len because we want to make room for the terminating null char when we allocate memory.
//Also because GetString's size parameter counts the null chracter, we have to specify the length
//of the string + 1; otherwise our string will be truncated to make room for the null char (we'd lose 1 character).
len++;
//Allocate memory to hold our string we're passing (str) and then "get" the string using our allocated memory to store it.
char* text = new char[ len ];
amx_GetString(text, addr, 0, len);
//Use logprintf to print out string (text). We dont use std::cout because it doesnt write to the server log (only the console).
logprintf(text);
//Deallocate our memory...
delete[] text;
}
return 1;
}
```
### Alternative way to get a string
I decided to add this section because i know people are going to be tempted by the simplicity of it, and i think they should know the risks and problems that can come from it.
```cpp
//This function demonstrates: an alternative method to getting strings from pawn- and the possible risks that come with it.
//PAWN native: native PrintPawnString2(const str[]);
cell AMX_NATIVE_CALL PrintPawnString2(AMX* amx, cell* params)
{
//This method is NOT recomended as the amx_StrParam macro uses the alloca function which is NOT a standard in C, OR C++.
//Using this method comes with risks of overflowing the stack (If you allocate large amounts of memory) and also
//gives you the risk of bugs (this function is machine AND compiler dependent- some implementations are said to be bugged).
char* text = NULL;
amx_StrParam(amx, params[1], text);
//Check if text is null
if(text != NULL)
{
//Use logprintf to print out string (text). We dont use std::cout because it doesnt write to the server log (only the console).
logprintf(text);
}
return 1;
```
### How to set a string
```cpp
//This function demonstrates: how to modify a PAWN string.
//PAWN native: native SetPawnString(str[], len = sizeof(str));
cell AMX_NATIVE_CALL SetPawnString(AMX* amx, cell* params)
{
const string message = "This is a string from C/++!!";
cell* addr = NULL;
//Get the address of our string parameter (str) and store our message
amx_GetAddr(amx, params[1], &addr);
amx_SetString(addr, message.c_str(), 0, 0, params[2]);
return 1;
}
```
### Casting and returning floats
```cpp
//This function demonstrates: how to cast a float to a PAWN float, and return it.
//PAWN native: native Float:ReturnPawnFloatVal();
cell AMX_NATIVE_CALL ReturnPawnFloatVal(AMX* amx, cell* params)
{
//Since PAWN is a typeless language it stores everything as a 32bit integer and relies on tags to handle special data.
//A floating point number is no exception to this; It's a still 32bit int, but it has a Float tag to show that it shouldnt
//be treated like an regular integer. So how do we convert a float to an 32bit integer (for PAWN) without losing data?
//The answer is the amx_ftoc macro!
//The macro amx_ftoc type casts a float into a cell while preserving its bit pattern (amx_ctof does the inverse).
const float f = 22.624f;
return amx_ftoc(f);
}
```
### Passing parameters by reference
```cpp
//This function demonstrates: How to pass parameters by reference.
//PAWN native: native SetPawnReferenceVars(&value1, &Float:value2);
cell AMX_NATIVE_CALL SetPawnReferenceVars(AMX* amx, cell* params)
{
const int val = 65;
const float val2 = 84.54f;
cell* addr[2] = {NULL, NULL};
//Get the addresses of "value1" and "value2"
amx_GetAddr(amx, params[1], &addr[0]);
amx_GetAddr(amx, params[2], &addr[1]);
//Dereference our pointers and assign our values. Remember to ALWAYS use the macro "amx_ftoc" to convert floats into
//cells (the appropriate float format for PAWN)!
*addr[0] = val;
*addr[1] = amx_ftoc(val2);
return 1;
}
```
### Getting and modding array values
```cpp
//This function demonstrates: how to get and modify array values.
//PAWN native: native PrintPawnArray(arr[], size = sizeof(arr));
cell AMX_NATIVE_CALL PrintPawnArray(AMX* amx, cell* params)
{
//Make sure there's something to print...
if(params[2] > 0)
{
cell* addr = NULL;
//Get the address of the first value in our PAWN array.
amx_GetAddr(amx, params[1], &addr);
for(int i = 0, l = params[2]; i < l; i++)
{
//This is pretty straight forward: We dereference the addr pointer to get our value to print.
//You should know this already, but arrays and pointers are almost the same thing, so we can use pointer
//arithmetic to add an offset OR just use the subscript operator (in the end *(addr+1) and addr[1] are the same).
logprintf("arr[%d] = %d", i, *(addr + i));
//If you wanted to modify the array you would just change its value by dereferencing addr and assigning a new value.
//You should know this as well, im just adding it in for completeness. Here we change the first value of our array
//to 5 (Note: Since its the first value, no offset it used).
// *(addr) = 5;
}
}
return 1;
}
```
### Call a callback
```cpp
//This function demonstrates: How to call a callback that is in a PAWN script.
//PAWN native: native EmitPawnCallback();
cell AMX_NATIVE_CALL EmitPawnCallback(AMX* amx, cell* params)
{
int idx;
const cell var = 3;
const cell arr[] = {100, 4, 33};
const string str = "Some random message from C++.";
//Pawn callback: forward OnPawnCallbackEmitted(var, arr[], str[]);
//Find our callback and store its place in the public function table (it's index) into our idx var.
if(!amx_FindPublic(amx, "OnPawnCallbackEmitted", &idx))
{
cell
ret,
addr;
//Here we push our arguments to our function. Note that if the function has multiple arguments you have to push your
//values in reverse order! Thats why we're pushing the string first, then the array, and finally our integer.
amx_PushString(amx, &addr, NULL, str.c_str(), NULL, NULL);
//amx_PushArray(amx, NULL, NULL, arr, sizeof(arr) / sizeof(cell));
cell
amx_addr,
*phys_addr;
//For some reason amx_PushArray seems to be crashing the server, and i have NO idea why. My usage should be completely
//valid judging from the implementers guide, and the code itself. Since the function isnt working we'll have to
//use the old method and allocate the memory, set it, and push it all ourselves. This is pretty straight forward. We
//allocate memory on the heap using amx_Allot (this returns 2 addresses- one of the location in the abstract machine
//(amx_addr), and one relative to the actual server's address space (phsy_addr - which we can use in C++)). Once the
//memory is allocated we use memcpy to copy the memory from our array to our phys_addr address location.
amx_Allot(amx, sizeof(arr) / sizeof(cell), &amx_addr, &phys_addr);
memcpy(phys_addr, arr, sizeof(arr));
amx_Push(amx, amx_addr);
//Push our integer value
amx_Push(amx, var);
//Execute our function using our previously obtained idx var.
//Note: This function's second parameter is what the callback returned (Can be NULL if you're not interested in return values).
amx_Exec(amx, &ret, idx);
//Release our memory that we allocated. The function amx_Alloc allocates memory on the heap in the abstract machine.
//The functions amx_PushString and amx_PushArray both use this function internally so you have to release the memory every time
//you use one of those functions. NOTE: We used both amx_PushString and amx_PushArray, and yet we only have ONE release call.
//This is because memory on the heap is allocated in ascending order! amx_Release release all the memory above a certain point
//(the second parameter, amx_addr - which is our addr variable). Since it does this we ONLY store the address from the amx_PushString
//call, as it'll delete everything from that point on.
amx_Release(amx, addr);
//Print the return value (for completeness).
logprintf("EmitPawnCallback NOTE: OnPawnCallbackEmitted callback returned %d!", ret);
}
return 1;
```
## Calling natives and hooking callbacks
Before i get into callback hooking or SA-MP native calling, i thought i should shed light on something first. Some people seem to think that plugins are a replacement for PAWN, this simply isnt the case. Plugins were designed to provide functionality TO PAWN, not to serve as a replacement for it. There are times when developing something as a plugin rather then a PAWN script doesnt make sense- its important to ask yourself if you should really be coding something as a plugin rather then a pawn script.
There are a lot of different methods you can use for both callback hooking and sa-mp native calling. Im only going to be focusing on one method oh each for now though.
### Invoke
Invoke is a SA-MP native function calling method that was created by incognito. You can find it [here](https://github.com/Dystans/SA-MP_Invoke_2.0). Please note that there is a text file in there containing a function with tons of SA-MP native function calls. This is vital for invoke, and must be added to your plugin's include file. Invoke will not work if you dont have a public PAWN function that uses all the SA-MP natives your plugin requires. This function is only so invoke can find the addresses of the natives, and should **never** actually be used anywhere.
#### Getting started
Before we can start calling SA-MP natives, we have to setup Invoke. The first thing we have to do is include it inside of our project, you should remember how to do this from the previous "Getting started" section. Once you have the files added to your project there are just a few simple steps to get Invoke working:
- Include the invoke header.
- Allocate memory for the invoke instance under Load.
- Push back the amx_list member variable every time a new AMX instance is loaded under AmxLoad.
- Every time a script gets unloaded, iterate through Invoke's amx_list, find the unloaded AMX instance, and erase it under AmxUnload.
- Create a native that calls Invoke's "getAddresses" member function for PAWN to use when a filterscript or gamemode is loaded that uses our plugin.
Thats about it for getting invoke setup for your plugin. The only thing left to do is to add the public PAWN function found in the invoke package (the txt file we spoke of earlier) to your plugin's include, and use the native from the last setup step when a script is loaded. Anyone who will be creating plugins for public release, i encourage you to look into THIS post. It allows for a clean seamless "hook" of the OnGameModeInit/OnFilterScriptInit callbacks so you can register SA-MP's native addresses while not forcing the end user to add a function into those callbacks themselves.
**Note:** Im aware that explaining this in text form probably isnt ideal for most newer users; however these are all standard C/++ tasks that you should already be familiar with- and those that arent (ie: creating a native) were already explained! If you're having trouble following along, i suggest getting a bit more familiar with C/++. With that being said though there will be an updated source code file (along with an actual include for our plugin) later on in this article with comments on everything we've learned so far. Look at that updated source file if you have any problems.
#### Adding SA-MP natives
Sadly invoke isnt magic, and does require maintenance to add new natives or remove deprecated ones. The version from the previous section has all the natives from the 0.2.2 version of SA-MP, so its missing all the newer functions. For these two reasons i decided to add this section! If someone is nice enough to add all the missing natives i will update the invoke package and include them in the credits- if not, i suggest adding natives on an as needed basis.
Inside of the invoke header you should see a big array of function names (the array is appropriately called "name") and a lot of static "Native" structure declarations. To add a native you simply have to add its name to the array of names, and declare a Native structure with the appropriate information- name, and parameter specifiers. There are a lot of available parameter specifiers available to use:
```cpp
i = integer
f = float value
s = string
v = reference variable (GetPlayerPos, GetPlayerKeys, etc.)
p = string var (GetPlayerName etc.)
```
**Remember to update the public PAWN function that calls all the natives.** Any time you add a native you need to also add it to said public function.
#### Calling natives
Invoke uses the variadic member function appropriately named "callNative" to call natives. The parameters for this function are a pointer to a Native structure (see previous section) containing info on the native function, and an ellipsis for all the parameters for said native function. The function returns the return value of the native that is being called. Here is an example function that calls multiple natives, with differing parameter types (int, reference, and string var).
```cpp
//This function demonstrates: how to use invoke to call SA-MP natives.
//PAWN native: native WhereIsPlayer(playerid);
cell AMX_NATIVE_CALL WhereIsPlayer(AMX* amx, cell* params)
{
float
x = NULL,
y = NULL,
z = NULL;
//Get the player's position (and check to see if he is even connected).
if(g_Invoke->callNative(&PAWN::GetPlayerPos, params[1], &x, &y, &z))
{
char name[24];
//Get the rest of the player's information (name, interior, and virtualworld) and print it.
g_Invoke->callNative(&PAWN::GetPlayerName, params[1], name);
int interior = g_Invoke->callNative(&PAWN::GetPlayerInterior, params[1]);
int virtualworld = g_Invoke->callNative(&PAWN::GetPlayerVirtualWorld, params[1]);
logprintf("%s is at X: %.2f, Y: %.2f, Z: %.2f (Virtual world: %d, Interior %d).", name, x, y, z, virtualworld, interior);
return 1;
}
return 0;
}
```
### Hooking callbacks
Using the invoke method, there is no 100% transparent hooking method when it comes to callbacks. Plugins that want to hook callbacks that are using invoke have go through PAWN to do so. You can create a native function that you can call inside the PAWN callback you wish to hook, and use that native as a sort of pseudo callback. You can do this in a manner that requires no work on the end user by using the ALS hooking method.
The first step is obviously creating the native (remember to add it to our list of natives to register, and also add it in your include later on). The callback i decided to hook is OnPlayerConnect, so im gonna write a native function that has the same arguments as the callback, and then add the code that requires the callback (in this case a little joke).
```cpp
//This function demonstrates: how to write a native to act as a callback.
//PAWN native: native TEST_Hook_OnPlayerConnnect(playerid);
cell AMX_NATIVE_CALL TEST_Hook_OnPlayerConnnect(AMX* amx, cell* params)
{
//Get the players name
char name[24];
g_Invoke->callNative(&PAWN::GetPlayerName, params[1], name);
//Check if his name is "Mario".
if(string("Mario") == name)
{
//If it is send our funny little message and kick him.
g_Invoke->callNative(&PAWN::SendClientMessage, params[1], 0xFFFFFFFF, "Sorry {FF0000}Mario, {FFFFFF}but your princess is in another server.");
g_Invoke->callNative(&PAWN::Kick, params[1]);
}
return 1;
}
```
TEST_Hook_OnPlayerConnnect will now act as our plugin's OnPlayerConnect callback. Since our plugin's name is "Test" and its rather short i decided to let that act as our prefix for hooking. You generally want something unique for your prefixes so you dont collide with other people's plugins/includes. **Note:** We still have to call this function from PAWN using the ALS method we spoke of earlier for user convenience. Since Y_Less does a great job of explaining the ALS method, there's really no point for me to go into details about it, i will simply provide hooking example for our TEST_Hook_OnPlayerConnect callback. This should be put in your plugins include file.
```cpp
public OnPlayerConnect(playerid)
{
TEST_Hook_OnPlayerConnnect(playerid);
//..
if(funcidx("TEST_OnPlayerConnect") != -1)
{
return CallLocalFunction("TEST_OnPlayerConnect", "d", playerid);
}
return 1;
}
#if defined _ALS_OnPlayerConnect
#undef OnPlayerConnect
#else
#define _ALS_OnPlayerConnect
#endif
#define OnPlayerConnect TEST_OnPlayerConnect
forward TEST_OnPlayerConnect(playerid);
```
## Closing
Some of you experienced plugin developers might be wondering why i didnt include the GDK in the "Calling natives and hooking callbacks" section. I decided to leave it out for two reasons. The first being that i simply do not have that much available time anymore, and couldnt spare any getting used to this new system. The second reason is that the GDK is very experimental and currently is struggling with crashes amongst other problems. Im quite aware of the speed differences between Invoke and GDK, and definitely will add it some time in the future if no one else does (remember, this is suppose to be a community driven thing). I think its best to wait for some more of the issues to be ironed out for now though (zeex is an amazing coder, and im sure he'll iron everything out ).
Also, as i promised, here is the update include/source file with comments on everything we've hopefully learned:
### Plugin include
```cpp
//Anything with the prefix "TEST" should be changed if you called your plugin something
//different. This also goes for the plugin code (TEST_Hook_OnPlayerConnect specifically).
#if defined _TEST_INCLUDED
#endinput
#endif
#define _TEST_INCLUDED
#pragma library Test
#include <a_samp>
//Example natives
native PrintPawnString(const str[]);
native PrintPawnString2(const str[]);
native SetPawnString(str[], len = sizeof(str));
native Float:ReturnPawnFloatVal();
native SetPawnReferenceVars(&value1, &Float:value2);
native PrintPawnArray(arr[], size = sizeof(arr));
native EmitPawnCallback();
native WhereIsPlayer(playerid);
native TEST_Hook_OnPlayerConnnect(playerid);
//Invoke native
native Invoke_GetAddresses();
//Callback hooks
public OnPlayerConnect(playerid)
{
TEST_Hook_OnPlayerConnnect(playerid);
//..
if(funcidx("TEST_OnPlayerConnect") != -1)
{
return CallLocalFunction("TEST_OnPlayerConnect", "d", playerid);
}
return 1;
}
#if defined _ALS_OnPlayerConnect
#undef OnPlayerConnect
#else
#define _ALS_OnPlayerConnect
#endif
#define OnPlayerConnect TEST_OnPlayerConnect
forward TEST_OnPlayerConnect(playerid);
public OnGameModeInit()
{
Invoke_GetAddresses();
//..
if(funcidx("TEST_OnGameModeInit") != -1)
{
return CallLocalFunction("TEST_OnGameModeInit", "");
}
return 1;
}
#if defined _ALS_OnGameModeInit
#undef OnGameModeInit
#else
#define _ALS_OnGameModeInit
#endif
#define OnGameModeInit TEST_OnGameModeInit
forward TEST_OnGameModeInit();
public OnFilterScriptInit()
{
Invoke_GetAddresses();
//..
if(funcidx("TEST_OnFilterScriptInit") != -1)
{
return CallLocalFunction("TEST_OnFilterScriptInit", "");
}
return 1;
}
#if defined _ALS_OnFilterScriptInit
#undef OnFilterScriptInit
#else
#define _ALS_OnFilterScriptInit
#endif
#define OnFilterScriptInit TEST_OnFilterScriptInit
forward TEST_OnFilterScriptInit();
//Public function for invoke
forward InvokeFunction();
public InvokeFunction()
{
new Float:fVar;
new Var[ 256 ];
new iVar;
// a_samp.inc
SendClientMessage(0, 0, "");
SendClientMessageToAll(0, "");
SendDeathMessage(0, 0, 0);
GameTextForAll("", 0, 0);
GameTextForPlayer(0, "", 0, 0);
GetTickCount();
GetMaxPlayers();
SetGameModeText("");
SetTeamCount(0);
AddPlayerClass(0, 0.0, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0);
AddPlayerClassEx(0, 0, 0.0, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0);
AddStaticVehicle(0, 0.0, 0.0, 0.0, 0.0, 0, 0);
AddStaticVehicleEx(0, 0.0, 0.0, 0.0, 0.0, 0, 0, 0);
AddStaticPickup(0, 0, 0.0, 0.0, 0.0);
ShowNameTags(0);
ShowPlayerMarkers(0);
GameModeExit();
SetWorldTime(0);
GetWeaponName(0, Var, sizeof( Var ) );
EnableTirePopping(0);
AllowInteriorWeapons(0);
SetWeather(0);
SetGravity(0.0);
AllowAdminTeleport(0);
SetDeathDropAmount(0);
CreateExplosion(0.0, 0.0, 0.0, 0, 0.0);
//SetDisabledWeapons();
EnableZoneNames(0);
IsPlayerAdmin(0);
Kick(0);
Ban(0);
SendRconCommand("");
ShowPlayerDialog(0,0,0,"lol","lol","lol","lol");
// a_players.inc
SetSpawnInfo(0, 0, 0, 0.0, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0,0);
SpawnPlayer(0);
SetPlayerPos(0, 0.0, 0.0, 0.0);
// SetPlayerPosFindZ(0, 0.0, 0.0, 0.0);
GetPlayerPos(0, fVar, fVar, fVar);
SetPlayerFacingAngle(0,0.0);
GetPlayerFacingAngle(0,fVar);
SetPlayerInterior(0,0);
GetPlayerInterior(0);
SetPlayerHealth(0, 0.0);
GetPlayerHealth(0, fVar);
SetPlayerArmour(0, 0.0);
GetPlayerArmour(0, fVar);
SetPlayerAmmo(0, 0,0);
GetPlayerAmmo(0);
SetPlayerTeam(0,0);
GetPlayerTeam(0);
SetPlayerScore(0,0);
GetPlayerScore(0);
SetPlayerColor(0,0);
GetPlayerColor(0);
SetPlayerSkin(0,0);
GivePlayerWeapon(0, 0,0);
ResetPlayerWeapons(0);
GetPlayerWeaponData(0, 0, iVar, iVar );
GivePlayerMoney(0,0);
ResetPlayerMoney(0);
SetPlayerName(0, "");
GetPlayerMoney(0);
GetPlayerState(0);
GetPlayerIp(0, Var, sizeof( Var ));
GetPlayerPing(0);
GetPlayerWeapon(0);
GetPlayerKeys(0,iVar,iVar,iVar);
GetPlayerName(0, Var, sizeof( Var ));
PutPlayerInVehicle(0, 0,0);
GetPlayerVehicleID(0);
RemovePlayerFromVehicle(0);
TogglePlayerControllable(0,0);
PlayerPlaySound(0, 0, 0.0, 0.0,0.0);
SetPlayerCheckpoint(0, 0.0, 0.0, 0.0,0.0);
DisablePlayerCheckpoint(0);
SetPlayerRaceCheckpoint(0, 0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,0.0);
DisablePlayerRaceCheckpoint(0);
SetPlayerWorldBounds(0,0.0,0.0,0.0,0.0);
SetPlayerMarkerForPlayer(0, 0,0);
ShowPlayerNameTagForPlayer(0, 0,0);
SetPlayerMapIcon(0, 0, 0.0, 0.0, 0.0, 0,0);
RemovePlayerMapIcon(0,0);
SetPlayerCameraPos(0,0.0, 0.0, 0.0);
SetPlayerCameraLookAt(0, 0.0, 0.0, 0.0);
SetCameraBehindPlayer(0);
AllowPlayerTeleport(0,0);
IsPlayerConnected(0);
IsPlayerInVehicle(0,0);
IsPlayerInAnyVehicle(0);
IsPlayerInCheckpoint(0);
IsPlayerInRaceCheckpoint(0);
SetPlayerTime(0, 0,0);
TogglePlayerClock(0,0);
SetPlayerWeather(0,0);
GetPlayerTime(0,iVar,iVar);
SetPlayerVirtualWorld(0,0);
GetPlayerVirtualWorld(0);
// a_vehicle.inc
CreateVehicle(0,0.0,0.0,0.0,0.0,0,0,0);
DestroyVehicle(0);
GetVehiclePos(0,fVar,fVar,fVar);
SetVehiclePos(0,0.0,0.0,0.0);
GetVehicleZAngle(0,fVar);
SetVehicleZAngle(0,0.0);
SetVehicleParamsForPlayer(0,0,0,0);
SetVehicleToRespawn(0);
LinkVehicleToInterior(0,0);
AddVehicleComponent(0,0);
ChangeVehicleColor(0,0,0);
ChangeVehiclePaintjob(0,0);
SetVehicleHealth(0,0.0);
GetVehicleHealth(0,fVar);
AttachTrailerToVehicle(0, 0);
DetachTrailerFromVehicle(0);
IsTrailerAttachedToVehicle(0);
GetVehicleModel(0);
SetVehicleNumberPlate(0,"");
SetVehicleVirtualWorld(0,0);
GetVehicleVirtualWorld(0);
ApplyAnimation(0,"","",1.0,0,0,0,0,0);
// a_objects.inc
CreateObject(0,0.0,0.0,0.0,0.0,0.0,0.0);
SetObjectPos(0,0.0,0.0,0.0);
GetObjectPos(0,fVar,fVar,fVar);
SetObjectRot(0,0.0,0.0,0.0);
GetObjectRot(0,fVar,fVar,fVar);
IsValidObject(0);
DestroyObject(0);
MoveObject(0,0.0,0.0,0.0,0.0);
StopObject(0);
CreatePlayerObject(0,0,0.0,0.0,0.0,0.0,0.0,0.0);
SetPlayerObjectPos(0,0,0.0,0.0,0.0);
GetPlayerObjectPos(0,0,fVar,fVar,fVar);
GetPlayerObjectRot(0,0,fVar,fVar,fVar);
SetPlayerObjectRot(0,0,0.0,0.0,0.0);
IsValidPlayerObject(0,0);
DestroyPlayerObject(0,0);
MovePlayerObject(0,0,0.0,0.0,0.0,0.0);
StopPlayerObject(0,0);
// Menu's
CreateMenu("", 0, 0.0, 0.0, 0.0, 0.0);
DestroyMenu(Menu:0);
AddMenuItem(Menu:0, 0, "");
SetMenuColumnHeader(Menu:0, 0, "");
ShowMenuForPlayer(Menu:0, 0);
HideMenuForPlayer(Menu:0, 0);
IsValidMenu(Menu:0);
DisableMenu(Menu:0);
DisableMenuRow(Menu:0,0);
// Textdraw
TextDrawCreate(0.0,0.0,"");
TextDrawDestroy(Text:0);
TextDrawLetterSize(Text:0, 0.0,0.0);
TextDrawTextSize(Text:0, 0.0,0.0);
TextDrawAlignment(Text:0, 0);
TextDrawColor(Text:0,0);
TextDrawUseBox(Text:0, 0);
TextDrawBoxColor(Text:0, 0);
TextDrawSetShadow(Text:0, 0);
TextDrawSetOutline(Text:0, 0);
TextDrawBackgroundColor(Text:0,0);
TextDrawFont(Text:0, 0);
TextDrawSetProportional(Text:0, 0);
TextDrawShowForPlayer(0, Text:0);
TextDrawHideForPlayer(0, Text:0);
TextDrawShowForAll(Text:0);
TextDrawHideForAll(Text:0);
// Others
funcidx("");
gettime(iVar,iVar,iVar);
getdate(iVar,iVar,iVar);
tickcount(iVar);
return 1;
}
```
### Plugin source code
```cpp
#include "SDK\amx\amx.h"
#include "SDK\plugincommon.h"
#include "Invoke.h"
#include <string>
#include <vector>
#include <cstdlib>
#include <ctime>
typedef void (*logprintf_t)(char* format, ...);
logprintf_t logprintf;
extern void *pAMXFunctions;
using namespace std;
//This function demonstrates: how to get a string (and its length) from PAWN.
//PAWN native: native PrintPawnString(const str[]);
cell AMX_NATIVE_CALL PrintPawnString(AMX* amx, cell* params)
{
int
len = NULL,
ret = NULL;
cell *addr = NULL;
//Get the address of our string param (str) and then get its length
amx_GetAddr(amx, params[1], &addr);
amx_StrLen(addr, &len);
//if the length of input isnt 0
if(len)
{
//We increase len because we want to make room for the terminating null char when we allocate memory.
//Also because GetString's size parameter counts the null chracter, we have to specify the length
//of the string + 1; otherwise our string will be truncated to make room for the null char (we'd lose 1 character).
len++;
//Allocate memory to hold our string we're passing (str) and then "get" the string using our allocated memory to store it.
char* text = new char[ len ];
amx_GetString(text, addr, 0, len);
//Use logprintf to print out string (text). We dont use std::cout because it doesnt write to the server log (only the window).
logprintf(text);
//Deallocate our memory...
delete[] text;
}
return 1;
}
//This function demonstrates: How to call a callback that is in a PAWN script.
//PAWN native: native EmitPawnCallback();
cell AMX_NATIVE_CALL EmitPawnCallback(AMX* amx, cell* params)
{
int idx;
const cell var = 3;
const cell arr[] = {100, 4, 33};
const string str = "Some random message from C++.";
//Pawn callback: forward OnPawnCallbackEmitted(var, arr[], str[]);
//Find our callback and store its place in the public function table (it's index) into our idx var.
if(!amx_FindPublic(amx, "OnPawnCallbackEmitted", &idx))
{
cell
ret,
addr;
//Here we push our arguments to our function. Note that if the function has multiple arguments you have to push your
//values in reverse order! Thats why we're pushing the string first, then the array, and finally our integer.
amx_PushString(amx, &addr, NULL, str.c_str(), NULL, NULL);
//amx_PushArray(amx, NULL, NULL, arr, sizeof(arr) / sizeof(cell));
cell
amx_addr,
*phys_addr;
//For some reason amx_PushArray seems to be crashing the server, and i have NO idea why. My usage should be completely
//valid judging from the implementers guide, and the code itself. Since the function isnt working we'll have to
//use the old method and allocate the memory, set it, and push it all ourselves. This is pretty straight forward. We
//allocate memory on the heap using amx_Allot (this returns 2 addresses- one of the location in the abstract machine
//(amx_addr), and one relative to the actual server's address space (phsy_addr - which we can use in C++)). Once the
//memory is allocated we use memcpy to copy the memory from our array to our phys_addr address location.
amx_Allot(amx, sizeof(arr) / sizeof(cell), &amx_addr, &phys_addr);
memcpy(phys_addr, arr, sizeof(arr));
amx_Push(amx, amx_addr);
//Push our integer value
amx_Push(amx, var);
//Execute our function using our previously obtained idx var.
//Note: This function's second parameter is what the callback returned (Can be NULL if you're not interested in return values).
amx_Exec(amx, &ret, idx);
//Release our memory that we allocated. The function amx_Alloc allocates memory on the heap in the abstract machine.
//The functions amx_PushString and amx_PushArray both use this function internally so you have to release the memory every time
//you use one of those functions. NOTE: We used both amx_PushString and amx_PushArray, and yet we only have ONE release call.
//This is because memory on the heap is allocated in ascending order! amx_Release release all the memory above a certain point
//(the second parameter, amx_addr - which is our addr variable). Since it does this we ONLY store the address from the amx_PushString
//call, as it'll delete everything from that point on.
amx_Release(amx, addr);
//Print the return value (for completeness).
logprintf("EmitPawnCallback NOTE: OnPawnCallbackEmitted callback returned %d!", ret);
}
return 1;
}
//This function demonstrates: an alternative method to getting strings from pawn- and the possible risks that come with it.
//PAWN native: native PrintPawnString2(const str[]);
cell AMX_NATIVE_CALL PrintPawnString2(AMX* amx, cell* params)
{
//This method is NOT recomended as the amx_StrParam macro uses the alloca function which is NOT a standard in C, OR C++.
//Using this method comes with risks of overflowing the stack (If you allocate large amounts of memory) and also
//gives you the risk of bugs (this function is machine AND compiler dependent- some implementations are said to be bugged).
char* text = NULL;
amx_StrParam(amx, params[1], text);
//Check if text is null
if(text != NULL)
{
//Use logprintf to print out string (text). We dont use std::cout because it doesnt write to the server log (only the window).
logprintf(text);
}
return 1;
}
//This function demonstrates: how to modify a PAWN string.
//PAWN native: native SetPawnString(str[], len = sizeof(str));
cell AMX_NATIVE_CALL SetPawnString(AMX* amx, cell* params)
{
const string message = "This is a string from C/++!!";
cell* addr = NULL;
//Get the address of our string parameter (str) and store our message
amx_GetAddr(amx, params[1], &addr);
amx_SetString(addr, message.c_str(), 0, 0, params[2]);
return 1;
}
//This function demonstrates: how to cast a float to a PAWN float.
//PAWN native: native Float:ReturnPawnFloatVal();
cell AMX_NATIVE_CALL ReturnPawnFloatVal(AMX* amx, cell* params)
{
//Since PAWN is a typeless language it stores everything as a 32bit integer and relies on tags to handle special data.
//A floating point number is no exception to this; It's a still 32bit int, but it has a Float tag to show that it shouldnt
//be treated like an regular integer. So how do we convert a float to an 32bit integer (for PAWN) without losing data?
//The answer is the amx_ftoc macro!
//The macro amx_ftoc type casts a float into a cell while preserving its bit pattern (amx_ctof does the inverse).
const float f = 22.624f;
return amx_ftoc(f);
}
//This function demonstrates: How to pass parameters by reference.
//PAWN native: native SetPawnReferenceVars(&value1, &Float:value2);
cell AMX_NATIVE_CALL SetPawnReferenceVars(AMX* amx, cell* params)
{
const int val = 65;
const float val2 = 84.54f;
cell* addr[2] = {NULL, NULL};
//Get the addresses of "value1" and "value2"
amx_GetAddr(amx, params[1], &addr[0]);
amx_GetAddr(amx, params[2], &addr[1]);
//Dereference our pointers and assign our values. Remember to ALWAYS use the macro "amx_ftoc" to convert floats into
//cells (the appropriate float format for PAWN)!
*addr[0] = val;
*addr[1] = amx_ftoc(val2);
return 1;
}
//This function demonstrates: how to get and modify array values.
//PAWN native: native PrintPawnArray(arr[], size = sizeof(arr));
cell AMX_NATIVE_CALL PrintPawnArray(AMX* amx, cell* params)
{
//Make sure there's something to print...
if(params[2] > 0)
{
cell* addr = NULL;
//Get the address of the first value in our PAWN array.
amx_GetAddr(amx, params[1], &addr);
for(int i = 0, l = params[2]; i < l; i++)
{
//This is pretty straight forward: We dereference the addr pointer to get our value to print.
//You should know this already, but arrays and pointers are almost the same thing, so we can use pointer
//arithmetic to add an offset OR just use the subscript operator (in the end *(addr+1) and addr[1] are the same).
logprintf("arr[%d] = %d", i, *(addr + i));
//If you wanted to modify the array you would just change its value by dereferencing addr and assigning a new value.
//You should know this as well, im just adding it in for completeness. Here we change the first value of our array
//to 5 (Note: Since its the first value, no offset it used).
// *(addr) = 5;
}
}
return 1;
}
//This function demonstrates: setting up invoke (fetching the addresses of our natives).
//PAWN native: native Invoke_GetAddresses();
cell AMX_NATIVE_CALL Invoke_GetAddresses(AMX* amx, cell* params)
{
return g_Invoke->getAddresses();
}
//This function demonstrates: how to use invoke to call SA-MP natives.
//PAWN native: native WhereIsPlayer(playerid);
cell AMX_NATIVE_CALL WhereIsPlayer(AMX* amx, cell* params)
{
float
x = NULL,
y = NULL,
z = NULL;
//Get the player's position (and check to see if he is even connected).
if(g_Invoke->callNative(&PAWN::GetPlayerPos, params[1], &x, &y, &z))
{
char name[24];
//Get the rest of the player's information (name, interior, and virtualworld) and print it.
g_Invoke->callNative(&PAWN::GetPlayerName, params[1], name);
int interior = g_Invoke->callNative(&PAWN::GetPlayerInterior, params[1]);
int virtualworld = g_Invoke->callNative(&PAWN::GetPlayerVirtualWorld, params[1]);
logprintf("%s is at X: %.2f, Y: %.2f, Z: %.2f (Virtual world: %d, Interior %d).", name, x, y, z, virtualworld, interior);
return 1;
}
return 0;
}
//This function demonstrates: how to write a native to act as a callback.
//PAWN native: native TEST_Hook_OnPlayerConnnect(playerid);
cell AMX_NATIVE_CALL TEST_Hook_OnPlayerConnnect(AMX* amx, cell* params)
{
//Get the players name
char name[24];
g_Invoke->callNative(&PAWN::GetPlayerName, params[1], name);
//Check if his name is "Mario".
if(string("Mario") == name)
{
//If it is send our funny little message and kick him.
g_Invoke->callNative(&PAWN::SendClientMessage, params[1], 0xFFFFFFFF, "Sorry {FF0000}Mario, {FFFFFF}but your princess is in another server.");
g_Invoke->callNative(&PAWN::Kick, params[1]);
}
return 1;
}
//This function tells the server what capabilities our plugin will have based on what it returns. Generally we only use 3 support flags
//in plugins: SUPPORTS_VERSION, SUPPORTS_AMX_NATIVES, and SUPPORTS_PROCESS_TICK.
PLUGIN_EXPORT unsigned int PLUGIN_CALL Supports()
{
//Note: If you're using the ProccessTick function, remember to export it in the .def file!
return SUPPORTS_VERSION | SUPPORTS_AMX_NATIVES | SUPPORTS_PROCESS_TICK;
}
//The Load function is pretty straight forward. This is called when the plugin is loaded and gets passed an array of addresses that the plugin
//will use to function. The two indexes we typically use are PLUGIN_DATA_AMX_EXPORTS, and PLUGIN_DATA_LOGPRINTF.
PLUGIN_EXPORT bool PLUGIN_CALL Load(void **ppData)
{
//allocate memory for out g_Invoke instance
g_Invoke = new Invoke;
//Assign the addresses of our AMX function table/logprintf function to their corasponding pointers.
pAMXFunctions = ppData[PLUGIN_DATA_AMX_EXPORTS];
logprintf = (logprintf_t) ppData[PLUGIN_DATA_LOGPRINTF];
logprintf("* Test plugin was loaded.");
return true;
}
//Unload is called when the plugin is unloaded (server shutdown).
PLUGIN_EXPORT void PLUGIN_CALL Unload()
{
logprintf("* Test plugin was unloaded.");
}
//Our array of native info for amx_Register (function name and address).
AMX_NATIVE_INFO PluginNatives[] =
{
{"PrintPawnString", PrintPawnString},
{"PrintPawnString2", PrintPawnString2},
{"SetPawnString", SetPawnString},
{"ReturnPawnFloatVal", ReturnPawnFloatVal},
{"SetPawnReferenceVars", SetPawnReferenceVars},
{"PrintPawnArray", PrintPawnArray},
{"EmitPawnCallback", EmitPawnCallback},
{"WhereIsPlayer", WhereIsPlayer},
{"Invoke_GetAddresses", Invoke_GetAddresses},
{"TEST_Hook_OnPlayerConnnect", TEST_Hook_OnPlayerConnnect},
{0, 0}
};
//This function is called when a new AMX instance is loaded into the server. This will be called for every filterscript/gamemode! Because of this it isnt
//a good idea to store a single AMX instance for the entire plugin, instead use a queue/list/vector. In this function we also register our custom
//native functions we wish to provide PAWN with.
PLUGIN_EXPORT int PLUGIN_CALL AmxLoad( AMX *amx )
{
//Any time a script is loaded we want to add it to invoke's AMX list, so we push back the list with the instance.
g_Invoke->amx_list.push_back(amx);
return amx_Register(amx, PluginNatives, -1);
}
//This function is called when every an AMX instance is unloaded. If you store AMX instances, make sure you remove them. Otherwise you'll have instances to
//non-existing gamemodes/filterscripts.
PLUGIN_EXPORT int PLUGIN_CALL AmxUnload( AMX *amx )
{
//Every script that is unloaded needs to get removed from our AMX instance list. So we iterate through our list and find the instance that is being
//unloaded, and we earase it from the list.
for(list<AMX *>::iterator i = g_Invoke->amx_list.begin(); i != g_Invoke->amx_list.end(); ++i)
{
if(*i == amx)
{
g_Invoke->amx_list.erase(i);
break;
}
}
return AMX_ERR_NONE;
}
//ProcessTick is a function that gets called on every iteration of the server's loop. People generally use this function as a method of managing time by
//keeping track of the amount of ticks that have passed. The SA-MP server is said to have a sleep time of 5ms, so if 50 ticks go by you have an idea of
// the elapsed time (5 * 50 = 250ms). Note: Anyone who uses threads in their plugins and require PAWN interaction needs to use this function to ensure
//PAWN isnt busy doing another task!
PLUGIN_EXPORT void PLUGIN_CALL ProcessTick()
{
static int tick = 0;
const int NYAN_COUNT = 100;
tick++;
//Use the modulo operator to see if NYAN_COUNT ticks have passed (100 tick. 5ms sleep time * 100 ticks = 500ms).
if(!(tick % NYAN_COUNT))
{
//If 100 ticks have passed send our funny little message to everyone.
const char nyan[] = "{FF0000}NYAN {FFA500}NYAN {FFFF00}NYAN {00FF00}NYAN {0000FF}NYAN {551A8B}NYAN";
g_Invoke->callNative(&PAWN::SendClientMessageToAll, 0, nyan);
}
}
```
## Special thanks
**RyDeR`** - For contributing the pictures from his plugin tutorial.
**Incognito** - For Invoke, information about ProcessTick, and for all the help over my time learning C++.
**Zeex/0x5A656578** - For GDK (will be included some time), and for volunteering to answer questions about GDK.
**Y_Less** - For being generally awesome and constantly helping me when ever im completely baffled.
**Techboy123** - For a ton of productive chats, help, and for listening to my complaints.
| openmultiplayer/web/docs/tutorials/PluginDevelopmentGuide.md/0 | {
"file_path": "openmultiplayer/web/docs/tutorials/PluginDevelopmentGuide.md",
"repo_id": "openmultiplayer",
"token_count": 33980
} | 475 |
# Open Multiplayer
_Grand Theft Auto:San Andreas_ জন্য একটি আসন্ন মাল্টিপ্লেয়ার মোড যা বিদ্যমান মাল্টিপ্লেয়ার মোড _San Andreas Multiplayer Mod(SA:MP)_ সাথে পুরোপুরি সামঞ্জস্যপূর্ণ।
<br />
এর অর্থ বিদ্যমান **SA:MP ক্লায়েন্ট এবং সমস্ত বিদ্যমান SA:MP স্ক্রিপ্টগুলি open.mp সহ কাজ করবে** এবং এগুলি ছাড়াও হ্যাকস এবং ওয়ার্কআরউন্ডের প্রয়োজনীয়তা ছাড়াই সার্ভার সফ্টওয়্যারটিতে অনেকগুলি বাগও স্থির করা হবে।
আপনি যদি ভাবেন যে কখন প্রকাশ্য প্রকাশের পরিকল্পনা করা হবে বা আপনি কীভাবে প্রকল্পে অবদান রাখতে সহায়তা করতে পারেন, দয়া করে দেখুন [this forum thread](https://forum.open.mp/showthread.php?tid=99) আরও তথ্যের জন্য।
# [সচরাচর জিজ্ঞাস্য](/faq)
| openmultiplayer/web/frontend/content/bn/index.mdx/0 | {
"file_path": "openmultiplayer/web/frontend/content/bn/index.mdx",
"repo_id": "openmultiplayer",
"token_count": 979
} | 476 |
---
title: SA-MP Android
date: "2021-01-30T12:46:46"
author: Potassium
translator: Fairuz
---
SA-MP Android (Mobile Version)
Pandangan tim open.mp tentang SA-MP untuk Android.
Halo semuanya,
Kami hanya ingin menulis postingan singkat tentang pandangan kami tentang SA-MP untuk Android, karena kami telah mendapatkan banyak komentar tentang ini di video YouTube dan di Discord.
Seperti yang kami nyatakan dalam video YouTube kami, kami tidak mendukung versi SA-MP untuk Android saat ini. Aplikasi yang dibuat menggunakan sumber kode(source code) yang dicuri dari tim SA-MP, yang menjadikannya ilegal.
Kami tidak membenarkan pencurian kode orang lain, dan kami tidak membenarkan penggunaan kode yang dicuri. Kami juga tidak ingin ikut campur dengan aktivitas ilegal tersebut.
Kami melihat bahwa GTA:SA Multiplayer untuk mobile memiliki komunitas yang besar, dan kami ingin menerima komunitasnya di open.mp.
Saat ini kami sedang membahas bagaimana kami dapat membuat mod Multiplayer sendiri untuk mobile, sehingga dapat dilakukan secara legal dan adil! :slight_smile:
Artinya sangat mungkin akan ada open.mp untuk mobile di masa mendatang, jadi tolong terus dukung kami selagi kami mencari jalan terbaiknya!
Kami mengundang komunitas mobile untuk bergabung dengan Discord resmi kami dengan lebih dari 7000 anggota, kami telah membuatkan channel untuk kalian yaitu #samp-android dan kami menantikan ide dan pendapat kalian!
Sampai jumpa!
https://discord.gg/samp
| openmultiplayer/web/frontend/content/id/blog/samp-mobile.mdx/0 | {
"file_path": "openmultiplayer/web/frontend/content/id/blog/samp-mobile.mdx",
"repo_id": "openmultiplayer",
"token_count": 543
} | 477 |
# FAQ
<hr />
## Czym jest open.mp?
open.mp (Open Multiplayer, OMP) to alternatywny multiplayer do GTA San Andreas, zainicjowany w odpowiedzi na wzrost problemów z aktualizacjami i zarządzaniem SA:MP. Pierwsze wydanie będzie wyłącznie zastępczym zamiennikiem serwera. Aktualny klient SA:MP będzie mógł połączyć się z tym serwerem. W przyszłości, nowy klient open.mp stanie się dostępny oraz pozwoli na udostępnianie bardziej interesujących aktualizacji.
<hr />
## Czy to jest fork?
Odpowiedź na to pytanie brzmi nie. Kod zostanie napisany wykorzystując przy tym dziesięciolecia wiedzy i doświadczenia. Faktem jest iż były już próby rozwidlenia SA:MP, jednak wystąpiły dwa duże problemy:
- Projekty bazowały na wycieku kodu źródłowego SA:MP. Autorzy nie mieli praw autorskich do tego kodu, dlatego też byli w trudniej sytuacji, zarazem moralnie jak i prawnie. Odmawiamy bezpośredniego użycia tego kodu. Co prawda utrudnia to szybkość rozwoju, ale jest właściwym posunięciem patrząc w przyszłość.
- Próbowali zrobić zbyt wiele. Zarówno zmiana całego silnika, usuwanie starych funkcji i dodawanie nowych lub poprostu wprowadzanie poprawek w niekompatybilny sposób. Uniemożliwia to przenoszenie serwerów z olbrzymią ilością kodu i danych kont graczy, ponieważ należałoby przepisać część swojego kodu, jeśli nie cały - potencjalnie czasochłonne przedsięwzięcie. Z czasem planujemy dodać nowe funkcje, udoskonalić istniejące rzeczy, aczkolwiek chcemy również skupić się na wsparciu dla istniejących serwerów pozwalając im użyć ich kod bez wprowadzania jakichkolwiek zmian.
<hr />
## Dlaczego to robimy?
Liczne próby oficjalnego przyspieszenia rozwoju SA:MP w formie sugestii, pośpieszania i ofert pomocy zespołu beta; Społeczność domagająca się czegoś nowego; Pomimo tego wszystkiego nie zauważyliśmy żadnego postępu. Powszechnie uważano, że jest to po prostu brak zainteresowania ze strony założyciela projektu, co nie jest problemem samo w sobie, ale był nim brak przekazania dowódctwa. Zamiast przekazywać rozwój wszystkim tym, którzy są zainteresowani kontynuowaniem pracy nad projektem, założyciel chciał po prostu wziąć wszystko na siebie, pozornie robiąc rzeczy tak długo, jak to możliwe, przy minimalnym wysiłku. Niektórzy twierdzili, że powodem były bierne dochody, ale nie ma na to dowodów. Pomimo ogromnego zainteresowania ze strony silnej i rodzinnej społeczności wierzył, że projektowi zostało tylko od jednego do dwóch lat, a społeczność, która tak ciężko pracowała, aby uczynić SA:MP tym czym jest teraz nie zasługuje na kontynuację projektu.
<br />
Nie zgadzamy się z tym.
<hr />
## Jakie są wasze opinie na temat Kalcor'a/SA:MP/ogólnie?
Kochamy SA:MP i dlatego tutaj jesteśmy zawdzięczając jednocześnie to Kalcorowi. Zrobił bardzo dużo dla tego projektu przez lata i ten wkład nie powinien być zapomniany, ani ignorowany. Działania prowadzące do rozpoczęcia prac nad open.mp zostały podjęte, ponieważ nie zgodziliśmy się z kilkoma ostatnimi decyzjami i pomimo wielokrotnych prób nakierowania projektu na właściwy tor nie przyniosło to żadnych efektów. W związku z tym byliśmy zmuszeni podjąć niefortunną decyzję, aby spróbować kontynuować SA:MP bez Kalcora. Nie jest to działanie podjęte przeciwko niemu osobiście i nie powinno być postrzegane jako atak na jego osobę. Nie będziemy tolerować żadnych obelg względem innych - niezależnie od tego jakie jest ich podejście do open.mp, powinniśmy mieć możliwość przeprowadzenia rozsądnej debaty bez uciekania się do ataków ad-hominem.
<hr />
## Czy nie jest to czasem podział społeczności?
To nie leży w naszej intencji. Najlepiej byłoby, gdyby w ogóle nie było żadnego podziału, ale rozdzielenie niektórych i uratowanie pewnej części jest lepsze niż oglądanie, jak cała społeczność upada. W rzeczywistości od czasu ogłoszenia tego projektu wiele osób spoza Anglii ponownie zaangażowało się w społeczność angielską. Grupy takich ludzi były powoli spychane na bok, tak więc ich ponowne włączenie łączy podzieloną społeczność. Duża liczba osób została zablokowana na oficjalnym forum SA:MP (w niektórych przypadkach wszystkie ich wpisy zostały usunięte), ale sam Kalcor wskazał, że forum to nie cały SA:MP, a jedynie jego część. Wielu graczy i właścicieli serwerów nigdy nie umieściło wpisów na tym forum ani nie założyło nawet konta; zatem rozmowa z tymi ludźmi pozwoli zjednoczyć jeszcze większą część społeczności.
<hr />
## Skoro jest to "Open" Multiplayer, czy będzie to open-source?
Ostatecznie jest taki plan. Aktualnie staramy się, aby rozwój projektu był otwarty pod względem komunikacji i przejrzystości (co samo w sobie jest poprawą), a także zmierzał w kierunku otwartego kodu źródłowego kiedy tylko będziemy mogli nad tym pracować, a wszystko będzie odpowiednio uporządkowane.
<hr />
## Kiedy projekt zostanie wydany?
To jest odwieczne pytanie, niestety ma odwieczną odpowiedź: w momencie, gdy skończymy. Po prostu nie ma sposobu, aby dowiedzieć się, ile czasu może zająć taki projekt. Działamy już od jakiegoś czasu i widzieliśmy kilka wahań poziomu aktywności, w zależności od tego, jak bardzo ludzie są zajęci. Możemy jednak zapewnić, że jesteśmy już na dobrej drodze i widać postęp, dzięki pewnym podstawowym decyzjom projektowym (później udzielimy więcej informacji na temat architektury).
<hr />
## Jak mogę pomóc?
Obserwuj nasze forum. Mamy temat stworzony na te potrzeby i będziemy go aktualizować wraz z postępem prac. Pomimo tego, że projekt został ujawniony nieco wcześniej niż pierwotnie zamierzano, jesteśmy na dobrej drodze do wypuszczenia pierwszego wydania, nie oznacza to jednak, że pomoc nie jest mile widziana. Z góry dziękujemy za zainteresowanie i wiarę w projekt:
<br />
[Temat - "Jak pomóc"](https://forum.open.mp/showthread.php?tid=99)
<hr />
## Czym jest burgershot.gg?
burgershot.gg to forum o tematyce gier, nic więcej. Duża ilość osób jest zaangażowana w obydwa projekty, dodatkowo niektóre prace nad OMP są tam publikowane, jednak należy pamiętać, że są to dwa niezależnie projekty. Nie jest to forum OMP, ani OMP nie jest własnością burgershot. Po uruchomieniu oficjalnej strony OMP, projekty mogą zostać wyodrębnione (tak jak SA: MP był kiedyś hostowany przez GTAForums, zanim jego własna strona została uruchomiona).
<hr />
## Co z OpenMP?
Projekt "The Open Multi-Processing" to "OpenMP", natomiast nasze przedsięwzięcie to "open.mp". Są to całkowicie różne rzeczy.
| openmultiplayer/web/frontend/content/pl/faq.mdx/0 | {
"file_path": "openmultiplayer/web/frontend/content/pl/faq.mdx",
"repo_id": "openmultiplayer",
"token_count": 3308
} | 478 |
# FAQ
<hr />
## อะไรคือ open.mp?
open.mp (Open Multiplayer, OMP) เป็น Mod การเล่นหลายคนของ San Andreas ซึ่งมันริเริ่มขึ้นเพื่อตอบสนองต่อปัญหาการที่มากขึ้นจากการอัปเดตและการบริหารของ SA:MP การเปิดตัวม็อดนี้ครั้งแรกจะปล่อยเป็น Drop-in replacement สำหรับเซิร์ฟเวอร์เท่านั้น ไคลเอนต์ SA:MP ที่มีอยู่ก็สามารถเชื่อมต่อไปยังเซิร์ฟเวอร์นี้ได้ ในอนาคตจะมีไดลเอนต์ใหม่ของ open.mp ทำให้สามารถปล่อยอัปเดตที่น่าสนใจได้มากขึ้น
<hr />
## มันเป็นการพัฒนาต่อจากเดิม?
ไม่ นี่คือการเขียนใหม่ทั้งหมดโดยใช้ความรู้และประสบการณ์หลายทศวรรษ เคยพยายามจะนำ SA:MP มาพัฒนาต่ออยู่ แต่มันก็มีปัญหาสำคัญตามมาอีกสองประการ:
1. ซอร์สโค้ด SA:MP มันเป็นซอร์สโค้ดที่หลุดออกมา ผู้เขียนม็อดไม่มีสิทธิ์ตามกฎหมายและเป็นเหมือนเท้าหลังเสมอ ทั้งความถูกต้องทางกฎหมายและศีลธรรม เราปฏิเสธที่จะใช้โค้ดนี้โดยสิ้นเชิง สิ่งนี้ขัดขวางความเร็วในการพัฒนาเล็กน้อย แต่เป็นไปในทางที่ถูกต้องในระยะยาว
2. พวกเขาพยายามคิดค้นสิ่งใหม่ ๆ มากเกินไปในครั้งเดียว ไม่ว่าจะเป็นการเปลี่ยนเอ็นจินการเขียนสคริปต์ใหม่ทั้งหมด หรือลบฟีเจอร์ในขณะที่เพิ่มฟีเจอร์ใหม่ไปด้วย หรือแค่ปรับสิ่งต่าง ๆ ที่มันเข้ากันไม่ได้ สิ่งต่าง ๆ ที่กล่าวมาทั้งหมดนั้นมันทำให้เซิร์ฟเวอร์ที่มีอยู่ซึ่งมีฐานโค้ดขนาดใหญ่รวมถึงผู้เล่นด้วย ไม่สามารถย้ายได้ เนื่องจากต้องเขียนโค้ดใหม่บางส่วนหรือไม่ก็ทั้งหมดเลย มันเป็นงานก้อนยักษ์ เราตั้งใจอย่างเต็มที่ที่จะเพิ่มฟีเจอร์ใหม่ ๆ และปรับแต่งสิ่งต่าง ๆ เมื่อเวลาผ่านไป แต่เรายังให้ความสำคัญกับการสนับสนุนเซิร์ฟเวอร์ที่มีอยู่ เปิดโอกาสให้พวกเขาใช้โค้ดของตัวเองได้โดยไม่ต้องเปลี่ยนอะไร
<hr />
## ทำไมคุณทำแบบนี้?
แม้จะมีความพยายามมากมายที่จะผลักดันพัฒนา SA:MP ไปข้างหน้าอย่างเป็นทางการ ในรูปแบบของข้อเสนอแนะ การกระตุ้น และเสนอความช่วยเหลือจาก Beta Team; ควบคู่ไปกับคอมมิวนิตี้ที่ร้องขอสิ่งใหม่ ๆ ตลอดเวลา; ไม่เห็นมีความคืบหน้าอะไรเลย สิ่งนี้เป็นที่รู้กันอย่างกว้างขวางว่าเป็นเพราะผู้พัฒนาม็อดขาดความสนใจ ซึ่งไม่ใช่ปัญหาในตัวมันเอง แทนที่จะมอบการพัฒนาให้กับผู้ที่สนใจในการทำงานกับม็อด ผู้ก่อตั้งเพียงแค่ต้องการลดทอนทุกสิ่งทุกอย่างด้วยตัวของเขาเอง เหมือนแค่ยึดติดผูกมัดสิ่งต่าง ๆ ไว้ให้นานที่สุดเท่าที่จะทำได้โดยใช้ความพยายามเพียงน้อยนิด บางคนอ้างว่านี่เป็นเพราะรายได้ที่พาสซีฟแต่ไม่มีหลักฐาน แม้จะมีความสนใจอย่างมากและเป็นชุมชนที่เข้มแข็งดั่งเป็นครอบครัว เขาเชื่อว่ามีเวลาเหลือเพียง 1-2 ปีสำหรับม็อดตัวนี้ไม่ควรได้ไปต่อทั้ง ๆ ที่ทางคอมมิวนิตี้ก็ทำงานอย่างหนักเพื่อให้ SA:MP เป็นอย่างที่เป็นในปัจจุบัน
<hr />
## คุณมีความคิดเห็นอย่างไรกับ Kalcor/SA:MP/หรืออะไรก็ตาม?
เรารัก SA:MP นั้นคือเหตุผลที่เราอยู่ที่นี่ตั้งแต่แรก - และเราต้องสร้างสิ่งนั้นให้กับ Kalcor เขาทำเงินมหาศาลสำหรับม็อดตัวนี้ในเวลาหลายปีและไม่ควรลืมหรือละเลยการมีส่วนร่วมนั้น การแสดงออกนี้ทำให้ open.mp ได้เกิดขึ้น เนื่องจากเราไม่เห็นด้วยกับการตัดสินใจล่าสุดหลายครั้ง และแม้จะมีความพยายามหลายครั้งในการนำม็อดไปในทิศทางอื่น แต่ก็ไม่เห็นวิธีแก้ปัญหาที่จะเกิดขึ้นเลย ดังนั้นเราจึงถูกบังคับให้ตัดสินใจที่ต้องเดินหน้า SA:MP ต่อด้วยจิตวิญญาณโดยไม่มี Kalcor นี่ไม่ใช่เรื่องส่วนตัวและไม่ควรมองว่าเป็นการทำร้ายเขาเป็นการส่วนตัว เราจะไม่ยอมให้มีการดูหมิ่นบุคคลใด ๆ เป็นการส่วนตัว - ไม่ว่าพวกเขาจะอยู่ข้างใดของประเด็น open.mp นี้; เราควรที่จะสามารถถกเถียงกันได้อย่างสมเหตุสมผลโดยไม่ต้องโจมตีกันที่ตัวบุคคล
<hr />
## นี่มันไม่ใช่แค่การแบ่งแยกชุมชน?
นั่นไม่ใช่ความตั้งใจของเรา ตามหลักการแล้วไม่จำเป็นต้องมีการแยกเลย แต่การแยกบางอย่างออกและช่วยส่วนนั้นจะดีกว่านั่งดูมันเฉาตายไป ที่จริงแล้วม็อดนี้ได้ประกาศไปแล้วว่า คอมมิวนิตี้ที่ไม่ใช่ภาษาอังกฤษจำนวนมากจะได้กลับมามีส่วนร่วมกับคอมมิวนิตี้ของอังกฤษ ชุมชนเหล่านี้ถูกผลักออกไปอย่างช้าๆและเริ่มหายไปที่ละนิด ดังนั้นชุมชนที่แตกแยกกันจะมารวมกันใหม่อีกครั้ง ผู้คนจำนวนมากถูกแบนจากฟอรั่มทางการของ SA:MP (และในบางกรณีประวัติการโพสต์ทั้งหมดของพวกเขาถูกลบทิ้ง) แต่ Kalcor เองก็ชี้ให้เห็นว่าฟอรั่มทางการไม่ใช่ SA:MP เป็นเพียงส่วนหนึ่งของ SA:MP ผู้เล่นและเจ้าของเซิร์ฟเวอร์จำนวนมากไม่เคยโพสต์หรือแม้แต่เข้าร่วมฟอรั่มเหล่านั้นเลย; ดังนั้นการพูดคุยกับคนเหล่านี้อีกครั้งจึงเป็นการรวมส่วนต่างๆของชุมชนมากขึ้น
<hr />
## เนื่องจากมันเป็น "Open" Multiplayer นี่จะเป็นโอเพ่นซอร์สหรือไม่?
มันอยู่ในแผนงานเราตั้งแต่แรกแล้ว คำตอบคือ ใช่ ตอนนี้เราพยายามทำให้การพัฒนาเปิดกว้างในแง่ของการสื่อสารและความโปร่งใส (มันบอกในตัวมันเองอยู่แล้ว) และจะก้าวไปสู่การโอเพนซอร์สเมื่อเราทำได้และเมื่อทุกอย่างถูกต้องและสมบูรณ์
<hr />
## เมื่อไหร่จะปล่อยม็อดให้ใช้?
มันเป็นคำถามที่ถามกันเข้ามาเยอะมาก น่าเสียดายที่เรายังให้คำตอบที่แน่นอนไม่ได้: มันไม่มีทางรู้ได้เลยว่าโปรเจคนี้จะใช้เวลานานขนาดไหน ตอนนี้ก็ดำเนินไปอย่างเงียบ ๆ มาระยะหนึ่งแล้ว และมีการเคลื่อนไหวเล็ก ๆ น้อย ๆ ขึ้นอยู่กับว่าจะมีใครว่างไหม แต่มั่นใจได้เลยว่ามันกำลังมาและดำเนินไปอย่างรวดเร็วด้วยการตัดสินใจที่มีพื้นฐานในการออกแบบ (เราจะพูดเกี่ยวกับสถาปัตยกรรมนี้เพิ่มเติมในภายหลัง)
<hr />
## ฉันช่วยอะไรได้บ้าง?
จับตาดูฟอรั่มไว้ เรามีกระทู้เรื่องที่ให้ช่วยอยู่บ้าง และจะอัปเดตให้เมื่อมีงานใหม่ให้ช่วยทำ ขณะที่โปรเจคนี้ได้รับการเปิดเผยเร็วกว่าที่ตั้งใจไว้เล็กน้อย แต่เราก็อยู่ในระหว่างการเปิดตัวครั้งแรก แต่นั้นไม่ได้หมายความว่าการช่วยเหลือเพิ่มเติมเล็กน้อยจะไม่ได้รับการชื่นชม ขอขอบคุณล่วงหน้าที่ให้ความสนใจและเชื่อมั่นในโปรเจคนี้:
[ขึ้นหัวข้อ "จะช่วยได้อย่างไร"](https://forum.open.mp/showthread.php?tid=99)
<hr />
## อะไรคือ burgershot.gg?
burgershot.gg เป็นฟอรั่มเกี่ยวกับเกม ไม่มีอะไรมากกว่านั้น มีคนจำนวนมากที่ใช้ฟอรั่มไม่เกี่ยวกับเกมก็อัปเดตการพัฒนาจาก OMP แต่มันไม่ใช่ฟอรั่มของ OMP และหรือ OMP ไม่ได้เป็นของ burgershot เมื่อเว็บไซต์ OMP พร้อมใช้งาน ทั้งสองอย่างนี้จะแยกออกจากกัน (อย่าง SA:MP ก็เคยโฮสต์อยู่บน GTAForums ก่อนที่จะมีเว็บไซต์ของตัวเอง)
<hr />
## OpenMP เกี่ยวกับอะไร?
โปรเจค Open Multi-Processing คือ "OpenMP" เราคือ "open.mp" มันต่างกันอย่างสิ้นเชิง
| openmultiplayer/web/frontend/content/th/faq.mdx/0 | {
"file_path": "openmultiplayer/web/frontend/content/th/faq.mdx",
"repo_id": "openmultiplayer",
"token_count": 9692
} | 479 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.