text stringlengths 1 2.83M | id stringlengths 16 152 | metadata dict | __index_level_0__ int64 0 949 |
|---|---|---|---|
[
{
"match_id": "4104198325",
"start_time": "1536292197",
"hero_id": "53",
"score": "104"
},
{
"match_id": "4095511127",
"start_time": "1535854199",
"hero_id": "53",
"score": "86"
},
{
"match_id": "4104755186",
"start_time": "1536320083",
"hero_id": "53",
"score": "82"
},
{
"match_id": "4103752567",
"start_time": "1536258592",
"hero_id": "53",
"score": "76"
},
{
"match_id": "4103461427",
"start_time": "1536246349",
"hero_id": "53",
"score": "75"
},
{
"match_id": "4097323415",
"start_time": "1535927859",
"hero_id": "39",
"score": "74"
},
{
"match_id": "4105729089",
"start_time": "1536356419",
"hero_id": "27",
"score": "73"
},
{
"match_id": "4102168868",
"start_time": "1536176971",
"hero_id": "53",
"score": "71"
},
{
"match_id": "4095468366",
"start_time": "1535851320",
"hero_id": "53",
"score": "68"
},
{
"match_id": "4107753120",
"start_time": "1536444632",
"hero_id": "10",
"score": "67"
},
{
"match_id": "4106794292",
"start_time": "1536407039",
"hero_id": "53",
"score": "67"
},
{
"match_id": "4097507924",
"start_time": "1535943930",
"hero_id": "53",
"score": "67"
},
{
"match_id": "4110159124",
"start_time": "1536555689",
"hero_id": "53",
"score": "66"
},
{
"match_id": "4096101944",
"start_time": "1535879610",
"hero_id": "74",
"score": "66"
},
{
"match_id": "4095053595",
"start_time": "1535826031",
"hero_id": "53",
"score": "66"
},
{
"match_id": "4098277138",
"start_time": "1535982654",
"hero_id": "53",
"score": "65"
},
{
"match_id": "4108871407",
"start_time": "1536493185",
"hero_id": "53",
"score": "64"
},
{
"match_id": "4104999733",
"start_time": "1536327658",
"hero_id": "30",
"score": "64"
},
{
"match_id": "4103217168",
"start_time": "1536237380",
"hero_id": "94",
"score": "64"
},
{
"match_id": "4102535522",
"start_time": "1536204974",
"hero_id": "53",
"score": "64"
},
{
"match_id": "4100376808",
"start_time": "1536090214",
"hero_id": "4",
"score": "64"
},
{
"match_id": "4097658616",
"start_time": "1535954504",
"hero_id": "53",
"score": "64"
},
{
"match_id": "4097553067",
"start_time": "1535947349",
"hero_id": "72",
"score": "64"
},
{
"match_id": "4095113993",
"start_time": "1535828551",
"hero_id": "53",
"score": "63"
},
{
"match_id": "4100577364",
"start_time": "1536109208",
"hero_id": "53",
"score": "62"
},
{
"match_id": "4100200083",
"start_time": "1536081248",
"hero_id": "53",
"score": "62"
},
{
"match_id": "4097353423",
"start_time": "1535930606",
"hero_id": "53",
"score": "62"
},
{
"match_id": "4106827736",
"start_time": "1536408084",
"hero_id": "81",
"score": "61"
},
{
"match_id": "4103854284",
"start_time": "1536264434",
"hero_id": "41",
"score": "61"
},
{
"match_id": "4099976087",
"start_time": "1536072625",
"hero_id": "53",
"score": "61"
},
{
"match_id": "4104852499",
"start_time": "1536323350",
"hero_id": "53",
"score": "60"
},
{
"match_id": "4102557873",
"start_time": "1536206366",
"hero_id": "11",
"score": "60"
},
{
"match_id": "4098770021",
"start_time": "1536002530",
"hero_id": "53",
"score": "60"
},
{
"match_id": "4096553522",
"start_time": "1535894221",
"hero_id": "53",
"score": "60"
},
{
"match_id": "4094594271",
"start_time": "1535811413",
"hero_id": "90",
"score": "60"
},
{
"match_id": "4108097159",
"start_time": "1536466434",
"hero_id": "81",
"score": "59"
},
{
"match_id": "4094494264",
"start_time": "1535808597",
"hero_id": "11",
"score": "59"
},
{
"match_id": "4110233625",
"start_time": "1536560241",
"hero_id": "82",
"score": "58"
},
{
"match_id": "4106039248",
"start_time": "1536378371",
"hero_id": "11",
"score": "58"
},
{
"match_id": "4103911115",
"start_time": "1536268599",
"hero_id": "98",
"score": "58"
},
{
"match_id": "4102291960",
"start_time": "1536186283",
"hero_id": "53",
"score": "58"
},
{
"match_id": "4095059440",
"start_time": "1535826258",
"hero_id": "53",
"score": "58"
},
{
"match_id": "4094705119",
"start_time": "1535814517",
"hero_id": "53",
"score": "58"
},
{
"match_id": "4094121692",
"start_time": "1535796253",
"hero_id": "53",
"score": "58"
},
{
"match_id": "4105789644",
"start_time": "1536361263",
"hero_id": "53",
"score": "57"
},
{
"match_id": "4100952095",
"start_time": "1536131199",
"hero_id": "56",
"score": "57"
},
{
"match_id": "4098882140",
"start_time": "1536009742",
"hero_id": "45",
"score": "57"
},
{
"match_id": "4098506651",
"start_time": "1535990418",
"hero_id": "53",
"score": "57"
},
{
"match_id": "4097506990",
"start_time": "1535943837",
"hero_id": "10",
"score": "57"
},
{
"match_id": "4095442668",
"start_time": "1535849405",
"hero_id": "53",
"score": "57"
},
{
"match_id": "4094755669",
"start_time": "1535815981",
"hero_id": "53",
"score": "57"
},
{
"match_id": "4094262831",
"start_time": "1535801343",
"hero_id": "53",
"score": "57"
},
{
"match_id": "4106740683",
"start_time": "1536405324",
"hero_id": "105",
"score": "56"
},
{
"match_id": "4105694514",
"start_time": "1536354084",
"hero_id": "22",
"score": "56"
},
{
"match_id": "4101578311",
"start_time": "1536154351",
"hero_id": "26",
"score": "56"
},
{
"match_id": "4096248666",
"start_time": "1535884665",
"hero_id": "48",
"score": "56"
},
{
"match_id": "4095231778",
"start_time": "1535834002",
"hero_id": "53",
"score": "56"
},
{
"match_id": "4106812979",
"start_time": "1536407642",
"hero_id": "67",
"score": "55"
},
{
"match_id": "4106138362",
"start_time": "1536383246",
"hero_id": "11",
"score": "55"
},
{
"match_id": "4105391741",
"start_time": "1536339907",
"hero_id": "53",
"score": "55"
},
{
"match_id": "4104866622",
"start_time": "1536323820",
"hero_id": "53",
"score": "55"
},
{
"match_id": "4103910165",
"start_time": "1536268522",
"hero_id": "50",
"score": "55"
},
{
"match_id": "4099996990",
"start_time": "1536073342",
"hero_id": "82",
"score": "55"
},
{
"match_id": "4094208004",
"start_time": "1535799400",
"hero_id": "53",
"score": "55"
},
{
"match_id": "4094053086",
"start_time": "1535793676",
"hero_id": "53",
"score": "55"
},
{
"match_id": "4107076680",
"start_time": "1536417776",
"hero_id": "53",
"score": "54"
},
{
"match_id": "4105302648",
"start_time": "1536336812",
"hero_id": "79",
"score": "54"
},
{
"match_id": "4104628433",
"start_time": "1536314860",
"hero_id": "13",
"score": "54"
},
{
"match_id": "4104551245",
"start_time": "1536311306",
"hero_id": "53",
"score": "54"
},
{
"match_id": "4101263502",
"start_time": "1536144305",
"hero_id": "10",
"score": "54"
},
{
"match_id": "4095195329",
"start_time": "1535832216",
"hero_id": "1",
"score": "54"
},
{
"match_id": "4094977357",
"start_time": "1535823192",
"hero_id": "53",
"score": "54"
},
{
"match_id": "4110640285",
"start_time": "1536579747",
"hero_id": "31",
"score": "53"
},
{
"match_id": "4110293888",
"start_time": "1536563670",
"hero_id": "1",
"score": "53"
},
{
"match_id": "4110048705",
"start_time": "1536548171",
"hero_id": "53",
"score": "53"
},
{
"match_id": "4108834186",
"start_time": "1536492037",
"hero_id": "53",
"score": "53"
},
{
"match_id": "4108274349",
"start_time": "1536473754",
"hero_id": "35",
"score": "53"
},
{
"match_id": "4107456053",
"start_time": "1536430122",
"hero_id": "73",
"score": "53"
},
{
"match_id": "4106621806",
"start_time": "1536401245",
"hero_id": "53",
"score": "53"
},
{
"match_id": "4106492003",
"start_time": "1536396614",
"hero_id": "66",
"score": "53"
},
{
"match_id": "4104524963",
"start_time": "1536310049",
"hero_id": "59",
"score": "53"
},
{
"match_id": "4104300667",
"start_time": "1536298442",
"hero_id": "45",
"score": "53"
},
{
"match_id": "4103967606",
"start_time": "1536273385",
"hero_id": "91",
"score": "53"
},
{
"match_id": "4103580387",
"start_time": "1536250865",
"hero_id": "53",
"score": "53"
},
{
"match_id": "4102414494",
"start_time": "1536197431",
"hero_id": "63",
"score": "53"
},
{
"match_id": "4099393022",
"start_time": "1536049083",
"hero_id": "110",
"score": "53"
},
{
"match_id": "4097990691",
"start_time": "1535972467",
"hero_id": "101",
"score": "53"
},
{
"match_id": "4095461041",
"start_time": "1535850760",
"hero_id": "53",
"score": "53"
},
{
"match_id": "4094940591",
"start_time": "1535821878",
"hero_id": "73",
"score": "53"
},
{
"match_id": "4110220133",
"start_time": "1536559460",
"hero_id": "11",
"score": "52"
},
{
"match_id": "4109634443",
"start_time": "1536518237",
"hero_id": "53",
"score": "52"
},
{
"match_id": "4105781301",
"start_time": "1536360527",
"hero_id": "69",
"score": "52"
},
{
"match_id": "4105155932",
"start_time": "1536332286",
"hero_id": "53",
"score": "52"
},
{
"match_id": "4104066159",
"start_time": "1536282824",
"hero_id": "50",
"score": "52"
},
{
"match_id": "4102091709",
"start_time": "1536172774",
"hero_id": "93",
"score": "52"
},
{
"match_id": "4101296531",
"start_time": "1536145543",
"hero_id": "113",
"score": "52"
},
{
"match_id": "4099506600",
"start_time": "1536055117",
"hero_id": "1",
"score": "52"
},
{
"match_id": "4096708541",
"start_time": "1535898673",
"hero_id": "35",
"score": "52"
},
{
"match_id": "4094519307",
"start_time": "1535809313",
"hero_id": "121",
"score": "52"
},
{
"match_id": "4094154471",
"start_time": "1535797457",
"hero_id": "52",
"score": "52"
}
] | odota/web/testcafe/cachedAjax/records_deaths_.json/0 | {
"file_path": "odota/web/testcafe/cachedAjax/records_deaths_.json",
"repo_id": "odota",
"token_count": 5483
} | 280 |
{
"compilerOptions": {
"outDir": "./dist/",
"baseUrl": ".",
"suppressImplicitAnyIndexErrors": false,
"module": "esnext",
"target": "es6",
"jsx": "react",
"allowJs": true,
"allowSyntheticDefaultImports": true,
"moduleResolution": "node",
"esModuleInterop": true,
"noImplicitAny": true,
"noImplicitThis": true,
"alwaysStrict": true,
"strictBindCallApply": true,
"strictNullChecks": true,
"strictPropertyInitialization": true,
"experimentalDecorators": true,
"lib": [
"dom",
"es2015",
"scripthost",
"es6",
"es2016",
"es2017"
],
"strict": true,
"forceConsistentCasingInFileNames": true,
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"skipLibCheck": false,
"noFallthroughCasesInSwitch": true,
"types": ["vite/client"]
},
"include": [
"src"
],
"exclude": [
"src/node_modules"
]
}
| odota/web/tsconfig.json/0 | {
"file_path": "odota/web/tsconfig.json",
"repo_id": "odota",
"token_count": 435
} | 281 |
package pawndex
import (
"fmt"
"time"
"github.com/Southclaws/sampctl/pawnpackage"
)
// Classification represents how compatible or easy to use a package is. If a package contains a
// package definition file, it's of a higher classification than one that does not contain one.
type Classification string
var (
ClassificationInvalid Classification = "invalid"
ClassificationPawnPackage Classification = "full"
ClassificationBarebones Classification = "basic"
ClassificationBuried Classification = "buried"
)
// Package wraps types.Package and adds extra fields
type Package struct {
pawnpackage.Package
Classification Classification `json:"classification"` // classification represents how conformative the package is
Stars int `json:"stars"` // GitHub stars
Updated time.Time `json:"updated"` // last updated
Topics []string `json:"topics"` // GitHub topics
Tags []string `json:"tags"` // Git tags
}
func (p *Package) String() string {
return fmt.Sprintf("%s/%s", p.User, p.Repo)
}
| openmultiplayer/web/app/resources/pawndex/model.go/0 | {
"file_path": "openmultiplayer/web/app/resources/pawndex/model.go",
"repo_id": "openmultiplayer",
"token_count": 386
} | 282 |
package authentication
import (
"context"
"net/http"
"time"
"github.com/gorilla/securecookie"
"github.com/pkg/errors"
"github.com/openmultiplayer/web/app/resources/user"
"github.com/openmultiplayer/web/internal/config"
"github.com/openmultiplayer/web/internal/db"
"github.com/openmultiplayer/web/internal/web"
)
// State stores state for performing authentication
type State struct {
db *db.PrismaClient
sc *securecookie.SecureCookie
domain string
users user.Repository
authAPIKey string
}
// OAuthProvider describes a type that can provide an OAuth2 authentication
// method for users.
//
// Link simply returns a URL to start the OAuth2 process.
//
// Login is called by the callback and handles the code/token exchange and
// returns a User object to the caller to be encoded into a cookie.
type OAuthProvider interface {
Link() string
Login(ctx context.Context, state, code string) (*user.User, error)
}
// New initialises a new authentication service
func New(db *db.PrismaClient, cfg config.Config, users user.Repository) *State {
a := &State{
db: db,
sc: securecookie.New(cfg.HashKey, cfg.BlockKey),
domain: cfg.CookieDomain,
users: users,
authAPIKey: cfg.AuthenticatedAPIKey,
}
return a
}
// EncodeAuthCookie writes the secure user auth cookie to the response writer.
func (a *State) EncodeAuthCookie(w http.ResponseWriter, user user.User) {
encoded, err := a.sc.Encode(secureCookieName, Cookie{
UserID: user.ID,
Admin: user.Admin,
Created: time.Now(),
})
if err != nil {
web.StatusUnauthorized(w, err)
return
}
http.SetCookie(w, &http.Cookie{
Name: secureCookieName,
Value: encoded,
Path: "/",
Domain: a.domain,
Secure: true,
HttpOnly: true,
})
}
// GetAuthenticationInfo extracts auth info from a request context and, if not
// present, will write a 500 error to the response and return not-ok. In this
// failure case, the request should be immediately terminated.
func GetAuthenticationInfo(
w http.ResponseWriter,
r *http.Request,
) (*Info, bool) {
if auth, ok := GetAuthenticationInfoFromContext(r.Context()); ok {
return auth, true
}
web.StatusInternalServerError(w, web.WithSuggestion(
errors.New("failed to extract auth context from request"),
"Could not read session data from cookies.",
"Try clearing your cookies and logging in to your account again."))
return nil, false
}
// GetAuthenticationInfoFromContext pulls out auth data from a request context
func GetAuthenticationInfoFromContext(ctx context.Context) (*Info, bool) {
if auth, ok := ctx.Value(contextKey).(Info); ok {
return &auth, true
}
return nil, false
}
func IsRequestAdmin(r *http.Request) bool {
info, _ := GetAuthenticationInfoFromContext(r.Context())
if info == nil {
return false
}
return info.Cookie.Admin
}
func (s *State) GetOrCreateFromContext(ctx context.Context, email, authMethod, username string) (*user.User, error) {
if existing, ok := GetAuthenticationInfoFromContext(ctx); ok && existing.Authenticated {
u, err := s.users.GetUser(ctx, existing.Cookie.UserID, false)
if err != nil {
return nil, errors.Wrap(err, "failed to find user account")
}
return u, nil
} else {
u, err := s.users.CreateUser(ctx, email, user.AuthMethod(authMethod), username)
if err != nil {
return nil, errors.Wrap(err, "failed to create user account")
}
return u, nil
}
}
| openmultiplayer/web/app/services/authentication/auth.go/0 | {
"file_path": "openmultiplayer/web/app/services/authentication/auth.go",
"repo_id": "openmultiplayer",
"token_count": 1174
} | 283 |
package auth
import (
"github.com/go-chi/chi"
"go.uber.org/fx"
"github.com/openmultiplayer/web/app/services/authentication"
"github.com/openmultiplayer/web/app/transports/api/auth/discord"
"github.com/openmultiplayer/web/app/transports/api/auth/github"
)
type service struct{}
func Build() fx.Option {
return fx.Options(
fx.Provide(func() *service { return &service{} }),
fx.Invoke(func(
r chi.Router,
s *service,
auth *authentication.State,
gh *authentication.GitHubProvider,
dc *authentication.DiscordProvider,
) {
rtr := chi.NewRouter()
r.Mount("/auth", rtr)
rtr.Mount("/github", github.New(auth, gh))
rtr.Mount("/discord", discord.New(auth, dc))
}),
)
}
| openmultiplayer/web/app/transports/api/auth/api.go/0 | {
"file_path": "openmultiplayer/web/app/transports/api/auth/api.go",
"repo_id": "openmultiplayer",
"token_count": 296
} | 284 |
package servers
import (
"net/http"
"strconv"
"time"
"github.com/pkg/errors"
"github.com/openmultiplayer/web/internal/web"
)
func (s *service) fulllist(w http.ResponseWriter, r *http.Request) {
queries := r.URL.Query()
since, err := strconv.Atoi(queries.Get("activeSince"))
if err != nil {
since = 3
}
// This used to be for getting servers from database directly
// list, err := s.storer.GetAll(r.Context(), time.Duration(-since)*time.Hour)
// Let's use cached servers, instead of getting them directly from database
// This way we can save a lot DB processing
list, err := s.storer.GetAllCached(r.Context(), time.Duration(-since)*time.Hour)
if err != nil {
web.StatusInternalServerError(w, errors.Wrap(err, "failed to get list of servers"))
return
}
w.Header().Add("Content-Type", "application/json")
web.Write(w, list)
}
| openmultiplayer/web/app/transports/api/servers/h_fulllist.go/0 | {
"file_path": "openmultiplayer/web/app/transports/api/servers/h_fulllist.go",
"repo_id": "openmultiplayer",
"token_count": 297
} | 285 |
version: "3"
services:
postgres:
image: postgres:13
environment:
POSTGRES_USER: ${POSTGRES_USER:-default}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-default}
volumes:
- ./data/openmp/postgres:/var/lib/postgresql/data
| openmultiplayer/web/docker-compose.yml/0 | {
"file_path": "openmultiplayer/web/docker-compose.yml",
"repo_id": "openmultiplayer",
"token_count": 108
} | 286 |
---
title: OnFilterScriptExit
description: This callback is called when a filterscript is unloaded.
tags: []
---
## Description
This callback is called when a filterscript is unloaded. It is only called inside the filterscript which is unloaded.
## Examples
```c
public OnFilterScriptExit()
{
print("\n--------------------------------------");
print(" My filterscript unloaded");
print("--------------------------------------\n");
return 1;
}
```
## Related Callbacks
The following callbacks might be useful, as they're related to this callback in one way or another.
- [OnFilterScriptInit](OnFilterScriptInit): This callback is called when a filterscript is loaded.
- [OnGameModeInit](OnGameModeInit): This callback is called when a gamemode starts.
- [OnGameModeExit](OnGameModeExit): This callback is called when a gamemode ends.
| openmultiplayer/web/docs/scripting/callbacks/OnFilterScriptExit.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/callbacks/OnFilterScriptExit.md",
"repo_id": "openmultiplayer",
"token_count": 224
} | 287 |
---
title: OnPlayerClickMap
description: This callback is called when a player places a target/waypoint on the pause menu map (by right-clicking).
tags: ["player"]
---
## Description
This callback is called when a player places a target/waypoint on the pause menu map (by right-clicking).
| Name | Description |
| -------- | ----------------------------------------------------------------------------- |
| playerid | The ID of the player that placed a target/waypoint |
| Float:fX | The X float coordinate where the player clicked |
| Float:fY | The Y float coordinate where the player clicked |
| Float:fZ | The Z float coordinate where the player clicked (inaccurate - see note below) |
## Returns
1 - Will prevent other filterscripts from receiving this callback.
0 - Indicates that this callback will be passed to the next filterscript.
It is always called first in gamemode.
## Examples
```c
public OnPlayerClickMap(playerid, Float:fX, Float:fY, Float:fZ)
{
SetPlayerPosFindZ(playerid, fX, fY, fZ);
return 1;
}
```
## Notes
:::tip
As the callback name says, its only called when the player click to mark the target and not when pressed the key. The Z value returned will be 0 (invalid) if the clicked area on the map is far away from the player; use the [MapAndreas](https://github.com/philip1337/samp-plugin-mapandreas) or [ColAndreas](https://github.com/Pottus/ColAndreas) plugin to get a more accurate Z coordinate.
:::
## Related Functions
The following functions might be useful, as they're related to this callback in one way or another.
- [GetPlayerPos](../functions/GetPlayerPos): Get a player's position.
- [SetPlayerPos](../functions/SetPlayerPos): Set a player's position.
- [SetPlayerPosFindZ](../functions/SetPlayerPosFindZ): Set a player's position and find the ground.
| openmultiplayer/web/docs/scripting/callbacks/OnPlayerClickMap.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/callbacks/OnPlayerClickMap.md",
"repo_id": "openmultiplayer",
"token_count": 661
} | 288 |
---
title: OnPlayerExitVehicle
description: This callback is called when a player starts to exit a vehicle.
tags: ["player", "vehicle"]
---
## Description
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. |
## Returns
It is always called first in filterscripts.
## Examples
```c
public OnPlayerExitVehicle(playerid, vehicleid)
{
new string[64];
format(string, sizeof(string), "INFO: You are exiting vehicle %i", vehicleid);
SendClientMessage(playerid, 0xFFFFFFFF, string);
return 1;
}
```
## Notes
:::warning
- Not called if the player falls off a bike or is removed from a vehicle by other means such as using [SetPlayerPos](../functions/SetPlayerPos).
- You must use [OnPlayerStateChange](OnPlayerStateChange) and check if their old state is `PLAYER_STATE_DRIVER` or `PLAYER_STATE_PASSENGER` and their new state is `PLAYER_STATE_ONFOOT`.
:::
## Related Callbacks
The following callbacks might be useful, as they're related to this callback in one way or another.
- [OnPlayerEnterVehicle](OnPlayerEnterVehicle): This callback is called when a player starts to enter a vehicle.
- [OnPlayerStateChange](OnPlayerStateChange): This callback is called when a player changes state.
## Related Functions
The following functions might be useful, as they're related to this callback in one way or another.
- [RemovePlayerFromVehicle](../functions/RemovePlayerFromVehicle): Throw a player out of their vehicle.
- [GetPlayerVehicleSeat](../functions/GetPlayerVehicleSeat): Check what seat a player is in.
| openmultiplayer/web/docs/scripting/callbacks/OnPlayerExitVehicle.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/callbacks/OnPlayerExitVehicle.md",
"repo_id": "openmultiplayer",
"token_count": 531
} | 289 |
---
title: OnPlayerRequestClass
description: This callback is called when a player changes class at class selection (and when class selection first appears).
tags: ["player", "class"]
---
## Description
This callback is called when a player changes class at class selection (and when class selection first appears).
| Name | Description |
| -------- | ----------------------------------------------------------------------------------------------------- |
| playerid | The ID of the player that changed class. |
| classid | The ID of the current class being viewed (returned by [AddPlayerClass](../functions/AddPlayerClass)). |
## Returns
It is always called first in filterscripts.
## Examples
```c
public OnPlayerRequestClass(playerid,classid)
{
if (classid == 3 && !IsPlayerAdmin(playerid))
{
SendClientMessage(playerid, COLOR_RED, "This skin is only for admins!");
return 0;
}
return 1;
}
```
## Notes
:::tip
This callback is also called when a player presses F4.
:::
## Related Callbacks
The following callbacks might be useful, as they're related to this callback in one way or another.
- [OnPlayerRequestSpawn](OnPlayerRequestSpawn): This callback is called when a player attempts to spawn via class selection.
## Related Functions
The following functions might be useful, as they're related to this callback in one way or another.
- [AddPlayerClass](../functions/AddPlayerClass): Add a player class.
| openmultiplayer/web/docs/scripting/callbacks/OnPlayerRequestClass.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/callbacks/OnPlayerRequestClass.md",
"repo_id": "openmultiplayer",
"token_count": 542
} | 290 |
---
title: OnScriptCash
description: This callback is called when something in-game like casinos give the player money.
tags: ["player"]
---
:::warning
This callback is currently NOT working.
:::
## Description
This callback is called when something in-game like casinos give the player money.
| Name | Description |
|----------|-------------------------------------------------|
| playerid | The ID of the player who got cash from the game |
| amount | The amount of cash given or taken |
| source | Where the money came from |
## Returns
Unknown as this function does not currently work.
## Examples
```c
// Imaginary:
public OnScriptCash(playerid, amount, source)
{
if (source == SCRIPT_CASH_CASINO)
{
SendClientMessage(playerid, -1, "You have won $%d from the casino!", amount);
}
else if (source == SCRIPT_CASH_VENDING_MACHINE)
{
SendClientMessage(playerid, -1, "You buyed a coke from vending machine for $%d", amount);
}
return 1;
}
```
## Related Functions
The following functions might be useful, as they're related to this callback in one way or another.
- [GetPlayerMoney](../functions/GetPlayerMoney): Retrieves the amount of money a player has.
| openmultiplayer/web/docs/scripting/callbacks/OnScriptCash.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/callbacks/OnScriptCash.md",
"repo_id": "openmultiplayer",
"token_count": 446
} | 291 |
---
title: AddServerRule
description: Add a server rule.
tags: ["rule"]
---
<VersionWarn version='omp v1.1.0.2612' />
## Description
Add a server rule.
| Name | Description |
| ----------------- | ----------------------------------------------------------- |
| const rule[] | The server rule name to add. |
| const format[] | The server rule value. |
| OPEN_MP_TAGS:... | Indefinite number of arguments of any tag. |
## Returns
Returns true if the function executed successfully, otherwise false.
## Examples
```c
public OnGameModeInit()
{
AddServerRule("discord", "discord.gg/samp");
return 1;
}
```
## Related Functions
- [RemoveServerRule](RemoveServerRule): Remove the server rule.
- [IsValidServerRule](IsValidServerRule): Checks if the given server rule is valid.
| openmultiplayer/web/docs/scripting/functions/AddServerRule.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/AddServerRule.md",
"repo_id": "openmultiplayer",
"token_count": 385
} | 292 |
---
title: ArePlayerWeaponsAllowed
description: Can the player use weapons?
tags: ["player"]
---
<VersionWarn version='omp v1.1.0.2612' />
## Description
Can the player use weapons?
| Name | Description |
| -------- | ------------------------------ |
| playerid | The ID of the player to check. |
## Returns
**true** - Player is allowed.
**false** - Player is not allowed.
## Examples
```c
public OnPlayerSpawn(playerid)
{
if (ArePlayerWeaponsAllowed(playerid))
{
// do something
}
return 1;
}
```
## Related Functions
- [AllowPlayerWeapons](AllowPlayerWeapons): Enable/Disable weapons for a player.
| openmultiplayer/web/docs/scripting/functions/ArePlayerWeaponsAllowed.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/ArePlayerWeaponsAllowed.md",
"repo_id": "openmultiplayer",
"token_count": 228
} | 293 |
---
title: BeginPlayerObjectEditing
description: Allows players to edit a player-object (position and rotation) with a GUI and their mouse.
tags: ["player", "object", "playerobject"]
---
<VersionWarn version='omp v1.1.0.2612' />
## Description
Allows players to edit a player-object (position and rotation) with a GUI and their mouse.
| Name | Description |
| -------- | ------------------------------------------------ |
| playerid | The ID of the player that should edit the object |
| objectid | The object to be edited by the player |
## Returns
`true` - The function executed successfully.
`false` - The function failed to execute. Player or object not valid.
## Examples
```c
new gPlayerObject[MAX_PLAYERS];
public OnPlayerSpawn(playerid)
{
gPlayerObject[playerid] = CreatePlayerObject(playerid, 1337, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if (!strcmp(cmdtext, "/edit", true))
{
BeginPlayerObjectEditing(playerid, gPlayerObject[playerid]);
SendClientMessage(playerid, 0xFFFFFFFF, "SERVER: You now edit your object!");
return 1;
}
return 0;
}
```
## Notes
:::tip
You can move the camera while editing by pressing and holding the spacebar (or W in vehicle) and moving your mouse.
:::
## Related Functions
- [CreateObject](CreateObject): Create an object.
- [DestroyObject](DestroyObject): Destroy an object.
- [MoveObject](MoveObject): Move an object.
- [EditAttachedObject](EditAttachedObject): Edit an attached object.
- [BeginObjectSelecting](BeginObjectSelecting): Select an object.
- [EndObjectEditing](EndObjectEditing): Cancel the edition of an object.
| openmultiplayer/web/docs/scripting/functions/BeginPlayerObjectEditing.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/BeginPlayerObjectEditing.md",
"repo_id": "openmultiplayer",
"token_count": 565
} | 294 |
---
title: Create3DTextLabel
description: Creates a 3D Text Label at a specific location in the world.
tags: ["3dtextlabel"]
---
## Description
Creates a 3D Text Label at a specific location in the world
| Name | Description |
| ------------------ | ------------------------------------------------------------------------------ |
| const text[] | The initial text string. |
| colour | The text Color, as an integer or hex in RGBA color format |
| Float:x | X-Coordinate |
| Float:y | Y-Coordinate |
| Float:z | Z-Coordinate |
| Float:drawDistance | The distance from where you are able to see the 3D Text Label |
| virtualWorld | The virtual world in which you are able to see the 3D Text |
| bool:testLOS | Test the line-of-sight so this text can't be seen through objects (true/false) |
| OPEN_MP_TAGS:... | Indefinite number of arguments of any tag. |
## Returns
The ID of the newly created 3D Text Label, or `INVALID_3DTEXT_ID` if the 3D Text Label limit (`MAX_3DTEXT_GLOBAL`) was reached.
## Examples
```c
public OnGameModeInit()
{
Create3DTextLabel("I'm at the coordinates:\n30.0, 40.0, 50.0", 0x008080FF, 30.0, 40.0, 50.0, 40.0, 0, false);
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if (!strcmp(cmdtext, "/mark", true))
{
new name[MAX_PLAYER_NAME];
new Float:x, Float:y, Float:z;
new worldid;
GetPlayerName(playerid, name, sizeof(name));
GetPlayerPos(playerid, x, y, z);
worldid = GetPlayerVirtualWorld(playerid);
Create3DTextLabel("%s marked this place", 0xFF0000FF, x, y, z, 15.0, worldid, false, name);
return 1;
}
return 0;
}
```
## Notes
:::tip
drawDistance seems to be a lot smaller when spectating.
:::
:::tip
Use colour embedding for multiple colours in the text.
:::
:::warning
- If text[] is empty, the server/clients next to the text might crash! (Fixed in open.mp)
- If the virtualworld is set as -1 the text will not appear.
:::
## Related Functions
- [Delete3DTextLabel](Delete3DTextLabel): Delete a 3D text label.
- [IsValid3DTextLabel](IsValid3DTextLabel): Checks if a 3D text label is valid.
- [Is3DTextLabelStreamedIn](Is3DTextLabelStreamedIn): Checks if a 3D text label is streamed in for a player.
- [Attach3DTextLabelToPlayer](Attach3DTextLabelToPlayer): Attach a 3D text label to a player.
- [Attach3DTextLabelToVehicle](Attach3DTextLabelToVehicle): Attach a 3D text label to a vehicle.
- [Update3DTextLabelText](Update3DTextLabelText): Change the text of a 3D text label.
- [Get3DTextLabelText](Get3DTextLabelText): Gets the 3D text label text.
- [Get3DTextLabelColour](Get3DTextLabelColour): Gets the 3D text label colour.
- [Get3DTextLabelPos](Get3DTextLabelPos): Gets the 3D text label position.
- [Get3DTextLabelDrawDistance](Get3DTextLabelDrawDistance): Gets the 3D text label draw distance.
- [Set3DTextLabelDrawDistance](Set3DTextLabelDrawDistance): Sets the 3D text label draw distance.
- [Get3DTextLabelVirtualWorld](Get3DTextLabelVirtualWorld): Gets the 3D text label virtual world id.
- [Set3DTextLabelVirtualWorld](Set3DTextLabelVirtualWorld): Sets the 3D text label virtual world id.
- [Get3DTextLabelLOS](Get3DTextLabelLOS): Gets the 3D text label line-of-sight.
- [Set3DTextLabelLOS](Set3DTextLabelLOS): Sets the 3D text label line-of-sight.
- [CreatePlayer3DTextLabel](CreatePlayer3DTextLabel): Create A 3D text label for one player.
- [DeletePlayer3DTextLabel](DeletePlayer3DTextLabel): Delete a player's 3D text label.
- [UpdatePlayer3DTextLabelText](UpdatePlayer3DTextLabelText): Change the text of a player's 3D text label.
| openmultiplayer/web/docs/scripting/functions/Create3DTextLabel.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/Create3DTextLabel.md",
"repo_id": "openmultiplayer",
"token_count": 1693
} | 295 |
---
title: DeleteSVar
description: Deletes a previously set server variable.
tags: ["server variable", "svar"]
---
## Description
Deletes a previously set server variable.
| Name | Description |
| ------------ | ------------------------------------------ |
| const svar[] | The name of the server variable to delete. |
## Returns
**true** - The function executed successfully.
**false** - The function failed to execute. There is no variable set with the given name.
## Examples
```c
SetSVarInt("SomeVarName", 69);
// Later on, when the variable is no longer needed...
DeleteSVar("SomeVarName");
```
## Notes
:::tip
Once a variable is deleted, attempts to retrieve the value will return 0 for integers and 0.0 for floats and NULL for strings.
:::
## Related Functions
- [SetSVarInt](SetSVarInt): Set an integer for a server variable.
- [GetSVarInt](GetSVarInt): Get a player server as an integer.
- [SetSVarString](SetSVarString): Set a string for a server variable.
- [GetSVarString](GetSVarString): Get the previously set string from a server variable.
- [SetSVarFloat](SetSVarFloat): Set a float for a server variable.
- [GetSVarFloat](GetSVarFloat): Get the previously set float from a server variable.
| openmultiplayer/web/docs/scripting/functions/DeleteSVar.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/DeleteSVar.md",
"repo_id": "openmultiplayer",
"token_count": 380
} | 296 |
---
title: EditAttachedObject
description: Enter edition mode for an attached object.
tags: ["player", "object", "attachment"]
---
## Description
Enter edition mode for an attached object.
| Name | Description |
| -------- | ------------------------------------------------ |
| playerid | The ID of the player to enter in to edition mode |
| index | The index (slot) of the attached object to edit |
## Returns
**1** on success and **0** on failure.
## Examples
```c
public OnPlayerSpawn(playerid)
{
SetPlayerAttachedObject(playerid, 0, 1337, 2);
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if (!strcmp(cmdtext, "/edit", true))
{
EditAttachedObject(playerid, 0);
SendClientMessage(playerid, 0xFFFFFFFF, "SERVER: You now edit your attached object on index slot 0!");
return 1;
}
return 0;
}
```
## Notes
:::tip
You can move the camera while editing by pressing and holding the spacebar (or W in vehicle) and moving your mouse.
:::
:::warning
Players will be able to scale objects up to a very large or negative value size. Limits should be put in place using OnPlayerEditAttachedObject to abort the edit or clip the scale values.
:::
## Related Functions
- [SetPlayerAttachedObject](SetPlayerAttachedObject): Attach an object to a player
- [RemovePlayerAttachedObject](RemovePlayerAttachedObject): Remove an attached object from a player
- [IsPlayerAttachedObjectSlotUsed](IsPlayerAttachedObjectSlotUsed): Check whether an object is attached to a player in a specified index
- [EditObject](EditObject): Edit an object.
- [EditPlayerObject](EditPlayerObject): Edit an object.
- [SelectObject](SelectObject): Select an object.
- [CancelEdit](CancelEdit): Cancel the edition of an object.
## Related Callbacks
- [OnPlayerEditAttachedObject](../callbacks/OnPlayerEditAttachedObject): Called when a player finishes editing an attached object.
| openmultiplayer/web/docs/scripting/functions/EditAttachedObject.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/EditAttachedObject.md",
"repo_id": "openmultiplayer",
"token_count": 592
} | 297 |
---
title: GameTextForAll
description: Shows 'game text' (on-screen text) for a certain length of time for all players.
tags: ["gametext"]
---
## Description
Shows 'game text' (on-screen text) for a certain length of time for all players.
| Name | Description |
|------------------|-------------------------------------------------------------------|
| const format[] | The text to be displayed. |
| time | The duration of the text being shown in milliseconds. |
| style | The [style](../resources/gametextstyles) of text to be displayed. |
| OPEN_MP_TAGS:... | Indefinite number of arguments of any tag. |
## Returns
This function always returns 1.
## Examples
```c
public OnPlayerDeath(playerid, killerid, WEAPON:reason)
{
// This example shows a large, white text saying "[playerName] has
// passed away" on everyone's screen, after a player has died or
// has been killed. It shows in text-type 3, for 5 seconds (5000 ms)
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
// Format the passed-away message properly, and show it to everyone:
new string[64];
format(string, sizeof(string), "~w~%s has passed away", name);
GameTextForAll(string, 5000, 3);
// PRO TIP: You don't need `format` in open.mp
GameTextForAll("~w~%s has passed away", 5000, 3, name);
return 1;
}
```
## Notes
:::warning
Do note that the players may crash because of odd number of tilde (~) symbols used in the game text. Using color codes (e.g. ~r~) beyond the 255th character may crash the client.
:::
## Related Functions
- [HideGameTextForAll](HideGameTextForAll): Stop showing a gametext style for all players.
- [GameTextForPlayer](GameTextForPlayer): Display gametext to a player.
- [HideGameTextForPlayer](HideGameTextForPlayer): Stop showing a gametext style to a player.
- [TextDrawShowForAll](TextDrawShowForAll): Show a textdraw for all players.
## Related Resources
- [GameText Styles](../resources/gametextstyles)
| openmultiplayer/web/docs/scripting/functions/GameTextForAll.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/GameTextForAll.md",
"repo_id": "openmultiplayer",
"token_count": 765
} | 298 |
---
title: Get3DTextLabelColor
description: Gets the 3D text label color.
tags: ["3dtextlabel"]
---
:::warning
This function is deprecated. Please see [Get3DTextLabelColour](Get3DTextLabelColour).
:::
## Description
Gets the 3D text label color.
| Name | Description |
| ------------- | ------------------------------------------------ |
| Text3D:textid | The ID of the 3D text label to get the color of. |
## Returns
Returns the 3D text label color.
## Examples
```c
new Text3D:gMyLabel;
gMyLabel = Create3DTextLabel("Hello World!", 0x008080FF, 30.0, 40.0, 50.0, 40.0, 0, false);
new color = Get3DTextLabelColor(gMyLabel);
// color = 0x008080FF
```
## Related Functions
- [GetPlayer3DTextLabelColor](GetPlayer3DTextLabelColor): Gets the player 3D text label color.
| openmultiplayer/web/docs/scripting/functions/Get3DTextLabelColor.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/Get3DTextLabelColor.md",
"repo_id": "openmultiplayer",
"token_count": 307
} | 299 |
---
title: GetAnimationName
description: Get the animation library/name for the index.
tags: []
---
## Description
Get the animation library/name for the index.
| Name | Description |
| -------------------------------- | --------------------------------------------------------- |
| index | The animation index, returned by GetPlayerAnimationIndex. |
| animationLibrary[] | String variable that stores the animation library. |
| len1 = sizeof (animationLibrary) | Size of the string that stores the animation library. |
| animationName[] | String variable that stores the animation name. |
| len2 = sizeof (animationName) | Size of the string that stores the animation name. |
## Returns
1 on success, 0 on failure.
## Examples
```c
public OnPlayerUpdate(playerid)
{
if (GetPlayerAnimationIndex(playerid))
{
new
animLib[32],
animName[32],
msgText[128];
GetAnimationName(GetPlayerAnimationIndex(playerid), animLib, sizeof animLib, animName, sizeof animName);
format(msgText, sizeof msgText, "Running anim: %s %s", animLib, animName);
SendClientMessage(playerid, 0xFFFFFFFF, msgText);
}
return 1;
}
```
## Related Functions
- [GetPlayerAnimationIndex](GetPlayerAnimationIndex): Returns the index of any running applied animations
| openmultiplayer/web/docs/scripting/functions/GetAnimationName.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/GetAnimationName.md",
"repo_id": "openmultiplayer",
"token_count": 559
} | 300 |
---
title: GetMenuPos
description: Get the x/y screen position of the menu.
tags: ["menu"]
---
<VersionWarn version='omp v1.1.0.2612' />
## Description
Get the x/y screen position of the menu.
| Name | Description |
| ----------- | -------------------------------------------------------------------------- |
| Menu:menuid | The ID of the menu. |
| &Float:x | A float variable in which to store the X position in, passed by reference. |
| &Float:y | A float variable in which to store the Y position in, passed by reference. |
## Returns
This function always returns true.
## Examples
```c
new Float:x, Float:y;
GetMenuPos(menuid, x, y);
```
## Related Functions
- [GetMenuColumnWidth](GetMenuColumnWidth): Get the width of columns.
| openmultiplayer/web/docs/scripting/functions/GetMenuPos.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/GetMenuPos.md",
"repo_id": "openmultiplayer",
"token_count": 346
} | 301 |
---
title: GetObjectSyncRotation
description: Get the sync rotation of an object.
tags: ["object"]
---
<VersionWarn version='omp v1.1.0.2612' />
## Description
Get the sync rotation of an object.
| Name | Description |
|----------|-----------------------|
| objectid | The ID of the object. |
## Returns
Returns the sync rotation of the object as boolean (`true`/`false`).
## Examples
```c
new objectid = CreateObject(...);
new parentid = CreateObject(...);
AttachObjectToObject(objectid, parentid, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, false);
new bool:syncRotation = GetObjectSyncRotation(objectid);
// syncRotation = false
```
## Related Functions
- [AttachObjectToObject](AttachObjectToObject): Attach object to other object.
- [GetPlayerObjectSyncRotation](GetPlayerObjectSyncRotation): Get the sync rotation of a player-object.
| openmultiplayer/web/docs/scripting/functions/GetObjectSyncRotation.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/GetObjectSyncRotation.md",
"repo_id": "openmultiplayer",
"token_count": 275
} | 302 |
---
title: GetPlayer3DTextLabelDrawDist
description: Gets the player's 3D text label draw distance.
tags: ["player", "3dtextlabel"]
---
:::warning
This function is deprecated. Please see [GetPlayer3DTextLabelDrawDistance](GetPlayer3DTextLabelDrawDistance).
:::
## Description
Gets the player's 3D text label draw distance.
| Name | Description |
| ------------------- | ----------------------------------------------------------------- |
| playerid | The ID of the player. |
| PlayerText3D:textid | The ID of the player's 3D text label to get the draw distance of. |
## Returns
Returns the draw distance of the player's 3D text label as float.
## Examples
```c
new PlayerText3D:playerTextId;
new Float:X, Float:Y, Float:Z;
new Float:drawDistance;
GetPlayerPos(playerid, X, Y, Z);
playerTextId = CreatePlayer3DTextLabel(playerid, "Hello\nI'm at your position", 0x008080FF, X, Y, Z, 40.0);
drawDistance = GetPlayer3DTextLabelDrawDist(playerid, playerTextId);
// drawDistance = 40.0
```
## Notes
:::tip
This function is just short name of [GetPlayer3DTextLabelDrawDistance](GetPlayer3DTextLabelDrawDistance).
:::
## Related Functions
- [SetPlayer3DTextLabelDrawDistance](SetPlayer3DTextLabelDrawDistance): Sets the player's 3D text label draw distance.
- [Get3DTextLabelDrawDistance](Get3DTextLabelDrawDistance): Gets the 3D text label draw distance.
| openmultiplayer/web/docs/scripting/functions/GetPlayer3DTextLabelDrawDist.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/GetPlayer3DTextLabelDrawDist.md",
"repo_id": "openmultiplayer",
"token_count": 533
} | 303 |
---
title: GetPlayerCameraPos
description: Get the position of the player's camera.
tags: ["player", "camera"]
---
## Description
Get the position of the player's camera.
| Name | Description |
| -------- | ------------------------------------------------------------------- |
| playerid | The ID of the player to get the camera position of. |
| &Float:x | A float variable to store the X coordinate in, passed by reference. |
| &Float:y | A float variable to store the Y coordinate in, passed by reference. |
| &Float:z | A float variable to store the Z coordinate in, passed by reference. |
## Returns
The player's position is stored in the specified variables.
## Examples
```c
public OnPlayerDisconnect(playerid)
{
new Float:x, Float:y, Float:z;
GetPlayerCameraPos(playerid, x, y, z);
printf("The player left when they had their camera at %f, %f, %f.", x, y, z);
return 1;
}
```
## Notes
:::warning
Player's camera positions are only updated once a second, unless aiming.It is recommended to set a 1 second timer if you wish to take action that relies on a player's camera position.
:::
## Related Functions
- [SetPlayerCameraPos](SetPlayerCameraPos): Set a player's camera position.
- [GetPlayerCameraZoom](GetPlayerCameraZoom): Get the zoom level of a player's camera.
- [GetPlayerCameraAspectRatio](GetPlayerCameraAspectRatio): Get the aspect ratio of a player's camera.
- [GetPlayerCameraMode](GetplayerCameraMode): Get a player's camera mode.
- [GetPlayerCameraFrontVector](GetPlayerCameraFrontVector): Get the player's camera front vector
- [GetPlayerZAim](GetPlayerZAim): Gets a player's Z Aim.
| openmultiplayer/web/docs/scripting/functions/GetPlayerCameraPos.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/GetPlayerCameraPos.md",
"repo_id": "openmultiplayer",
"token_count": 531
} | 304 |
---
title: GetPlayerDrunkLevel
description: Checks the player's level of drunkenness.
tags: ["player"]
---
## Description
Checks the player's level of drunkenness. If the level is less than 2000, the player is sober. The player's level of drunkness goes down slowly automatically (26 levels per second) but will always reach 2000 at the end. The higher drunkenness levels affect the player's camera, and the car driving handling. The level of drunkenness increases when the player drinks from a bottle (You can use SetPlayerSpecialAction to give them bottles).
| Name | Description |
| -------- | ------------------------------------------------------ |
| playerid | The player you want to check the drunkenness level of. |
## Returns
An integer with the level of drunkenness of the player.
## Examples
```c
public OnPlayerStateChange(playerid, oldstate, newstate)
{
if (newstate == PLAYER_STATE_DRIVER && GetPlayerDrunkLevel(playerid) > 1999)
{
SendClientMessage(playerid, 0xFFFFFFFF, "Don't drink and drive!");
RemovePlayerFromVehicle(playerid);
}
}
```
## Related Functions
- [SetPlayerDrunkLevel](SetPlayerDrunkLevel): Set a player's drunk level.
| openmultiplayer/web/docs/scripting/functions/GetPlayerDrunkLevel.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/GetPlayerDrunkLevel.md",
"repo_id": "openmultiplayer",
"token_count": 370
} | 305 |
---
title: GetPlayerMoney
description: Retrieves the amount of money a player has.
tags: ["player"]
---
## Description
Retrieves the amount of money a player has.
| Name | Description |
| -------- | ----------------------------------------- |
| playerid | The ID of the player to get the money of. |
## Returns
The amount of money the player has.
## Examples
```c
public OnPlayerSpawn(playerid)
{
new string[32];
format(string, sizeof(string), "Your money: $%i", GetPlayerMoney(playerid));
SendClientMessage(playerid, 0x00FF00FF, string);
}
```
## Related Functions
- [GivePlayerMoney](GivePlayerMoney): Give a player money.
- [ResetPlayerMoney](ResetPlayerMoney): Set the money of a player to \$0.
| openmultiplayer/web/docs/scripting/functions/GetPlayerMoney.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/GetPlayerMoney.md",
"repo_id": "openmultiplayer",
"token_count": 253
} | 306 |
---
title: GetPlayerPickupPos
description: Gets the coordinates of a player-pickup.
tags: ["player", "pickup", "playerpickup"]
---
<VersionWarn version='omp v1.1.0.2612' />
## Description
Gets the coordinates of a player-pickup.
| Name | Description |
|----------|---------------------------------------------------------------------------|
| playerid | The ID of the player. |
| pickupid | The ID of the player-pickup to get the position of. |
| &Float:x | A float variable in which to store the x coordinate, passed by reference. |
| &Float:y | A float variable in which to store the y coordinate, passed by reference. |
| &Float:z | A float variable in which to store the z coordinate, passed by reference. |
## Returns
This function does not return a specific value.
## Examples
```c
new PlayerPickup[MAX_PLAYERS];
public OnPlayerConnect(playerid)
{
PlayerPickup[playerid] = CreatePlayerPickup(playerid, 1239, 1, 2010.0979, 1222.0642, 10.8206, -1);
new
Float:x,
Float:y,
Float:z;
GetPickupPos(g_Pickup, x, y, z);
// x = 2010.0979
// y = 1222.0642
// z = 10.8206
return 1;
}
```
## Related Functions
- [CreatePlayerPickup](CreatePlayerPickup): Creates a pickup which will be visible to only one player.
- [DestroyPlayerPickup](DestroyPlayerPickup): Destroy a player-pickup.
- [IsValidPlayerPickup](IsValidPlayerPickup): Checks if a player-pickup is valid.
- [IsPlayerPickupStreamedIn](IsPlayerPickupStreamedIn): Checks if a player-pickup is streamed in for the player.
- [SetPlayerPickupPos](SetPlayerPickupPos): Sets the position of a player-pickup.
- [SetPlayerPickupModel](SetPlayerPickupModel): Sets the model of a player-pickup.
- [GetPlayerPickupModel](GetPlayerPickupModel): Gets the model ID of a player-pickup.
- [SetPlayerPickupType](SetPlayerPickupType): Sets the type of a player-pickup.
- [GetPlayerPickupType](GetPlayerPickupType): Gets the type of a player-pickup.
- [SetPlayerPickupVirtualWorld](SetPlayerPickupVirtualWorld): Sets the virtual world ID of a player-pickup.
- [GetPlayerPickupVirtualWorld](GetPlayerPickupVirtualWorld): Gets the virtual world ID of a player-pickup.
| openmultiplayer/web/docs/scripting/functions/GetPlayerPickupPos.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/GetPlayerPickupPos.md",
"repo_id": "openmultiplayer",
"token_count": 822
} | 307 |
---
title: GetPlayerState
description: Get a player's current state.
tags: ["player"]
---
## Description
Get a player's current state.
| Name | Description |
| -------- | ------------------------------------------------- |
| playerid | The ID of the player to get the current state of. |
## Returns
The player's current state as an integer (see: [Player States](../resources/playerstates)).
## Examples
```c
public OnPlayerDeath(playerid, killerid, WEAPON:reason)
{
new PLAYER_STATE:state = GetPlayerState(killerid); // Get the killer's state
if (state == PLAYER_STATE_DRIVER) // If the killer was in a vehicle
{
//It's a driver drive-by, take some money
GivePlayerMoney(killerid, -10000);
}
return 1;
}
```
## Related Functions
- [GetPlayerSpecialAction](GetPlayerSpecialAction): Get a player's current special action.
- [SetPlayerSpecialAction](SetPlayerSpecialAction): Set a player's special action.
## Related Callbacks
- [OnPlayerStateChange](../callbacks/OnPlayerStateChange): Called when a player changes state.
## Related Resources
- [Player States](../resources/playerstates)
| openmultiplayer/web/docs/scripting/functions/GetPlayerState.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/GetPlayerState.md",
"repo_id": "openmultiplayer",
"token_count": 375
} | 308 |
---
title: GetPlayerWeapon
description: Returns the ID of the weapon a player is currently holding.
tags: ["player"]
---
## Description
Returns the ID of the weapon a player is currently holding.
| Name | Description |
| -------- | --------------------------------------------------------- |
| playerid | The ID of the player to get the currently held weapon of. |
## Returns
The ID of the player's current weapon. Returns -1 if the player specified does not exist.
## Examples
```c
public OnPlayerDeath(playerid, killerid, WEAPON:reason)
{
// Check if the killerid is not an invalid player (which means is connected).
if (killerid != INVALID_PLAYER_ID)
{
// The WEAPON_MINIGUN constant is pre-defined in the standard library and is equal to 38.
if (GetPlayerWeapon(killerid) == WEAPON_MINIGUN)
{
//Ban if they have a minigun
Ban(killerid);
}
}
return 1;
}
```
## Notes
:::tip
When the player state is `PLAYER_STATE_DRIVER` or `PLAYER_STATE_PASSENGER` this function returns the weapon held by the player before they entered the vehicle. If a cheat is used to spawn a weapon inside a vehicle, this function will not report it.
:::
:::warning
Sometimes the result can be -1 which is an invalid weapon ID. Circumstances of this are not yet known, but it is best to discard information when returned weapon is -1.
:::
## Related Functions
- [GetPlayerWeaponData](GetPlayerWeaponData): Find out information about weapons a player has.
- [GivePlayerWeapon](GivePlayerWeapon): Give a player a weapon.
- [ResetPlayerWeapons](ResetPlayerWeapons): Remove all weapons from a player.
- [RemovePlayerWeapon](RemovePlayerWeapon): Remove a specified weapon from a player.
## Related Resources
- [Weapon IDs](../resources/weaponids)
| openmultiplayer/web/docs/scripting/functions/GetPlayerWeapon.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/GetPlayerWeapon.md",
"repo_id": "openmultiplayer",
"token_count": 589
} | 309 |
---
title: GetServerTickRate
description: Gets the tick rate (like FPS) of the server.
tags: []
---
## Description
Gets the tick rate (like FPS) of the server.
## Examples
```c
printf("The current server tick rate is: %i", GetServerTickRate());
```
## Related Functions
- [GetNetworkStats](GetNetworkStats): Gets the servers networkstats and saves it into a string.
| openmultiplayer/web/docs/scripting/functions/GetServerTickRate.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/GetServerTickRate.md",
"repo_id": "openmultiplayer",
"token_count": 110
} | 310 |
---
title: GetVehicleHydraReactorAngle
description: Gets the hydra reactor angle of the vehicle.
tags: ["vehicle"]
---
<VersionWarn version='omp v1.1.0.2612' />
## Description
Gets the hydra reactor angle of the vehicle.
## Parameters
| Name | Description |
|-----------|------------------------|
| vehicleid | The ID of the vehicle. |
## Examples
```c
new Float:reactorAngle = GetVehicleHydraReactorAngle(vehicleid);
```
## Related Functions
- [GetPlayerHydraReactorAngle](GetPlayerHydraReactorAngle): Gets the reactor angle of the player's hydra.
| openmultiplayer/web/docs/scripting/functions/GetVehicleHydraReactorAngle.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/GetVehicleHydraReactorAngle.md",
"repo_id": "openmultiplayer",
"token_count": 188
} | 311 |
---
title: GetVehiclePoolSize
description: Gets the highest vehicleid currently in use on the server.
tags: ["vehicle"]
---
<VersionWarn version='SA-MP 0.3.7' />
## Description
Gets the highest vehicleid currently in use on the server. Note that in SA:MP this function is broken and will return `0` even when there are no vehicles. fixes.inc and open.mp correct this to return `-1`, but also deprecate the function in favour of `MAX_VEHICLES` or `foreach`.
## Examples
```c
RepairAllVehicles()
{
// vehicleids start at 1
for(new i = 1, j = GetVehiclePoolSize(); i <= j; i++)
{
RepairVehicle(i);
}
}
```
## Related Functions
- [GetPlayerPoolSize](GetPlayerPoolSize): Gets the highest playerid connected to the server.
| openmultiplayer/web/docs/scripting/functions/GetVehiclePoolSize.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/GetVehiclePoolSize.md",
"repo_id": "openmultiplayer",
"token_count": 245
} | 312 |
---
title: GetWeaponSlot
description: Gets the slot of one weapon.
tags: ["weapon"]
---
<versionWarn version='omp v1.1.0.2612' />
## Description
Gets the slot of one weapon.
| Name | Description |
| --------------- | ---------------------------------------- |
| WEAPON:weaponid | The ID of the weapon to get the slot of. |
## Returns
The number of the [weapon slot](../resources/weaponslots) (0 - 12)
## Examples
```c
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp(cmdtext, "/weaponslot", true) == 0)
{
new WEAPON:weaponid = GetPlayerWeapon(playerid); // will store the id of the weapon the player is currently holding
new WEAPON_SLOT:slot = GetWeaponSlot(weaponid); // will store the id of the weapon slot
SendClientMessage(playerid, -1, "Your weapon is occupying the slot %d.", slot); // sends a formatted message to the player
return 1;
}
return 0;
}
```
## Related Functions
- [GetPlayerWeapon](GetPlayerWeapon): Gets the ID of the weapon a player is currently holding.
- [GetPlayerWeaponData](GetPlayerWeaponData): Get the weapon and ammo in a specific player's weapon slot (e.g. the weapon in the 'SMG' slot).
- [GetPlayerAmmo](GetPlayerAmmo): Gets the amount of ammo in a player's current weapon.
- [SetPlayerArmedWeapon](SetPlayerArmedWeapon): Sets which weapon (that a player already has) the player is holding.
- [ResetPlayerWeapon](ResetPlayerWeapons): Removes all weapons from a player.
- [RemovePlayerWeapon](RemovePlayerWeapon): Remove a specified weapon from a player.
## Related Resources
- [Weapon Slots](../resources/weaponslots).
| openmultiplayer/web/docs/scripting/functions/GetWeaponSlot.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/GetWeaponSlot.md",
"repo_id": "openmultiplayer",
"token_count": 535
} | 313 |
---
title: HideVehicle
description: Hides a vehicle from the game.
tags: ["vehicle"]
---
<VersionWarn version='omp v1.1.0.2612' />
:::warning
This function has not yet been implemented.
:::
## Description
Hides a vehicle from the game.
## Parametes
| Name | Description |
|-----------|--------------------------------|
| vehicleid | The ID of the vehicle to hide. |
## Examples
```c
public OnGameModeInit()
{
new vehicleid = CreateVehicle(536, 2496.5034, 5.6658, 27.2247, 180.0000, -1, -1, 60);
HideVehicle(vehicleid);
return 1;
}
```
## Related Functions
- [ShowVehicle](ShowVehicle): Shows the hidden vehicle.
- [IsVehicleHidden](IsVehicleHidden): Checks if a vehicle is hidden.
| openmultiplayer/web/docs/scripting/functions/HideVehicle.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/HideVehicle.md",
"repo_id": "openmultiplayer",
"token_count": 264
} | 314 |
---
title: IsPlayerInPlayerGangZone
description: Check if the player in player gangzone
tags: ["player", "gangzone", "playergangzone"]
---
<VersionWarn version='omp v1.1.0.2612' />
## Description
Check if the player in player gangzone.
| Name | Description |
| ----------- | ---------------------------------------------------------------- |
| playerid | The ID of the player to whom player gangzone is bound. |
| zoneid | The ID of the player gangzone. |
## Returns
**true** - The player is in player gangzone.
**false** - The player is not in player gangzone.
## Examples
```c
new gGangZoneID[MAX_PLAYERS];
public OnPlayerConnect(playerid)
{
// Create the gangzone
gGangZoneID[playerid] = CreatePlayerGangZone(playerid, 2236.1475, 2424.7266, 2319.1636, 2502.4348);
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if (!strcmp(cmdtext, "/zone", true))
{
if (IsPlayerInPlayerGangZone(playerid, gGangZoneID[playerid]))
{
SendClientMessage(playerid, 0x00FF00FF, "You are in the gangzone.");
}
else
{
SendClientMessage(playerid, 0xFF0000FF, "You are not in the gangzone.");
}
return 1;
}
return 0;
}
```
## Related Functions
- [CreatePlayerGangZone](CreatePlayerGangZone): Create player gangzone.
- [PlayerGangZoneDestroy](PlayerGangZoneDestroy): Destroy player gangzone.
- [PlayerGangZoneShow](PlayerGangZoneShow): Show player gangzone.
- [PlayerGangZoneHide](PlayerGangZoneHide): Hide player gangzone.
- [PlayerGangZoneFlash](PlayerGangZoneFlash): Start player gangzone flash.
- [PlayerGangZoneStopFlash](PlayerGangZoneStopFlash): Stop player gangzone flash.
- [PlayerGangZoneGetFlashColour](PlayerGangZoneGetFlashColour): Get the flashing colour of a player gangzone.
- [PlayerGangZoneGetColour](PlayerGangZoneGetColour): Get the colour of a player gangzone.
- [PlayerGangZoneGetPos](PlayerGangZoneGetPos): Get the position of a gangzone, represented by minX, minY, maxX, maxY coordinates.
- [IsValidPlayerGangZone](IsValidPlayerGangZone): Check if the player gangzone valid.
- [IsPlayerGangZoneVisible](IsPlayerGangZoneVisible): Check if the player gangzone is visible.
- [IsPlayerGangZoneFlashing](IsPlayerGangZoneFlashing): Check if the player gangzone is flashing.
- [UsePlayerGangZoneCheck](UsePlayerGangZoneCheck): Enables the callback when a player enters/leaves this zone. | openmultiplayer/web/docs/scripting/functions/IsPlayerInPlayerGangZone.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/IsPlayerInPlayerGangZone.md",
"repo_id": "openmultiplayer",
"token_count": 920
} | 315 |
---
title: IsTextDrawVisibleForPlayer
description: Checks if a textdraw is shown for a player.
tags: ["textdraw"]
---
<VersionWarn version='omp v1.1.0.2612' />
## Description
Checks if a textdraw is shown for a player.
| Name | Description |
| ----------- | -------------------------------- |
| playerid | The ID of the player to check. |
| Text:textid | The ID of the textdraw. |
## Returns
**true** - Textdraw is shown for the player.
**false** - Textdraw is not shown for the player.
## Examples
```c
new Text:gMyTextdraw;
public OnGameModeInit()
{
gMyTextdraw = TextDrawCreate(240.0, 580.0, "Example Text");
return 1;
}
public OnPlayerConnect(playerid)
{
TextDrawShowForPlayer(playerid, gMyTextdraw);
return 1;
}
public OnPlayerSpawn(playerid)
{
if (IsTextDrawVisibleForPlayer(playerid, gMyTextdraw))
{
// gMyTextdraw is shown for the player
}
return 1;
}
```
## Related Functions
- [TextDrawCreate](TextDrawCreate): Creates a textdraw.
- [TextDrawShowForPlayer](TextDrawShowForPlayer): Show a textdraw for a certain player.
- [TextDrawHideForPlayer](TextDrawHideForPlayer): Hide a textdraw for a certain player.
| openmultiplayer/web/docs/scripting/functions/IsTextDrawVisibleForPlayer.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/IsTextDrawVisibleForPlayer.md",
"repo_id": "openmultiplayer",
"token_count": 437
} | 316 |
---
title: IsValidServerRule
description: Checks if the given server rule is valid.
tags: ["rule"]
---
<VersionWarn version='omp v1.1.0.2612' />
## Description
Checks if the given server rule is valid.
| Name | Description |
| ------------ | ----------------------------------------------------------- |
| const rule[] | The server rule name to check. |
## Returns
Returns true if the server rule is valid, otherwise false.
## Examples
```c
if (IsValidServerRule("version"))
{
// Server rule is valid
}
else
{
// Server rule is not valid
}
```
## Related Functions
- [AddServerRule](AddServerRule): Add a server rule.
- [RemoveServerRule](RemoveServerRule): Remove the server rule.
| openmultiplayer/web/docs/scripting/functions/IsValidServerRule.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/IsValidServerRule.md",
"repo_id": "openmultiplayer",
"token_count": 287
} | 317 |
---
title: MovePlayerObject
description: Move a player object with a set speed.
tags: ["player"]
---
## Description
Move a player object with a set speed. Also supports rotation. Players/vehicles will surf moving objects.
| Name | Description |
| --------------- | ------------------------------------------------- |
| playerid | The ID of the player whose player-object to move. |
| objectid | The ID of the object to move. |
| Float:targetX | The X coordinate to move the object to. |
| Float:targetY | The Y coordinate to move the object to. |
| Float:targetZ | The Z coordinate to move the object to. |
| Float:speed | The speed at which to move the object. |
| Float:rotationX | The final X rotation (optional). |
| Float:rotationY | The final Y rotation (optional). |
| Float:rotationZ | The final Z rotation (optional). |
## Returns
The time it will take for the object to move in milliseconds.
## Examples
```c
new gPlayerObject[MAX_PLAYERS];
public OnPlayerConnect(playerid)
{
gPlayerObject[playerid] = CreatePlayerObject(playerid, 2587, 2001.195679, 1547.113892, 14.283400, 0.0, 0.0, 96.0);
MovePlayerObject(playerid, gPlayerObject[playerid], 2001.195679, 1547.113892, 10.000000, 2.0);
return 1;
}
```
## Notes
:::tip
If using the rotation parameters, the object must be moved (X/Y/Z). The object will interpolate the rotation from when the objects starts moving and when it stops.
:::
## Related Functions
- [CreatePlayerObject](CreatePlayerObject): Create an object for only one player.
- [DestroyPlayerObject](DestroyPlayerObject): Destroy a player object.
- [IsValidPlayerObject](IsValidPlayerObject): Checks if a certain player object is vaild.
- [StopPlayerObject](StopPlayerObject): Stop a player object from moving.
- [IsObjectMoving](IsObjectMoving): Check if the object is moving.
- [SetPlayerObjectPos](SetPlayerObjectPos): Set the position of a player object.
- [SetPlayerObjectRot](SetPlayerObjectRot): Set the rotation of a player object.
- [GetPlayerObjectPos](GetPlayerObjectPos): Locate a player object.
- [GetPlayerObjectRot](GetPlayerObjectRot): Check the rotation of a player object.
- [AttachPlayerObjectToPlayer](AttachPlayerObjectToPlayer): Attach a player object to a player.
- [CreateObject](CreateObject): Create an object.
- [DestroyObject](DestroyObject): Destroy an object.
- [IsValidObject](IsValidObject): Checks if a certain object is vaild.
- [MoveObject](MoveObject): Move an object.
- [StopObject](StopObject): Stop an object from moving.
- [IsPlayerObjectMoving](IsPlayerObjectMoving): Check if the player object is moving.
- [SetObjectPos](SetObjectPos): Set the position of an object.
- [SetObjectRot](SetObjectRot): Set the rotation of an object.
- [GetObjectPos](GetObjectPos): Locate an object.
- [GetObjectRot](GetObjectRot): Check the rotation of an object.
- [AttachObjectToPlayer](AttachObjectToPlayer): Attach an object to a player.
| openmultiplayer/web/docs/scripting/functions/MovePlayerObject.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/MovePlayerObject.md",
"repo_id": "openmultiplayer",
"token_count": 1000
} | 318 |
---
title: PlayerTextDrawDestroy
description: Destroy a player-textdraw.
tags: ["player", "textdraw", "playertextdraw"]
---
## Description
Destroy a player-textdraw.
| Name | Description |
| ----------------- | ------------------------------------------------------ |
| playerid | The ID of the player who's player-textdraw to destroy. |
| PlayerText:textid | The ID of the textdraw to destroy. |
## Returns
This function does not return any specific values.
## Examples
```c
new PlayerText:pTextdraw[MAX_PLAYERS];
public OnPlayerConnect(playerid)
{
pTextdraw[playerid] = CreatePlayerTextDraw(playerid, 320.0, 240.0, "Example Text");
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
PlayerTextDrawDestroy(playerid, pTextdraw[playerid]);
return 1;
}
```
## Related Functions
- [CreatePlayerTextDraw](CreatePlayerTextDraw): Create a player-textdraw.
- [PlayerTextDrawColor](PlayerTextDrawColor): Set the color of the text in a player-textdraw.
- [PlayerTextDrawBoxColor](PlayerTextDrawBoxColor): Set the color of a player-textdraw's box.
- [PlayerTextDrawBackgroundColor](PlayerTextDrawBackgroundColor): Set the background color of a player-textdraw.
- [PlayerTextDrawAlignment](PlayerTextDrawAlignment): Set the alignment of a player-textdraw.
- [PlayerTextDrawFont](PlayerTextDrawFont): Set the font of a player-textdraw.
- [PlayerTextDrawLetterSize](PlayerTextDrawLetterSize): Set the letter size of the text in a player-textdraw.
- [PlayerTextDrawTextSize](PlayerTextDrawTextSize): Set the size of a player-textdraw box (or clickable area for PlayerTextDrawSetSelectable).
- [PlayerTextDrawSetOutline](PlayerTextDrawSetOutline): Toggle the outline on a player-textdraw.
- [PlayerTextDrawSetShadow](PlayerTextDrawSetShadow): Set the shadow on a player-textdraw.
- [PlayerTextDrawSetProportional](PlayerTextDrawSetProportional): Scale the text spacing in a player-textdraw to a proportional ratio.
- [PlayerTextDrawUseBox](PlayerTextDrawUseBox): Toggle the box on a player-textdraw.
- [PlayerTextDrawSetString](PlayerTextDrawSetString): Set the text of a player-textdraw.
- [PlayerTextDrawShow](PlayerTextDrawShow): Show a player-textdraw.
- [PlayerTextDrawHide](PlayerTextDrawHide): Hide a player-textdraw.
| openmultiplayer/web/docs/scripting/functions/PlayerTextDrawDestroy.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/PlayerTextDrawDestroy.md",
"repo_id": "openmultiplayer",
"token_count": 721
} | 319 |
---
title: PlayerTextDrawSetSelectable
description: Toggles whether a player-textdraw can be selected or not.
tags: ["player", "textdraw", "playertextdraw"]
---
## Description
Toggles whether a player-textdraw can be selected or not.
| Name | Description |
| ----------------- | ------------------------------------------------------------------------------------------------ |
| playerid | The ID of the player whose player-textdraw to set the selectability of. |
| PlayerText:textid | The ID of the player-textdraw to set the selectability of. |
| bool:selectable | Set the player-textdraw selectable 'true' or non-selectable 'false'. By default this is 'false'. |
## Returns
This function does not return any specific values.
## Examples
```c
new PlayerText:welcomeText[MAX_PLAYERS];
public OnPlayerConnect(playerid)
{
welcomeText[playerid] = CreatePlayerTextDraw(playerid, 320.0, 240.0, "Welcome to my server");
PlayerTextDrawTextSize(playerid, welcomeText[playerid], 30.0, 10.0);
// Set 'welcomeText[playerid]' selectable
PlayerTextDrawSetSelectable(playerid, welcomeText[playerid], true);
// Enable select textdraw for player
SelectTextDraw(playerid, 0xFF0000FF);
// Show 'welcomeText[playerid]' to the player
PlayerTextDrawShow(playerid, welcomeText[playerid]);
return 1;
}
```
## Notes
:::tip
Use [PlayerTextDrawTextSize](PlayerTextDrawTextSize) to define the clickable area.
:::
:::warning
[PlayerTextDrawSetSelectable](PlayerTextDrawSetSelectable) and [SelectTextDraw](SelectTextDraw) MUST be used BEFORE the textdraw is shown to the player.
:::
## Related Functions
- [PlayerTextDrawIsSelectable](PlayerTextDrawIsSelectable): Checks if a player-textdraw is selectable.
- [SelectTextDraw](SelectTextDraw): Enables the mouse, so the player can select a textdraw
- [CancelSelectTextDraw](CancelSelectTextDraw): Cancel textdraw selection with the mouse
## Related Callbacks
- [OnPlayerClickPlayerTextDraw](../callbacks/OnPlayerClickPlayerTextDraw): Called when a player clicks on a player-textdraw.
| openmultiplayer/web/docs/scripting/functions/PlayerTextDrawSetSelectable.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/PlayerTextDrawSetSelectable.md",
"repo_id": "openmultiplayer",
"token_count": 766
} | 320 |
---
title: ResetPlayerMoney
description: Reset a player's money to $0.
tags: ["player"]
---
## Description
Reset a player's money to $0.
| Name | Description |
| -------- | ------------------------------------------- |
| playerid | The ID of the player to reset the money of. |
## Returns
**1** - The function was executed successfully.
**0** - The function failed to execute. This means the player is not connected.
## Examples
```c
public OnPlayerDeath(playerid, killerid, WEAPON:reason)
{
SendClientMessage(playerid, 0xFFFFFFAA, "You died and lost all of your cash!");
ResetPlayerMoney(playerid);
return 1;
}
```
## Related Functions
- [GetPlayerMoney](GetPlayerMoney): Check how much money a player has.
- [GivePlayerMoney](GivePlayerMoney): Give a player money.
| openmultiplayer/web/docs/scripting/functions/ResetPlayerMoney.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/ResetPlayerMoney.md",
"repo_id": "openmultiplayer",
"token_count": 268
} | 321 |
---
title: SendPlayerMessageToPlayer
description: Sends a message in the name of a player to another player on the server.
tags: ["player"]
---
## Description
Sends a message in the name of a player to another player on the server. The message will appear in the chat box but can only be seen by the user specified with 'playerid'. The line will start with the sender's name in their color, followed by the message in white.
| Name | Description |
| ---------------- | ---------------------------------------------------------- |
| playerid | The ID of the player who will receive the message. |
| senderid | The sender's ID. If invalid, the message will not be sent. |
| const format[] | The message that will be sent. |
| OPEN_MP_TAGS:... | Indefinite number of arguments of any tag. |
## Returns
**true** - The function was executed successfully.
**false** - The function failed to execute. This means the player specified does not exist.
## Examples
```c
public OnPlayerCommandText(playerid, cmdtext[])
{
if (!strcmp(cmdtext, "/hello", true))
{
SendPlayerMessageToPlayer(0, playerid, "Hello ID 0!"); // Will send a message to the user with the ID 0 in the name of the user who typed '/hello'.
// Assuming 'playerid' is called Tenpenny, the output will be 'Tenpenny: Hello ID 0!'
return 1;
}
return 0;
}
```
## Notes
:::warning
Avoid using format specifiers in your messages without formatting the string that is sent. It will result in crashes otherwise.
:::
## Related Functions
- [SendPlayerMessageToAll](SendPlayerMessageToAll): Force a player to send text for all players.
- [SendClientMessage](SendClientMessage): Send a message to a certain player.
- [SendClientMessageToAll](SendClientMessageToAll): Send a message to all players.
## Related Callbacks
- [OnPlayerText](../callbacks/OnPlayerText): Called when a player sends a message via the chat.
| openmultiplayer/web/docs/scripting/functions/SendPlayerMessageToPlayer.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/SendPlayerMessageToPlayer.md",
"repo_id": "openmultiplayer",
"token_count": 657
} | 322 |
---
title: SetModeRestartTime
description: Sets the delay between loading main scripts, in seconds.
tags: []
---
<VersionWarn version='omp v1.1.0.2612' />
## Description
Sets the delay between loading main scripts, in seconds.
## Parameters
| Name | Description |
|---------------|---------------------|
| Float:seconds | Seconds to restart. |
## Return Values
1 - Function executed successfully.
0 - Function failed to execute. This means that the specified seconds should not be less than 1.
## Examples
```c
public OnPlayerCommandText(playerid, cmdtext[])
{
if (!strcmp(cmdtext, "/restart", true))
{
if (!IsPlayerAdmin(playerid))
{
return 1;
}
SetModeRestartTime(5.0);
SendClientMessage(playerid, -1, "[SERVER]: The server will restart in 5 seconds.");
return 1;
}
return 0;
}
```
## Notes
:::warning
The `seconds` parameter is a float.
:::
## Related Functions
- [GetModeRestartTime](GetModeRestartTime): Gets the delay between loading main scripts, in seconds.
- [GameModeExit](GameModeExit): Ends the current gamemode.
| openmultiplayer/web/docs/scripting/functions/SetModeRestartTime.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/SetModeRestartTime.md",
"repo_id": "openmultiplayer",
"token_count": 397
} | 323 |
---
title: SetPickupForPlayer
description: Adjusts the pickup model, type, and position for a specific player.
tags: ["player", "pickup"]
---
<VersionWarn version='omp v1.1.0.2612' />
:::warning
This function has not yet been implemented.
:::
## Description
Adjusts the pickup model, type, and position for a specific player.
| Name | Description |
|----------|-----------------------------------------------------|
| playerid | The ID of the player. |
| pickupid | The ID of the pickup. |
| model | The [model](../resources/pickupids) to set. |
| type | The [pickup type](../resources/pickuptypes) to set. |
| Float:x | The x coordinate to set the pickup at. |
| Float:y | The y coordinate to set the pickup at. |
| Float:z | The z coordinate to set the pickup at. |
## Returns
This function always returns **true**.
## Examples
```c
new g_Pickup;
public OnGameModeInit()
{
g_Pickup = CreatePickup(1239, 1, 1686.6160, 1455.4277, 10.7705, -1);
return 1;
}
public OnPlayerSpawn(playerid)
{
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
SetPickupForPlayer(playerid, g_Pickup, 1210, 2, x + 2.0, y + 2.0, z);
return 1;
}
```
## Related Functions
- [CreatePickup](CreatePickup): Create a pickup.
- [AddStaticPickup](AddStaticPickup): Add a static pickup.
- [DestroyPickup](DestroyPickup): Destroy a pickup.
- [IsValidPickup](IsValidPickup): Checks if a pickup is valid.
- [IsPickupStreamedIn](IsPickupStreamedIn): Checks if a pickup is streamed in for a specific player.
- [IsPickupHiddenForPlayer](IsPickupHiddenForPlayer): Checks if a pickup is hidden for a specific player.
- [SetPickupPos](SetPickupPos): Sets the position of a pickup.
- [GetPickupPos](GetPickupPos): Gets the coordinates of a pickup.
- [SetPickupModel](SetPickupModel): Sets the model of a pickup.
- [GetPickupModel](GetPickupModel): Gets the model ID of a pickup.
- [SetPickupType](SetPickupType): Sets the type of a pickup.
- [GetPickupType](GetPickupType): Gets the type of a pickup.
- [SetPickupVirtualWorld](SetPickupVirtualWorld): Sets the virtual world ID of a pickup.
- [GetPickupVirtualWorld](GetPickupVirtualWorld): Gets the virtual world ID of a pickup.
- [ShowPickupForPlayer](ShowPickupForPlayer): Shows a pickup for a specific player.
- [HidePickupForPlayer](HidePickupForPlayer): Hides a pickup for a specific player.
| openmultiplayer/web/docs/scripting/functions/SetPickupForPlayer.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/SetPickupForPlayer.md",
"repo_id": "openmultiplayer",
"token_count": 914
} | 324 |
---
title: SetPlayerObjectRot
description: Set the rotation of an object on the X, Y and Z axis.
tags: ["player", "object", "playerobject"]
---
## Description
Set the rotation of an object on the X, Y and Z axis.
| Name | Description |
| --------------- | --------------------------------------------------- |
| playerid | The ID of the player whose player-object to rotate. |
| objectid | The ID of the player-object to rotate. |
| Float:rotationX | The X rotation to set. |
| Float:rotationY | The Y rotation to set. |
| Float:rotationZ | The Z rotation to set. |
## Returns
**true** - The function executed successfully.
**false** - The function failed to execute.
## Examples
```c
new gPlayerObject[MAX_PLAYERS];
public OnPlayerConnect(playerid)
{
gPlayerObject[playerid] = CreatePlayerObject(playerid, 2587, 2001.195679, 1547.113892, 14.283400, 0.0, 0.0, 96.0);
SetPlayerObjectRot(playerid, gPlayerObject[playerid], 0.0, 0.0, 180.0);
return 1;
}
```
## Notes
:::tip
To smoothly rotate an object, see [MovePlayerObject](MovePlayerObject).
:::
## Related Functions
- [CreatePlayerObject](CreatePlayerObject): Create an object for only one player.
- [DestroyPlayerObject](DestroyPlayerObject): Destroy a player object.
- [IsValidPlayerObject](IsValidPlayerObject): Checks if a certain player object is vaild.
- [MovePlayerObject](MovePlayerObject): Move a player object.
- [StopPlayerObject](StopPlayerObject): Stop a player object from moving.
- [SetPlayerObjectPos](SetPlayerObjectPos): Set the position of a player object.
- [GetPlayerObjectPos](GetPlayerObjectPos): Locate a player object.
- [GetPlayerObjectRot](GetPlayerObjectRot): Check the rotation of a player object.
- [AttachPlayerObjectToPlayer](AttachPlayerObjectToPlayer): Attach a player object to a player.
- [CreateObject](CreateObject): Create an object.
- [DestroyObject](DestroyObject): Destroy an object.
- [IsValidObject](IsValidObject): Checks if a certain object is vaild.
- [MoveObject](MoveObject): Move an object.
- [StopObject](StopObject): Stop an object from moving.
- [SetObjectPos](SetObjectPos): Set the position of an object.
- [SetObjectRot](SetObjectRot): Set the rotation of an object.
- [GetObjectPos](GetObjectPos): Locate an object.
- [GetObjectRot](GetObjectRot): Check the rotation of an object.
- [AttachObjectToPlayer](AttachObjectToPlayer): Attach an object to a player.
| openmultiplayer/web/docs/scripting/functions/SetPlayerObjectRot.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/SetPlayerObjectRot.md",
"repo_id": "openmultiplayer",
"token_count": 856
} | 325 |
---
title: SetPlayerVirtualWorld
description: Set the virtual world of a player.
tags: ["player"]
---
## Description
Set the virtual world of a player. They can only see other players or vehicles that are in that same world.
| Name | Description |
| ------------ | ---------------------------------------------------------- |
| playerid | The ID of the player you want to set the virtual world of. |
| virtualWorld | The virtual world ID to put the player in. |
## Returns
**true** - The function executed successfully.
**false** - The function failed to execute. This means the player is not connected.
## Examples
```c
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp(cmdtext, "/world3", true) == 0)
{
SetPlayerVirtualWorld(playerid, 3);
return 1;
}
return 0;
}
```
## Notes
:::tip
The default virtual world is 0.
:::
## Related Functions
- [GetPlayerVirtualWorld](GetPlayerVirtualWorld): Check what virtual world a player is in.
- [SetVehicleVirtualWorld](SetVehicleVirtualWorld): Set the virtual world of a vehicle.
| openmultiplayer/web/docs/scripting/functions/SetPlayerVirtualWorld.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/SetPlayerVirtualWorld.md",
"repo_id": "openmultiplayer",
"token_count": 389
} | 326 |
---
title: SetVehicleHealth
description: Set a vehicle's health.
tags: ["vehicle"]
---
## Description
Set a vehicle's health. When a vehicle's health decreases the engine will produce smoke, and finally fire when it decreases to less than 250 (25%).
| Name | Description |
| ------------ | ------------------------------------------- |
| vehicleid | The ID of the vehicle to set the health of. |
| Float:health | The health, given as a float value. |
## Returns
**true** - The function executed successfully.
**false** - The function failed to execute. This means the vehicle does not exist.
## Examples
```c
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/fixengine", cmdtext, true) == 0)
{
new
vehicleid = GetPlayerVehicleID(playerid);
SetVehicleHealth(vehicleid, 1000.0);
SendClientMessage(playerid, -1, "The vehicles engine has been fully repaired.");
return 1;
}
return 0;
}
```
## Notes
:::tip
Full vehicle health is 1000. Higher values are possible. For more information on health values, see [this](../resources/vehiclehealth) page.
:::
## Related Functions
- [GetVehicleHealth](GetVehicleHealth): Check the health of a vehicle.
- [RepairVehicle](RepairVehicle): Fully repair a vehicle.
- [SetPlayerHealth](SetPlayerHealth): Set a player's health.
## Related Callbacks
- [OnVehicleDeath](../callbacks/OnVehicleDeath): Called when a vehicle is destroyed.
## Related Resources
- [Vehicle Health Values](../resources/vehiclehealth)
| openmultiplayer/web/docs/scripting/functions/SetVehicleHealth.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/SetVehicleHealth.md",
"repo_id": "openmultiplayer",
"token_count": 518
} | 327 |
---
title: SetWeather
description: Set the world weather for all players.
tags: []
---
## Description
Set the world weather for all players.
| Name | Description |
| --------- | --------------------------------------------- |
| weatherid | The [weather](../resources/weatherid) to set. |
## Returns
This function does not return any specific values.
## Examples
```c
public OnPlayerCommandText(playerid, cmdtext[])
{
if (!strcmp(cmdtext, "/sandstorm", true))
{
SetWeather(19);
return 1;
}
return 1;
}
```
## Notes
:::tip
- If [TogglePlayerClock](TogglePlayerClock) is enabled, weather will slowly change over time, instead of changing instantly.
- There are only valid 21 weather IDs in the game (0 - 20), however the game does not have any form of range check.
:::
## Related Functions
- [GetWeather](GetWeather): Get the current world weather.
- [SetPlayerWeather](SetPlayerWeather): Set a player's weather.
- [SetGravity](SetGravity): Set the global gravity.
## Related Resources
- [Weather IDs](../resources/weatherid)
| openmultiplayer/web/docs/scripting/functions/SetWeather.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/SetWeather.md",
"repo_id": "openmultiplayer",
"token_count": 358
} | 328 |
---
title: StopPlayerObject
description: Stop a moving player-object after MovePlayerObject has been used.
tags: ["player"]
---
## Description
Stop a moving player-object after MovePlayerObject has been used.
| Name | Description |
| -------- | ------------------------------------------------- |
| playerid | The ID of the player whose player-object to stop. |
| objectid | The ID of the player-object to stop. |
## Returns
This function does not return any specific values.
## Examples
```c
new gPlayerObject[MAX_PLAYERS];
public OnPlayerConnect(playerid)
{
gPlayerObject[playerid] = CreatePlayerObject(playerid, 2587, 2001.195679, 1547.113892, 14.283400, 0.0, 0.0, 96.0);
MovePlayerObject(playerid, gPlayerObject[playerid], 2001.195679, 1547.113892, 10.000000, 2.0);
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp(cmdtext, "/stopobject", true) == 0)
{
StopPlayerObject(playerid, gPlayerObject[playerid]);
return 1;
}
return 0;
}
```
## Related Functions
- [MovePlayerObject](MovePlayerObject): Move a player object.
- [CreatePlayerObject](CreatePlayerObject): Create an object for only one player.
- [DestroyPlayerObject](DestroyPlayerObject): Destroy a player object.
- [IsValidPlayerObject](IsValidPlayerObject): Checks if a certain player object is vaild.
- [IsPlayerObjectMoving](IsPlayerObjectMoving): Check if the player object is moving.
- [SetPlayerObjectPos](SetPlayerObjectPos): Set the position of a player object.
- [SetPlayerObjectRot](SetPlayerObjectRot): Set the rotation of a player object.
- [GetPlayerObjectPos](GetPlayerObjectPos): Locate a player object.
- [GetPlayerObjectRot](GetPlayerObjectRot): Check the rotation of a player object.
- [AttachPlayerObjectToPlayer](AttachPlayerObjectToPlayer): Attach a player object to a player.
- [CreateObject](CreateObject): Create an object.
- [DestroyObject](DestroyObject): Destroy an object.
- [IsValidObject](IsValidObject): Checks if a certain object is vaild.
- [MoveObject](MoveObject): Move an object.
- [IsObjectMoving](IsObjectMoving): Check if the object is moving.
- [StopObject](StopObject): Stop an object from moving.
- [SetObjectPos](SetObjectPos): Set the position of an object.
- [SetObjectRot](SetObjectRot): Set the rotation of an object.
- [GetObjectPos](GetObjectPos): Locate an object.
- [GetObjectRot](GetObjectRot): Check the rotation of an object.
- [AttachObjectToPlayer](AttachObjectToPlayer): Attach an object to a player.
| openmultiplayer/web/docs/scripting/functions/StopPlayerObject.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/StopPlayerObject.md",
"repo_id": "openmultiplayer",
"token_count": 786
} | 329 |
---
title: TextDrawHideForPlayer
description: Hides a textdraw for a specific player.
tags: ["player", "textdraw"]
---
## Description
Hides a textdraw for a specific player.
| Name | Description |
| ----------- | ----------------------------------------------------------- |
| playerid | The ID of the player that the textdraw should be hidden for |
| Text:textid | The ID of the textdraw to hide |
## Returns
This function does not return any specific values.
## Examples
```c
new Text:gMyTextdraw;
public OnGameModeInit()
{
gMyTextdraw = TextDrawCreate(123.0, 123.0, "Example");
return 1;
}
public OnGameModeExit()
{
TextDrawDestroy(gMyTextdraw);
return 1;
}
public OnPlayerSpawn(playerid)
{
TextDrawShowForPlayer(playerid, gMyTextdraw);
return 1;
}
public OnPlayerDeath(playerid, reason)
{
TextDrawHideForPlayer(playerid, gMyTextdraw);
return 1;
}
```
## Related Functions
- [TextDrawHideForAll](TextDrawHideForAll): Hide a textdraw for all players.
- [TextDrawShowForPlayer](TextDrawShowForPlayer): Show a textdraw for a certain player.
- [TextDrawShowForAll](TextDrawShowForAll): Show a textdraw for all players.
- [IsTextDrawVisibleForPlayer](IsTextDrawVisibleForPlayer): Checks if a textdraw is shown for a player.
| openmultiplayer/web/docs/scripting/functions/TextDrawHideForPlayer.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/TextDrawHideForPlayer.md",
"repo_id": "openmultiplayer",
"token_count": 486
} | 330 |
---
title: TextDrawShowForAll
description: Shows a textdraw for all players.
tags: ["textdraw"]
---
## Description
Shows a textdraw for all players.
| Name | Description |
| ----------- | ---------------------------------------------------------------------------------- |
| Text:textid | The ID of the textdraw to show.<br />Returned by [TextDrawCreate](TextDrawCreate). |
## Returns
**true** - The function executed successfully.
**false** - The function failed to execute. This means the textdraw specified does not exist.
## Examples
```c
new Text:gMyTextdraw;
public OnGameModeInit()
{
gMyTextdraw = TextDrawCreate(240.0, 580.0, "Example Text");
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if (!strcmp(cmdtext, "/showtd", true))
{
TextDrawShowForAll(gMyTextdraw);
return 1;
}
return 0;
}
```
## Related Functions
- [TextDrawShowForPlayer](TextDrawShowForPlayer): Show a textdraw for a certain player.
- [TextDrawHideForPlayer](TextDrawHideForPlayer): Hide a textdraw for a certain player.
- [TextDrawHideForAll](TextDrawHideForAll): Hide a textdraw for all players.
| openmultiplayer/web/docs/scripting/functions/TextDrawShowForAll.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/TextDrawShowForAll.md",
"repo_id": "openmultiplayer",
"token_count": 433
} | 331 |
---
title: UseGangZoneCheck
description: Enables the callback when a player enters/leaves this zone
tags: ["player", "gangzone"]
---
<VersionWarn version='omp v1.1.0.2612' />
## Description
Enables the callback when a player enters/leaves this zone.
| Name | Description |
| ----------- | -------------------------------------------------------------- |
| zoneid | The ID of the zone to enable area detection for. |
| bool:enable | Should entry detection be started or stopped? (`true`/`false`) |
## Returns
**1:** The function executed successfully.
**0:** The function failed to execute. The gangzone specified does not exist.
## Examples
```c
new gGangZoneID = INVALID_GANG_ZONE;
public OnGameModeInit()
{
gGangZoneID = GangZoneCreate(1248.011, 2072.804, 1439.348, 2204.319);
// Enabled the callback when a player enters/leaves this zone
UseGangZoneCheck(gGangZoneID, true);
}
public OnPlayerEnterGangZone(playerid, zoneid)
{
if (zoneid == gGangZoneID)
{
new string[64];
format(string, sizeof(string), "You are entering gangzone %i", zoneid);
SendClientMessage(playerid, 0xFFFFFFFF, string);
}
return 1;
}
public OnPlayerLeaveGangZone(playerid, zoneid)
{
if (zoneid == gGangZoneID)
{
new string[64];
format(string, sizeof(string), "You are leaving gangzone %i", zoneid);
SendClientMessage(playerid, 0xFFFFFFFF, string);
}
return 1;
}
```
## Related Callbacks
The following callbacks might be useful, as they're related to this function in one way or another.
- [OnPlayerEnterGangZone](../callbacks/OnPlayerEnterGangZone): This callback is called when a player enters a gangzone.
- [OnPlayerLeaveGangZone](../callbacks/OnPlayerLeaveGangZone): This callback is called when a player exited a gangzone.
## Related Functions
The following functions might be useful, as they're related to this function in one way or another.
- [GangZoneCreate](GangZoneCreate): Create a gangzone.
- [GangZoneDestroy](GangZoneDestroy): Destroy a gangzone.
- [GangZoneShowForPlayer](GangZoneShowForPlayer): Show a gangzone for a player.
- [GangZoneShowForAll](GangZoneShowForAll): Show a gangzone for all players.
- [GangZoneHideForPlayer](GangZoneHideForPlayer): Hide a gangzone for a player.
- [GangZoneHideForAll](GangZoneHideForAll): Hide a gangzone for all players.
- [GangZoneFlashForPlayer](GangZoneFlashForPlayer): Make a gangzone flash for a player.
- [GangZoneFlashForAll](GangZoneFlashForAll): Make a gangzone flash for all players.
- [GangZoneStopFlashForPlayer](GangZoneStopFlashForPlayer): Stop a gangzone flashing for a player.
- [GangZoneStopFlashForAll](GangZoneStopFlashForAll): Stop a gangzone flashing for all players.
- [IsValidGangZone](IsValidGangZone): Check if the gangzone valid.
- [IsPlayerInGangZone](IsPlayerInGangZone): Check if the player in gangzone.
- [IsGangZoneVisibleForPlayer](IsGangZoneVisibleForPlayer): Check if the gangzone is visible for player. | openmultiplayer/web/docs/scripting/functions/UseGangZoneCheck.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/UseGangZoneCheck.md",
"repo_id": "openmultiplayer",
"token_count": 1035
} | 332 |
---
title: db_debug_openfiles
description: Gets the number of open database connections for debugging purposes.
keywords:
- sqlite
---
<LowercaseNote />
## Description
The function gets the number of open database connections for debugging purposes.
| Name | Description |
| ---- | ----------- |
## Related Functions
- [db_open](db_open): Open a connection to an SQLite database
- [db_close](db_close): Close the connection to an SQLite database
- [db_query](db_query): Query an SQLite database
- [db_free_result](db_free_result): Free result memory from a db_query
- [db_num_rows](db_num_rows): Get the number of rows in a result
- [db_next_row](db_next_row): Move to the next row
- [db_num_fields](db_num_fields): Get the number of fields in a result
- [db_field_name](db_field_name): Returns the name of a field at a particular index
- [db_get_field](db_get_field): Get content of field with specified ID from current result row
- [db_get_field_assoc](db_get_field_assoc): Get content of field with specified name from current result row
- [db_get_field_int](db_get_field_int): Get content of field as an integer with specified ID from current result row
- [db_get_field_assoc_int](db_get_field_assoc_int): Get content of field as an integer with specified name from current result row
- [db_get_field_float](db_get_field_float): Get content of field as a float with specified ID from current result row
- [db_get_field_assoc_float](db_get_field_assoc_float): Get content of field as a float with specified name from current result row
- [db_get_mem_handle](db_get_mem_handle): Get memory handle for an SQLite database that was opened with db_open.
- [db_get_result_mem_handle](db_get_result_mem_handle): Get memory handle for an SQLite query that was executed with db_query.
- [db_debug_openresults](db_debug_openresults): The function gets the number of open database results.
| openmultiplayer/web/docs/scripting/functions/db_debug_openfiles.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/db_debug_openfiles.md",
"repo_id": "openmultiplayer",
"token_count": 553
} | 333 |
---
title: float
description: Converts an integer into a float.
tags: ["floating-point"]
---
<LowercaseNote />
## Description
Converts an integer into a float.
| Name | Description |
| ----- | ----------------------------------- |
| value | Integer value to convert to a float |
## Returns
The given integer as a float
## Examples
```c
new Float:FloatValue;
new Value = 52;
FloatValue = float(Value); // Converts Value(52) into a float and stores it in 'FloatValue' (52.0)
```
## Related Functions
- [floatround](floatround): Convert a float to an integer (rounding).
- [floatstr](floatstr): Convert an string to a float.
| openmultiplayer/web/docs/scripting/functions/float.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/float.md",
"repo_id": "openmultiplayer",
"token_count": 211
} | 334 |
---
title: fmatch
description: Find a filename matching a pattern.
tags: ["file management"]
---
<LowercaseNote />
## Description
Find a filename matching a pattern.
| Name | Description |
| ------------------------ | ------------------------------------------------------------------------ |
| const filename[] | The string to hold the result in, returned as a packed string. |
| const pattern[] | The pattern that should be matched. May contain wildcards. |
| index | The number of the file, in case there are multiple matches. (default: 0) |
| size = sizeof (filename) | The maximum size of parameter name |
## Returns
**true** - Success (the file matches the pattern)
**false** - Failure (the file does not exist or the pattern does not match)
## Examples
```c
if (fmatch("file.txt", "*.txt"))
{
print("The file matches the pattern.");
}
else
{
print("The file \"file.txt\" does not exists, or pattern does not match.");
}
```
## Notes
:::warning
This function works on open.mp server but not on SA:MP server.
:::
## Related Functions
- [fopen](fopen): Open a file.
- [fclose](fclose): Close a file.
- [ftemp](ftemp): Create a temporary file stream.
- [fremove](fremove): Remove a file.
- [fwrite](fwrite): Write to a file.
- [fread](fread): Read a file.
- [fputchar](fputchar): Put a character in a file.
- [fgetchar](fgetchar): Get a character from a file.
- [fblockwrite](fblockwrite): Write blocks of data into a file.
- [fblockread](fblockread): Read blocks of data from a file.
- [fseek](fseek): Jump to a specific character in a file.
- [flength](flength): Get the file length.
- [fexist](fexist): Check, if a file exists.
- [ftell](ftell): Get the current position in the file.
- [fflush](fflush): Flush a file to disk (ensure all writes are complete).
- [fstat](fstat): Return the size and the timestamp of a file.
- [frename](frename): Rename a file.
- [fcopy](fcopy): Copy a file.
- [filecrc](filecrc): Return the 32-bit CRC value of a file.
- [diskfree](diskfree): Returns the free disk space.
- [fattrib](fattrib): Set the file attributes.
- [fcreatedir](fcreatedir): Create a directory.
| openmultiplayer/web/docs/scripting/functions/fmatch.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/fmatch.md",
"repo_id": "openmultiplayer",
"token_count": 828
} | 335 |
---
title: getpubvar
description: Gets a specific public variable from the current script.
tags: ["core", "pubvar", "public variable"]
---
<LowercaseNote />
## Description
Gets a specific public variable from the current script.
| Name | Description |
| ------------ | --------------------------- |
| const name[] | The public variable's name. |
## Returns
Naught if the variable doesn't exist (use [existpubvar](existpubvar) first).
## Related Functions
- [setpubvar](setpubvar): Sets a specific public variable in the current script.
- [existpubvar](existpubvar): Checks if a specific public variable exists in the current script.
- [numpubvars](numpubvars): Counts how many public variables there are in the script.
| openmultiplayer/web/docs/scripting/functions/getpubvar.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/getpubvar.md",
"repo_id": "openmultiplayer",
"token_count": 218
} | 336 |
---
title: setarg
description: Set an argument that was passed to a function.
tags: ["core", "arguments", "args"]
---
<LowercaseNote />
## Description
Set an argument that was passed to a function.
| Name | Description |
| ----- | ----------------------------------------------------------- |
| arg | The argument sequence number. Use 0 for the first argument. |
| index | The index (if the argument is an array) *(optional=0)* |
| value | The value to set the argument to. |
## Returns
**1** on success and **0** if the argument or the index are invalid.
## Related Functions
- [getarg](getarg): Retrieve an argument from a variable argument list.
- [numargs](numargs): Return the number of arguments.
| openmultiplayer/web/docs/scripting/functions/setarg.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/setarg.md",
"repo_id": "openmultiplayer",
"token_count": 270
} | 337 |
---
title: swapchars
description: Swap bytes in a cell.
tags: ["string"]
---
<LowercaseNote />
## Description
| Name | Description |
| ---- | -------------------------------------- |
| c | The value for which to swap the bytes. |
## Returns
A value where the bytes are swapped (the lowest byte becomes the highest byte)
| openmultiplayer/web/docs/scripting/functions/swapchars.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/swapchars.md",
"repo_id": "openmultiplayer",
"token_count": 116
} | 338 |
---
title: "Bone IDs"
---
:::note
This page contains all of the bone IDs used by [SetPlayerAttachedObject](../functions/SetPlayerAttachedObject).
:::
| ID | Bone |
| --- | ------------------------- |
| 1 | Spine |
| 2 | Head |
| 3 | Left upper arm |
| 4 | Right upper arm |
| 5 | Left hand |
| 6 | Right hand |
| 7 | Left thigh |
| 8 | Right thigh |
| 9 | Left foot |
| 10 | Right foot |
| 11 | Right calf |
| 12 | Left calf |
| 13 | Left forearm |
| 14 | Right forearm |
| 15 | Left clavicle (shoulder) |
| 16 | Right clavicle (shoulder) |
| 17 | Neck |
| 18 | Jaw |
| openmultiplayer/web/docs/scripting/resources/boneid.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/resources/boneid.md",
"repo_id": "openmultiplayer",
"token_count": 503
} | 339 |
---
title: Map Icon Styles
description: A list of Map Icons
---
:::info
This page has a list of all map icon styles which can be used by [SetPlayerMapIcon](../functions/SetPlayerMapIcon) function.
:::
| Value | Constant | Has checkpoint marker | Radar map range |
| ------ | ------------------------- | --------------------- | -------------------------------------- |
| 0 | MAPICON_LOCAL | No | Close proximity Only |
| 1 | MAPICON_GLOBAL | No | Show on radar edge as long as in range |
| 2 | MAPICON_LOCAL_CHECKPOINT | Yes | Close proximity only |
| 3 | MAPICON_GLOBAL_CHECKPOINT | Yes | Show on radar edge as long as in range |
| openmultiplayer/web/docs/scripting/resources/mapiconstyles.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/resources/mapiconstyles.md",
"repo_id": "openmultiplayer",
"token_count": 376
} | 340 |
---
title: Select Object Types
---
:::info
Here you can find all of the select object types used by [OnPlayerSelectObject](../callbacks/OnPlayerSelectObject).
:::
| Value | Definition |
| ----- | --------------------------- |
| 1 | SELECT_OBJECT_GLOBAL_OBJECT |
| 2 | SELECT_OBJECT_PLAYER_OBJECT |
| openmultiplayer/web/docs/scripting/resources/selectobjecttypes.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/resources/selectobjecttypes.md",
"repo_id": "openmultiplayer",
"token_count": 119
} | 341 |
---
title: Vehicle Light Status
description: Vehicle light status definitions.
---
:::note
These definitions are used by natives such as [GetVehicleDamageStatus](../functions/GetVehicleDamageStatus) and [UpdateVehicleDamageStatus](../functions/UpdateVehicleDamageStatus).
:::
| Definition | Value |
| ------------------------------------------------------------------------- | ----- |
| UNKNOWN_VEHICLE_LIGHT_STATUS | 0 |
| VEHICLE_LIGHT_STATUS_NONE | 0 |
| VEHICLE_LIGHT_STATUS_FRONT_LEFT_BROKEN **/** CARLIGHT_FRONT_LEFT_BROKEN | 1 |
| VEHICLE_LIGHT_STATUS_FRONT_RIGHT_BROKEN **/** CARLIGHT_FRONT_RIGHT_BROKEN | 4 |
| VEHICLE_LIGHT_STATUS_DRIVER_BROKEN **/** CARLIGHT_DRIVER_BROKEN | 1 |
| VEHICLE_LIGHT_STATUS_PASSENGER_BROKEN **/** CARLIGHT_PASSENGER_BROKEN | 4 |
| VEHICLE_LIGHT_STATUS_REAR_BROKEN **/** CARLIGHT_REAR_BROKEN | 64 |
| openmultiplayer/web/docs/scripting/resources/vehicle-light-status.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/resources/vehicle-light-status.md",
"repo_id": "openmultiplayer",
"token_count": 512
} | 342 |
---
title: "Remote Console (RCON)"
description: Remote server administation.
---
The Remote Console is a command prompt where you can use RCON commands without having to be in game and on your server. Since 0.3b the Remote Console got removed from the Server Browser. From now on you will have to use another way to access Remote RCON as explained below.
1. Open a text editor.
2. Write in the following line: `rcon.exe IP PORT RCON-PASS` (Replace IP/PORT/PASS with your server details)
3. Save the file as `rcon.bat`
4. Put the file into your GTA directory where `rcon.exe` is located.
5. Run `rcon.bat`
6. Enter the command you like.

Note: There is no need to type `/rcon` before the command in the server browser and the commands will not work if you do. For Example if you want to reset the server just type `gmx` and hit enter. That is all you need to do. Enjoy
| openmultiplayer/web/docs/server/RemoteConsole.md/0 | {
"file_path": "openmultiplayer/web/docs/server/RemoteConsole.md",
"repo_id": "openmultiplayer",
"token_count": 257
} | 343 |
---
title: OnNPCConnect
description: Ovaj callback je pozvan kada se NPC konektovao na server.
tags: ["npc"]
---
## Deskripcija
Ovaj callback je pozvan kada se NPC uspješno konektovao na server.
| Ime | Deskripcija |
| ------------ | -------------------------------------------------- |
| myplayerid | playerid koji je dodijeljen NPC-u. |
## Primjeri
```c
public OnNPCConnect(myplayerid)
{
printf("Uspješno sam se konektovao na server sa ID-em %i!", myplayerid);
}
```
## Srodne Funkcije
Slijedeći callbackovi mogu biti korisni, zato što su povezani sa ovim callback-om na neki način.
- [OnNPCDisconnect](OnNPCDisconnect): Ovaj callback je pozvan kada se NPC diskonektuje sa servera.
- [OnPlayerConnect](OnPlayerConnect): Ovaj callback je pozvan kada se igrač konektovao na server.
- [OnPlayerDisconnect](OnPlayerDisconnect): Ovaj callback je pozvan kada se igrač diskonektuje sa servera.
| openmultiplayer/web/docs/translations/bs/scripting/callbacks/OnNPCConnect.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/callbacks/OnNPCConnect.md",
"repo_id": "openmultiplayer",
"token_count": 392
} | 344 |
---
title: OnPlayerEnterVehicle
description: Ovaj callback je pozvan kada igrač krene da uđe u vozilo, u smislu da igrač nije još u vozilu u trenutku kada se ovaj callback poziva.
tags: ["player", "vehicle"]
---
## Deskripcija
Ovaj callback je pozvan kada igrač krene da uđe u vozilo, u smislu da igrač nije još u vozilu u trenutku kada se ovaj callback poziva.
| Ime | Deskripcija |
| ----------- | ---------------------------------------------- |
| playerid | ID igrača koji pokušava da uđe u vozilo. |
| vehicleid | ID vozila u kojeg igrač pokušava ući. |
| ispassenger | 0 ako ulazi kao vozač. 1 ako ulazi kao putnik. |
## Returns
Uvijek je pozvana prva u filterskripti.
## Primjeri
```c
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
new string[128];
format(string, sizeof(string), "Ulazis u vozilo ID %i", vehicleid);
SendClientMessage(playerid, 0xFFFFFFFF, string);
return 1;
}
```
## Zabilješke
:::tip
Ovaj callback je pozvana kada igrač KRENE da uđe u vozilo, ne kada su UŠLI u njega. Pogledaj `OnPlayerStateChange`. Ovaj callback se poziva i kada je igraču odbijen mogućnost ulaska u vozilo (npr. Vozilo je zaključano ili puno).
:::
## Srodne Funkcije
- [PutPlayerInVehicle](../functions/PutPlayerInVehicle.md): Postavi igrača u vozilo.
- [GetPlayerVehicleSeat](../functions/GetPlayerVehicleSeat.md): Provjeri u kojem sjedištu se nalazi igrač.
| openmultiplayer/web/docs/translations/bs/scripting/callbacks/OnPlayerEnterVehicle.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/callbacks/OnPlayerEnterVehicle.md",
"repo_id": "openmultiplayer",
"token_count": 630
} | 345 |
---
title: OnPlayerSelectedMenuRow
description: Ovaj callback je pozvan kada igrač selektuje određenu stavku (item) iz menija (ShowMenuForPlayer).
tags: ["player", "menu"]
---
## Deskripcija
Ovaj callback je pozvan kada igrač selektuje određenu stavku (item) iz menija (ShowMenuForPlayer).
| Ime | Deskripcija |
| -------- | ----------------------------------------------------- |
| playerid | ID igrača koji je selektovao stavku iz menija. |
| row | ID reda stavke koja je selektovana. Prvi red je ID 0. |
## Returns
Uvijek je pozvan prvi u gamemode-u.
## Primjeri
```c
new Menu:MyMenu;
public OnGameModeInit()
{
MyMenu = CreateMenu("Example Menu", 1, 50.0, 180.0, 200.0, 200.0);
AddMenuItem(MyMenu, 0, "Item 1");
AddMenuItem(MyMenu, 0, "Item 2");
return 1;
}
public OnPlayerSelectedMenuRow(playerid, row)
{
if (GetPlayerMenu(playerid) == MyMenu)
{
switch(row)
{
case 0: print("Item 1 Selected");
case 1: print("Item 2 Selected");
}
}
return 1;
}
```
## Zabilješke
:::tip
ID menija nije proslijeđen ovom callbacku. GetPlayerMenu se mora koristiti kako bi se odredilo na kojem meniju je igrač selektovao stavku.
:::
## Srodne Funkcije
- [CreateMenu](../functions/CreateMenu.md): Kreiraj meni.
- [DestroyMenu](../functions/DestroyMenu.md): Uništi meni.
- [AddMenuItem](../functions/AddMenuItem.md): Dodaj stavku u određeni meni.
- [ShowMenuForPlayer](../functions/ShowMenuForPlayer.md): Prikaži meni igraču.
- [HideMenuForPlayer](../functions/HideMenuForPlayer.md): Sakrij meni za igrača.
| openmultiplayer/web/docs/translations/bs/scripting/callbacks/OnPlayerSelectedMenuRow.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/callbacks/OnPlayerSelectedMenuRow.md",
"repo_id": "openmultiplayer",
"token_count": 717
} | 346 |
---
title: OnVehicleMod
description: Ovaj callback je pozvan kada vozilo biva modirano/uređeno.
tags: ["vehicle"]
---
## Deskripcija
Ovaj callback je pozvan kada vozilo biva modirano/uređeno.
| Ime | Deskripcija |
| ----------- | --------------------------------------- |
| playerid | ID vozača vozila. |
| vehicleid | ID vozila koje je modirano/uređeno. |
| componentid | ID komponente koja je dodana na vozilo. |
## Returns
Uvijek je pozvan prvo u gamemodeu tako da će return-ovanje 0 ovdje blokirati ostale skripte da ga vide.
## Primjeri
```c
public OnVehicleMod(playerid, vehicleid, componentid)
{
printf("Vehicle %d was modded by ID %d with the componentid %d",vehicleid, playerid,componentid);
if (GetPlayerInterior(playerid) == 0)
{
BanEx(playerid, "Tuning Hacks"); // Anti-tuning hacks skripta
return 0; // Sprječava sinhronizaciju loše modifikacije s drugim igračima
//Testirano i radi čak i na serverima koji vam omogućavaju modifikaciju vozila sa komandama, menijima, dijalozima, itd...
}
return 1;
}
```
## Zabilješke
:::tip
Ovaj callback neće biti pozvan od strane `AddVehicleComponent`.
:::
## Srodne Funkcije
- [AddVehicleComponent](../functions/AddVehicleComponent.md): Dodaj komponentu na vozilo.
- [OnEnterExitModShop](OnEnterExitModShop.md): Pozvano kada vozilo uđe ili izađe u mod shop.
- [OnVehiclePaintjob](OnVehiclePaintjob.md): Pozvano kada se paintjob vozila promijeni.
- [OnVehicleRespray](OnVehicleRespray.md): Pozvano kada vozilo biva respray-ovano(ponovno obojeno).
| openmultiplayer/web/docs/translations/bs/scripting/callbacks/OnVehicleMod.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/callbacks/OnVehicleMod.md",
"repo_id": "openmultiplayer",
"token_count": 701
} | 347 |
---
title: AddVehicleComponent
description: Dodaje 'komponentu' (često nazvana'mod' (modifikacija)) na vozilo.
tags: ["vehicle"]
---
## Deskripcija
Dodaje 'komponentu' (često nazvana'mod' (modifikacija)) na vozilo. Validne komponente možete pronaći ovdje.
| Ime | Deskripcija |
| --------------------------------------------- | ------------------------------------------------------------------ |
| vehicleid | ID vozila na koji dodajete komponentu. Ne miješajte ga sa modelid. |
| [componentid](../resources/carcomponentid.md) | ID komponente koju dodajete na vozilo. |
## Returns
0 - Komponenta nije dodana zato što vozilo ne postoji.
1 - Komponenta je uspješno dodana na vozilo.
## Primjeri
```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 dodan na taxi.");
}
}
return 1;
}
```
## Zabilješke
:::warning
Korištenjem nevažećeg ID-a komponente će da crashuje igraču igru. Za to ne postoje interne provjere.
:::
## Srodne Funkcije
- [RemoveVehicleComponent](RemoveVehicleComponent.md): Ukloni komponentu sa vozila.
- [GetVehicleComponentInSlot](GetVehicleComponentInSlot.md): Provjeri koje komponente vozilo ima.
- [GetVehicleComponentType](GetVehicleComponentType.md): Provjeri tip komponente preko ID-a.
- [OnVehicleMod](../callbacks/OnVehicleMod.md): Pozvano kada igrač modificira vozilo.
- [OnEnterExitModShop](../callbacks/OnEnterExitModShop.md): Pozvano kada vozilo uđe ili izađe u/iz mod shopa.
| openmultiplayer/web/docs/translations/bs/scripting/functions/AddVehicleComponent.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/AddVehicleComponent.md",
"repo_id": "openmultiplayer",
"token_count": 921
} | 348 |
---
title: Ban
description: Banuj igrača koji je trenutno na serveru.
tags: ["administration"]
---
## Description
Banuj igrača koji je trenutno na serveru. On se više nikada neće moći pridružiti serveru. Zabrana će se zasnivati na IP-u i bit će spremljena u datoteku samp.ban u korijenskom direktoriju poslužitelja. BanEx se može koristiti za obrazloženje zabrane. IP zabrane mogu se dodati / ukloniti pomoću naredbi RCON banip i unbanip (SendRconCommand).
| Name | Description |
| -------- | ---------------------------- |
| playerid | ID igrača za banovanje. |
## Returns
Ova funkcija ne returna(vraća) nikakve posebne vrijednosti.
## Examples
```c
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp(cmdtext, "/banme", true) == 0)
{
// Banuj igrača koji napiše ovu komandu.
Ban(playerid);
return 1;
}
}
// Da bi se prikazala poruka (npr. razlog) za igrača prije nego se konekcija zatvori
// morate koristiti timer kako biste stvorili mali razmak. Ovaj razmak treba da bude dug svega nekoliko milisekundi,
// ali ovaj primjer koristi punu sekundu samo da bi bio na sigurnoj strani.
forward DelayedBan(playerid);
public DelayedBan(playerid)
{
Ban(playerid);
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp(cmdtext, "/banme", true) == 0)
{
// Banuj igrača koji napiše ovu komandu.
// Prvo im pošaljite poruku
SendClientMessage(playerid, 0xFF0000FF, "Banovani ste!");
// Banujte ga za jednu sekundu.
SetTimerEx("DelayedBan", 1000, false, "d", playerid);
return 1;
}
return 0;
}
```
## Zabilješke
:::warning
Sve radnje poduzete izravno prije Ban() (poput slanja poruke pomoću SendClientMessage) neće doći do igrača. Za razmak/odgodu zabrane mora se koristiti tajmer.
:::
## Srodne Funkcije
- [BanEx](BanEx): Banujte igrača sa prilagođenim razlogom.
- [Kick](Kick): Kickujte (izbacite) igrača sa servera.
| openmultiplayer/web/docs/translations/bs/scripting/functions/Ban.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/Ban.md",
"repo_id": "openmultiplayer",
"token_count": 892
} | 349 |
---
title: CreateMenu
description: Kreiraj meni.
tags: ["menu"]
---
## Deskripcija
Kreiraj meni.
| Ime | Deskripcija |
| --------------- | ---------------------------------------------------------------------- |
| title[] | Naslov novog menija. |
| columns | Koliko kolona će novi meni imati. |
| Float:x | X pozicija menija (640x460 sučelje - 0 stavio bi meni krajnje lijevo). |
| Float:y | Y pozicija menija (640x460 sučelje - 0 stavio bi meni krajnje gore). |
| Float:col1width | Širina za prvu kolonu. |
| Float:col2width | Širina za drugu kolonu. |
## Returns
ID novog menija ili -1 ako je greška.
## Primjeri
```c
new Menu:examplemenu;
public OnGameModeInit()
{
examplemenu = CreateMenu("Tvoj meni", 2, 200.0, 100.0, 150.0, 150.0);
return 1;
}
```
## Zabilješke
:::tip
Ova funkcija samo STVARA meni - ShowMenuForPlayer mora se koristiti za prikaz. Možete stvoriti i pristupiti samo dvije kolone (0 i 1). Ako je dužina naslova jednaka ili veća od 32 znaka, naslov je skraćen na 30 znakova.
:::
:::warning
Postoji ograničenje od 12 stavki po meniju i ukupno 128 menija.
:::
## Srodne Funkcije
- [AddMenuItem](AddMenuItem): Dodaje artikal u određeni meni.
- [SetMenuColumnHeader](SetMenuColumnHeader): Postavi zaglavlje za jednu kolonu u meniju.
- [DestroyMenu](DestroyMenu): Uništi meni.
- [ShowMenuForPlayer](ShowMenuForPlayer): Prikaži meni za igrača.
- [HideMenuForPlayer](HideMenuForPlayer): Sakrij meni za igrača.
- [OnPlayerSelectedMenuRow](../callbacks/OnPlayerSelectedMenuRow): Pozvano kada igrač odabere red u meniju.
- [OnPlayerExitedMenu](../callbacks/OnPlayerExitedMenu): Pozvano kada igrač napusti meni.
| openmultiplayer/web/docs/translations/bs/scripting/functions/CreateMenu.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/CreateMenu.md",
"repo_id": "openmultiplayer",
"token_count": 956
} | 350 |
---
title: DestroyVehicle
description: Uništi vozilo.
tags: ["vehicle"]
---
## Deskripcija
Uništi vozilo. Istog će trena nestati.
| Ime | Deskripcija |
| --------- | ---------------------- |
| vehicleid | ID vozila za uništiti |
## Returns
1: Funkcija uspješno izvršena.
0: Funkcija neuspješno izvršena. Vozilo ne postoji.
## Primjeri
```c
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp(cmdtext, "/destroyveh", true) == 0)
{
new vehicleid = GetPlayerVehicleID(playerid);
DestroyVehicle(vehicleid);
return 1;
}
return 0;
}
```
## Srodne Funkcije
- [CreateVehicle](CreateVehicle): Kreiraj vozilo.
- [RemovePlayerFromVehicle](RemovePlayerFromVehicle): Izbaci igrača iz njegovog vozila.
- [SetVehicleToRespawn](SetVehicleToRespawn): Respawnuj vozilo.
| openmultiplayer/web/docs/translations/bs/scripting/functions/DestroyVehicle.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/DestroyVehicle.md",
"repo_id": "openmultiplayer",
"token_count": 369
} | 351 |
---
title: EnableVehicleFriendlyFire
description: Omogućite "friendly-fire" za timska vozila.
tags: ["vehicle"]
---
## Deskripcija
Omogućite "friendly-fire" za timska vozila. Igrači neće moći oštetiti vozila suigrača (mora se koristiti SetPlayerTeam!).
## Primjeri
```c
public OnGameModeInit()
{
EnableVehicleFriendlyFire();
return 1;
}
```
## Srodne Funkcije
- [SetPlayerTeam](SetPlayerTeam): Postavi tim igrača.
| openmultiplayer/web/docs/translations/bs/scripting/functions/EnableVehicleFriendlyFire.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/EnableVehicleFriendlyFire.md",
"repo_id": "openmultiplayer",
"token_count": 178
} | 352 |
---
title: GangZoneStopFlashForAll
description: Zaustavlja treptanje gangzone za sve igrače.
tags: ["gangzone"]
---
## Deskripcija
Zaustavlja treptanje gangzone za sve igrače.
| Ime | Deskripcija |
| ---- | -------------------------------------------------------------------- |
| zone | ID zone za prestati treptati. Returnovana/vraćena od GangZoneCreate. |
## Returns
1: Funkcija uspješno izvršena. Izvještava se o uspjehu čak i ako zona bandi za početak nije treptala.
0: Funkcija neuspješno izvršena. Navedeni gangzone ne postoji.
## Primjeri
```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;
}
```
## Srodne Funkcije
- [GangZoneCreate](GangZoneCreate): Kreiraj gangzonu.
- [GangZoneDestroy](GangZoneDestroy): Uništi gang zonu.
- [GangZoneShowForPlayer](GangZoneShowForPlayer): Prikaži gang zonu za igrača.
- [GangZoneShowForAll](GangZoneShowForAll): Prikaži gang zonu za sve igrače.
- [GangZoneHideForPlayer](GangZoneHideForPlayer): Sakrij gangzonu za igrača.
- [GangZoneHideForAll](GangZoneHideForAll): Sakrij gangzonu za sve igrače.
- [GangZoneFlashForPlayer](GangZoneFlashForPlayer): Kreiraj bljeskalicu gang zone za igrača.
- [GangZoneFlashForAll](GangZoneFlashForAll): Kreiraj bljeskalicu gang zone za sve igrače.
- [GangZoneStopFlashForPlayer](GangZoneStopFlashForPlayer): Zaustavi gang zonu da bljeska za igrača.
| openmultiplayer/web/docs/translations/bs/scripting/functions/GangZoneStopFlashForAll.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/GangZoneStopFlashForAll.md",
"repo_id": "openmultiplayer",
"token_count": 718
} | 353 |
---
title: GetObjectModel
description: Dobij ID modela određenog objekta (CreateObject).
tags: []
---
<VersionWarn version='SA-MP 0.3.7' />
## Deskripcija
Dobij ID modela određenog objekta (CreateObject).
| Ime | Deskripcija |
| -------- | ---------------------------------------- |
| objectid | ID objekta za dobivanje modela |
## Returns
Model ID određenog objekta. -1 ako objekt ne postoji.
## Primjeri
```c
new objectid = CreateObject(1234, 0, 0, 0, 0, 0, 0);
new modelid = GetObjectModel(objectid);
```
## Srodne Funkcije
- [GetPlayerObjectModel](GetPlayerObjectModel): Dobij ID modela odeđenog player-objekta.
| openmultiplayer/web/docs/translations/bs/scripting/functions/GetObjectModel.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/GetObjectModel.md",
"repo_id": "openmultiplayer",
"token_count": 279
} | 354 |
---
title: GetPlayerTeam
description: Dobij ID tima u kojem je igrač.
tags: ["player"]
---
## Deskripcija
Dobij ID tima u kojem je igrač.
| Ime | Deskripcija |
| -------- | ------------------------ |
| playerid | ID igrača za dobiti tim. |
## Returns
0-254: Tim igrača. (0 je važeći tim)
255: Definisano kao NO_TEAM. Igrač nije u timu.
-1: Funkcija neuspješno izvršena. Igrač nije konektovan.
## Primjeri
```c
enum
{
TEAM_ONE = 1,
TEAM_TWO
};
public OnPlayerSpawn(playerid)
{
// Igrači koji su u timu 1 će se spawnovati u LV Airportu
if (GetPlayerTeam(playerid) == TEAM_ONE)
{
SetPlayerPos(playerid, 1667.8909, 1405.5618, 10.7801);
}
return 1;
}
```
## Srodne Funkcije
- [SetPlayerTeam](SetPlayerTeam): Postavi tim igrača.
- [SetTeamCount](SetTeamCount): Postavi broj dostupnih timova.
| openmultiplayer/web/docs/translations/bs/scripting/functions/GetPlayerTeam.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/GetPlayerTeam.md",
"repo_id": "openmultiplayer",
"token_count": 389
} | 355 |
---
title: GetSVarsUpperIndex
description: Svaki SVar (server-varijabla) ima svoj jedinstveni identifikacijski broj za traženje, ova funkcija vraća najveći ID.
tags: []
---
## Deskripcija
Svaki SVar (server-varijabla) ima svoj jedinstveni identifikacijski broj za traženje, ova funkcija vraća najveći ID.
## Primjeri
```c
// Pohrani gornji index u varijablu 'SVarUpperIndex' + 1
new SVarUpperIndex = GetSVarsUpperIndex() + 1;
// Ova sVarCount varijabla će pohraniti koliko sVar-ova je postavljeno pa ih brojimo.
new sVarCount;
for(new i=0; i != sVarUpperIndex; i++) // Loop through all sVar IDs under the upper index
{
// Prvo, trebamo dobiti ime SVar-a
new sVarName[128];
GetSVarNameAtIndex(i, pVarName, sizeof(pVarName));
// ako je SVar postavljen (tip nije 0), prirasti sVarCount.
if (GetSVarType(pVarName) != 0)
{
sVarCount ++;
}
}
new szString[66];
printf(%i server varijabli je postavljeno. Gornji index (najveći ID): %i.", sVarCount, SVarUpperIndex-1);
```
## Srodne Funkcije
- [GetSVarNameAtIndex](GetSVarNameAtIndex): Dobij ime server varijable iz njenog indexa.
- [GetSVarType](GetSVarType): Dobij tip server varijable.
| openmultiplayer/web/docs/translations/bs/scripting/functions/GetSVarsUpperIndex.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/GetSVarsUpperIndex.md",
"repo_id": "openmultiplayer",
"token_count": 513
} | 356 |
---
title: GetVehicleParamsSirenState
description: Vraća stanje sirene vozila (upaljena/ugašena).
tags: ["vehicle"]
---
:::warning
Ova funkcija je dodana u SA-MP 0.3.7 i ne radi u nižim verzijama!
:::
## Deskripcija
Vraća stanje sirene vozila (upaljena/ugašena).
| Ime | Deskripcija |
| --------- | ---------------------------------- |
| vehicleid | ID vozila za dobiti stanje sirene. |
## Returns
-1: Sirena za vozilo još nije postavljena (off/ugašena)
0: Sirena vozila ugašena
1: Sirena vozila upaljena
## Primjeri
```c
new
siren = GetVehicleParamsSirenState(vehicleid);
if (siren == 1)
{
// Sirena je upaljena, radi nešto
}
else if (siren == 0)
{
// Sirena je ugašena, radi nešto
}
else
{
// Vozilo nema sirenu
}
```
## Zabilješke
:::warning
Budući da stanje sirene -1 ili 0 znači 'isključeno', ne možete koristiti logičku uvjetnu naredbu da provjerite jesu li sirene uključene. Ako napravite 'if (sirenstate)', to će važiti za sve što NIJE 0 (dakle -1 ili 1). Trebali biste provjeriti je li stanje sirene izričito jednako 1.
:::
## Srodne Funkcije
| openmultiplayer/web/docs/translations/bs/scripting/functions/GetVehicleParamsSirenState.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/GetVehicleParamsSirenState.md",
"repo_id": "openmultiplayer",
"token_count": 531
} | 357 |
---
title: IsActorStreamedIn
description: Provjerava da li je aktor učitan kod igrača.
tags: []
---
:::warning
Ova funkcija je dodana u SA-MP 0.3.7 i ne radi u nižim verzijama!
:::
## Deskripcija
Provjerava da li je aktor učitan kod igrača.
| Ime | Deskripcija |
| ----------- | ----------- |
| actorid | ID aktora. |
| forplayerid | ID igrača. |
## Returns
Ova funkcija vraća 1 ako je aktor učitan kod igrača ili 0 ako nije.
## Primjeri
```c
new gMyActor;
public OnGameModeInit()
{
gMyActor = CreateActor(...);
return 1;
}
public OnPlayerSpawn(playerid)
{
if (IsActorStreamedIn(gMyActor, playerid))
{
// Radi nešto
}
}
```
## Srodne Funkcije
- [CreateActor](CreateActor): Kreiraj aktora (statičnog NPC-a).
- [IsPlayerStreamedIn](IsPlayerStreamedIn): Provjerava da li je igrač učitan kod drugog igrača.
| openmultiplayer/web/docs/translations/bs/scripting/functions/IsActorStreamedIn.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/IsActorStreamedIn.md",
"repo_id": "openmultiplayer",
"token_count": 377
} | 358 |
---
title: IsTrailerAttachedToVehicle
description: Provjerava ako vozilo ima prikvačenu prikolicu za sebe.
tags: ["vehicle"]
---
## Deskripcija
Provjerava ako vozilo ima prikvačenu prikolicu za sebe. Koristi GetVehicleTrailer da dobiješ ID vozila prikolice (ako ima).
| Ime | Deskripcija |
| --------- | ----------------------------------------- |
| vehicleid | ID vozila za provjeriti ima li prikolicu. |
## Returns
1: Vozilo ima prikvačenu prikolicu.
0: Vozilo nema prikvačenu prikolicu.
## Primjeri
```c
if (IsTrailerAttachedToVehicle(vehicleid))
{
printf("Vozilo %i ima prikolicu!", vehicleid);
}
```
## Srodne Funkcije
- [GetVehicleTrailer](GetVehicleTrailer): Provjeri koju prikolicu vozilo vuče.
- [AttachTrailerToVehicle](AttachTrailerToVehicle): Prikvači prikolicu za vozilo.
- [DetachTrailerFromVehicle](DetachTrailerFromVehicle): Odvojite prikolicu od vozila.
| openmultiplayer/web/docs/translations/bs/scripting/functions/IsTrailerAttachedToVehicle.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/IsTrailerAttachedToVehicle.md",
"repo_id": "openmultiplayer",
"token_count": 394
} | 359 |
---
title: NetStats_BytesSent
description: Dobija količinu podataka (u bajtovima) koju je server poslao klijentu za reprodukciju.
tags: []
---
## Deskripcija
Dobija količinu podataka (u bajtovima) koju je server poslao klijentu za reprodukciju.
| Ime | Deskripcija |
| -------- | ---------------------------- |
| playerid | ID igrača za dobiti podatke. |
## Returns
Returna/vraća količinu navedenih podataka.
## Primjeri
```c
public OnPlayerCommandText(playerid,cmdtext[])
{
if (!strcmp(cmdtext, "/bytes_sent"))
{
new szString[144];
format(szString, sizeof(szString), "Poslao si %i bajtova informacija serveru.", NetStats_BytesSent(playerid));
SendClientMessage(playerid, -1, szString);
}
return 1;
}
```
## Srodne Funkcije
- [GetPlayerNetworkStats](GetPlayerNetworkStats): Dobija mrežne statistike igrača i pohranjuje ih u string.
- [GetNetworkStats](GetNetworkStats): Dobija mrežne statistike servera i sprema ih u string.
- [NetStats_GetConnectedTime](NetStats_GetConnectedTime): Dobij vrijeme za kojeg je igrač povezan na server.
- [NetStats_MessagesReceived](NetStats_MessagesReceived): Dohvatite broj mrežnih poruka koje je server primio od igrača.
- [NetStats_MessagesSent](NetStats_MessagesSent): Dohvatite broj mrežnih poruka koje je server poslao igraču.
- [NetStats_BytesReceived](NetStats_BytesReceived): Dohvatite količinu informacija (u bajtovima) koju je poslužitelj primio od igrača.
- [NetStats_MessagesRecvPerSecond](NetStats_MessagesRecvPerSecond): Dohvatite broj mrežnih poruka koje je poslužitelj primio od igrača u posljednjoj sekundi.
- [NetStats_PacketLossPercent](NetStats_PacketLossPercent): Dobijte packet loss procenat igrača.
- [NetStats_ConnectionStatus](NetStats_ConnectionStatus): Dohvatite status veze igrača.
- [NetStats_GetIpPort](NetStats_GetIpPort): Nabavite IP adresu i port igrača.
| openmultiplayer/web/docs/translations/bs/scripting/functions/NetStats_BytesSent.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/NetStats_BytesSent.md",
"repo_id": "openmultiplayer",
"token_count": 763
} | 360 |
---
title: PlayerTextDrawColor
description: Postavlja boju teksta player-textdrawa.
tags: ["player", "textdraw", "playertextdraw"]
---
## Deskripcija
Postavlja boju teksta player-textdrawa.
| Ime | Deskripcija |
| -------- | -------------------------------------------- |
| playerid | ID igrača čijem će se boja teksta postaviti. |
| text | TextDraw za izmijeniti. |
| color | Boja u hexadecimalnom formatu. |
## Returns
Ova funkcija ne returna (vraća) nikakve posebne vrijednosti.
## Primjeri
```c
new PlayerText:pTextdraw[MAX_PLAYERS];
public OnPlayerConnect(playerid)
{
pTextdraw[playerid] = CreatePlayerTextDraw(playerid, x, y, "...");
PlayerTextDrawColor(playerid, pTextdraw[playerid], 0xFF0000FF); // Crveni text
PlayerTextDrawShow(playerid, pTextdraw[playerid]);
return 1;
}
```
## Zabilješke
:::tip
Boje Gametext-a možete koristiti i u textdrawu. Textdraw mora se ponovo prikazati za igrača kako bi se ažurirala boja.
:::
## Srodne Funkcije
- [CreatePlayerTextDraw](CreatePlayerTextDraw): Kreiraj player-textdraw.
- [PlayerTextDrawDestroy](PlayerTextDrawDestroy): Uništi player-textdraw.
- [PlayerTextDrawBoxColor](PlayerTextDrawBoxColor): Postavi boju box-a od player-textdrawa.
- [PlayerTextDrawBackgroundColor](PlayerTextDrawBackgroundColor): Postavi boju pozadine player-textdrawa.
- [PlayerTextDrawAlignment](PlayerTextDrawAlignment): Postavi poravnanje player-textdrawa.
- [PlayerTextDrawFont](PlayerTextDrawFont): Postavi font player-textdrawa.
- [PlayerTextDrawLetterSize](PlayerTextDrawLetterSize): Postavi veličinu slova u tekstu player-textdrawa.
- [PlayerTextDrawTextSize](PlayerTextDrawTextSize): Postavi veličinu box-a player-textdrawa (ili dijela koji reaguje na klik za PlayerTextDrawSetSelectable).
- [PlayerTextDrawSetOutline](PlayerTextDrawSetOutline): Omogući/onemogući korišćenje outline-a za player-textdraw.
- [PlayerTextDrawSetShadow](PlayerTextDrawSetShadow): Postavi sjenu na player-textdraw.
- [PlayerTextDrawSetProportional](PlayerTextDrawSetProportional): Razmjeri razmak teksta u player-textdrawu na proporcionalni omjer.
- [PlayerTextDrawUseBox](PlayerTextDrawUseBox): Omogući/onemogući korišćenje box-a za player-textdraw.
- [PlayerTextDrawSetString](PlayerTextDrawSetString): Postavi tekst player-textdrawa.
- [PlayerTextDrawShow](PlayerTextDrawShow): Prikaži player-textdraw.
- [PlayerTextDrawHide](PlayerTextDrawHide): Sakrij player-textdraw.
| openmultiplayer/web/docs/translations/bs/scripting/functions/PlayerTextDrawColor.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/PlayerTextDrawColor.md",
"repo_id": "openmultiplayer",
"token_count": 933
} | 361 |
---
title: PutPlayerInVehicle
description: Stavlja igrača u vozilo.
tags: ["player", "vehicle"]
---
## Deskripcija
Stavlja igrača u vozilo.
| Ime | Deskripcija |
| --------- | ---------------------------------------- |
| playerid | ID igrača za ubaciti u vozilo. |
| vehicleid | ID vozila u koje treba ubaciti igrača. |
| seatid | ID sjedišta u koje treba ubaciti igrača. |
## Returns
1: Funkcija uspješno izvršena.
0: Funkcija neuspješno izvršena. Igrač ili vozilo ne postoje.
## Primjeri
```c
public OnPlayerEnterVehicle(playerid, vehicleid, ispassanger)
{
PutPlayerInVehicle(playerid, vehicleid, 0);
return 1;
}
```
```p
0 - Vozač
1 - Suvozač
2 - Lijevi-pozadi
3 - Desni-pozadi
4+ - Putnička sjedala (kauč i sl.)
```
## Zabilješke
:::tip
Možete koristiti GetPlayerVehicleSeat u petlji kako biste provjerili da li neko mjesto zauzima bilo koji igrač.
:::
:::warning
Ako je sedište neispravno ili je zauzeto, izazvat će crash kada IZLAZE iz vozila.
:::
## Srodne Funkcije
- [RemovePlayerFromVehicle](RemovePlayerFromVehicle): Izbaci igrača iz njegovog vozila.
- [GetPlayerVehicleID](GetPlayerVehicleID): Dobij ID vozila u kojem je igrač trenutno.
- [GetPlayerVehicleSeat](GetPlayerVehicleSeat): Provjeri u kojem je igrač sjedištu.
- [OnPlayerEnterVehicle](../callbacks/OnPlayerEnterVehicle): Pozvano kada igrač počne da ulazi u vozilo.
| openmultiplayer/web/docs/translations/bs/scripting/functions/PutPlayerInVehicle.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/PutPlayerInVehicle.md",
"repo_id": "openmultiplayer",
"token_count": 640
} | 362 |
---
title: SendDeathMessageToPlayer
description: Dodaje smrt 'killfeedu' s desne strane ekrana za jednog igrača.
tags: ["player"]
---
:::warning
Ova funkcija je dodana u SA-MP 0.3.z R2-2 i ne radi u nižim verzijama!
:::
## Deskripcija
Dodaje smrt 'killfeedu' s desne strane ekrana za jednog igrača.
| Ime | Deskripcija |
| -------- | --------------------------------------------------------------------------------------------------------------------- |
| playerid | ID igrača za poslati smrt killfeedu. |
| killer | ID ubice (može biti INVALID_PLAYER_ID). |
| killee | ID igrača koji je umro. |
| weapon | Razlog (ne uvijek oružje) smrti žrtve. Specijalne se ikonice također mogu koristiti (ICON_CONNECT i ICON_DISCONNECT). |
## Returns
1: Funkcija uspješno izvršena.
0: Funkcija neuspješno izvršena.
## Primjeri
```c
public OnPlayerDeath(playerid, killerid, WEAPON:reason)
{
// Pošalji smrtnu poruku "playerid" prikazuje da je "killerid" ubio "playerid" zbog "reason"
SendDeathMessageToPlayer(playerid, killerid, playerid, reason);
return 1;
}
```
## Srodne Funkcije
- [SendDeathMessage](SendDeathMessage): Dodaj ubistvo na listu smrti.
- [OnPlayerDeath](../callbacks/OnPlayerDeath): Pozvano kada igrač umre.
| openmultiplayer/web/docs/translations/bs/scripting/functions/SendDeathMessageToPlayer.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/SendDeathMessageToPlayer.md",
"repo_id": "openmultiplayer",
"token_count": 854
} | 363 |
---
title: SetObjectMaterialText
description: Zamijeni teksturu objekta sa tekstom.
tags: []
---
## Deskripcija
Zamijeni teksturu objekta sa tekstom.
| Ime | Deskripcija |
| ------------- | ----------------------------------------------------------------------------------------------------- |
| objectid | ID objekta za zamijeniti sa texturam sa tekstom. |
| text | Tekst za prikazati na objektu. (MAX 2048 karaktera) |
| materialindex | Index materijala objekta za zamijeniti sa tekstom. |
| materialsize | [Veličina](/docs/scripting/resources/materialtextsizes) materijala. |
| fontface | Font za koristiti. |
| fontsize | Veličina teksta (MAX 255). |
| bold | Bold text. Postavi na 1 za bold (deblji font), 0 za ne. |
| fontcolor | Boja teksta, u ARGB formatu. |
| backcolor | Boja pozadine, u ARGB formatu. |
| textalignment | [Poravnanje](/docs/scripting/resources/materialtextalignment) teksta (po zadanim postavkama: lijevo). |
## Returns
1: Funkcija uspješno izvršena.
0: Funkcija neuspješno izvršena.
## Primjeri
```c
if (strcmp("/text", cmdtext, true) == 0)
{
new objectId = CreateObject(19353, 0, 0, 10, 0.0, 0.0, 90.0); // kreiraj objekat
SetObjectMaterialText(objectId, "SA-MP {FFFFFF}0.3{008500}e {FF8200}RC7", 0, OBJECT_MATERIAL_SIZE_256x128,
"Arial", 28, 0, 0xFFFF8200, 0xFF000000, OBJECT_MATERIAL_TEXT_ALIGN_CENTER);
// napiši "SA-MP 0.3e RC7" na objekat, sa narandžastom bojom fonta i crnom pozadinom
return 1;
}
```
## Zabilješke
:::tip
Ugradnja boja može se koristiti za više boja u tekstu.
:::
:::warning
MORAŠ koristiti ARGB format boje, ne RGBA kao što se koristi u klijent porukama i sl.
:::
## Srodne Funkcije
- [SetPlayerObjectMaterialText](SetPlayerObjectMaterialText): Zamijeni teksturu player objekta sa tekstom.
- [SetObjectMaterial](SetObjectMaterial): Zamijeni teksturu objekta sa teksturom drugog modela iz igre.
## Filterskripte koje podržavaju teksturisanje/text
- Ultimate Creator od Nexius
- Texture Studio od \[uL\]Pottus
- Fusez's Map Editor od RedFusion
| openmultiplayer/web/docs/translations/bs/scripting/functions/SetObjectMaterialText.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/SetObjectMaterialText.md",
"repo_id": "openmultiplayer",
"token_count": 1494
} | 364 |
---
title: SetPlayerCheckpoint
description: Postavi checkpoint (crveni cilindar) za igrača.
tags: ["player", "checkpoint"]
---
## Deskripcija
Postavi checkpoint (crveni cilindar) za igrača. Također prikazuje crvenu bljeskalicu na radaru/mapi. Kada igrač uđe u checkpoint, poziva se OnPlayerEnterCheckpoint i određene akcije se mogu izvršiti.
| Ime | Deskripcija |
| ---------- | ------------------------------------ |
| playerid | ID igrača za postaviti checkpoint. |
| Float:x | X kordinata za postaviti checkpoint. |
| Float:y | Y kordinata za postaviti checkpoint. |
| Float:z | Z kordinata za postaviti checkpoint. |
| Float:size | Veličina checkpointa. |
## Returns
1: Funkcija uspješno izvršena.
0: Funkcija neuspješno izvršena. Ovo znači da navedeni igrač ne postoji.
## Primjeri
```c
// U ovom primjeru igračev checkpoint će se postaviti kada se igrač spawnuje.
// Prilikom ulaska u checkpoint dobiti će $1000 i checkpoint će se ugasiti.
new bool: gOnCheck[MAX_PLAYERS];
public OnPlayerSpawn(playerid)
{
SetPlayerCheckpoint(playerid, 1982.6150, -220.6680, -0.2432, 3.0);
gOnCheck[playerid] = true;
return 1;
}
public OnPlayerEnterCheckpoint(playerid)
{
if (gOnCheck[playerid]) // ake je true/tačno
{
GivePlayerMoney(playerid, 1000);
DisablePlayerCheckpoint(playerid);
gOnCheck[playerid] = false;
}
return 1;
}
```
## Zabilješke
:::warning
Checkpointi su asinhroni, što znači da se odjednom može prikazivati samo jedan. Za 'streamanje' checkpointa (pokažite ih samo kada su igrači dovoljno blizu), upotrijebite streamer za provjeru checkpointa.
:::
## Srodne Funkcije
- [DisablePlayerCheckpoint](DisablePlayerCheckpoint): Onemogući igračev trenutni checkpoint.
- [IsPlayerInCheckpoint](IsPlayerInCheckpoint): Provjeri da li je igrač u checkpointu.
- [SetPlayerRaceCheckpoint](SetPlayerRaceCheckpoint): Kreiraj race checkpoint za igrača.
- [DisablePlayerRaceCheckpoint](DisablePlayerRaceCheckpoint): Onemogući igračev trenutni race checkpoint.
- [IsPlayerInRaceCheckpoint](IsPlayerInRaceCheckpoint): Provjeri da li je igrač u race checkpointu.
- [OnPlayerEnterCheckpoint](../callbacks/OnPlayerEnterCheckpoint): Pozvano kada igrač uđe u checkpoint.
- [OnPlayerLeaveCheckpoint](../callbacks/OnPlayerLeaveCheckpoint): Pozvano kada igrač napusti checkpoint.
- [OnPlayerEnterRaceCheckpoint](../callbacks/OnPlayerEnterRaceCheckpoint): Pozvano kada igrač uđe u race checkpoint.
- [OnPlayerLeaveRaceCheckpoint](../callbacks/OnPlayerLeaveRaceCheckpoint): Pozvano kada igrač napusti race checkpoint.
| openmultiplayer/web/docs/translations/bs/scripting/functions/SetPlayerCheckpoint.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/SetPlayerCheckpoint.md",
"repo_id": "openmultiplayer",
"token_count": 1028
} | 365 |
---
title: SetPlayerObjectRot
description: Postavi rotaciju player objekta na X, Y i Z osi.
tags: ["player"]
---
## Deskripcija
Postavi rotaciju player objekta na X, Y i Z osi.
| Ime | Deskripcija |
| ---------- | ------------------------------------------------ |
| playerid | ID igrača čiji se player objekat treba rotirati. |
| objectid | ID player-objekta za rotirati. |
| Float:RotX | X rotacija za postaviti. |
| Float:RotY | Y rotacija za postaviti. |
| Float:RotZ | Z rotacija za postaviti. |
## Returns
1: Funkcija uspješno izvršena.
0: Funkcija neuspješno izvršena.
## Primjeri
```c
SetPlayerObjectRot(playerid, objectid, RotX, RotY, RotZ);
```
## Zabilješke
:::tip
Da glatko rotirate objekat, pogledaj [MovePlayerObject](MovePlayerObject).
:::
## Srodne Funkcije
- [CreatePlayerObject](CreatePlayerObject): Kreiraj objekat za samo jednog igrača.
- [DestroyPlayerObject](DestroyPlayerObject): Uništi player objekat.
- [IsValidPlayerObject](IsValidPlayerObject): Provjeri da li je određeni player objekat validan.
- [MovePlayerObject](MovePlayerObject): Pomjeri player objekat.
- [StopPlayerObject](StopPlayerObject): Zaustavi player objekat od kretanja.
- [SetPlayerObjectPos](SetPlayerObjectPos): Postavi poziciju player objekta.
- [GetPlayerObjectPos](GetPlayerObjectPos): Lociraj player objekat.
- [GetPlayerObjectRot](GetPlayerObjectRot): Provjeri rotaciju player objekta.
- [AttachPlayerObjectToPlayer](AttachPlayerObjectToPlayer): Prikvači player objekat za igrača.
- [CreateObject](CreateObject): Kreiraj objekat.
- [DestroyObject](DestroyObject): Uništi objekat.
- [IsValidObject](IsValidObject): Provjeri da li je određeni objekat validan.
- [MoveObject](MoveObject): Pomjeri objekat.
- [StopObject](StopObject): Zaustavi objekat od kretanja.
- [SetObjectPos](SetObjectPos): Postavi poziciju objekta.
- [SetObjectRot](SetObjectRot): Postavi rotaciju objekta.
- [GetObjectPos](GetObjectPos): Lociraj objekat.
- [GetObjectRot](GetObjectRot): Provjeri rotaciju objekta.
- [AttachObjectToPlayer](AttachObjectToPlayer): Prikvači objekat za igrača.
| openmultiplayer/web/docs/translations/bs/scripting/functions/SetPlayerObjectRot.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/SetPlayerObjectRot.md",
"repo_id": "openmultiplayer",
"token_count": 882
} | 366 |
---
title: SetSVarFloat
description: Postavi float server varijablu.
tags: []
---
:::warning
Ova funkcija je dodana u SA-MP 0.3.7 R2 i ne radi u nižim verzijama!
:::
## Deskripcija
Postavi float server varijablu.
| Ime | Deskripcija |
| ----------- | --------------------- |
| varname[] | Ime server varijable. |
| float_value | Float za postaviti. |
## Returns
1: Funkcija uspješno izvršena.
0: Funkcija neuspješno izvršena. Ime varijable je prazno ili je preko 40 karaktera.
## Primjeri
```c
// postavi "Version"
SetSVarFloat("Version", 0.37);
// ispisati će verziju koju server ima
printf("Version: %f", GetSVarFloat("Version"));
```
## Srodne Funkcije
- [SetSVarInt](SetSVarInt): Postavite cijeli broj za varijablu servera.
- [GetSVarInt](GetSVarInt): Dobij cjelobrojnu vrijednost server varijable.
- [SetSVarString](SetSVarString): Postavite string za server varijablu.
- [GetSVarString](GetSVarString): Dobij prethodno postavljeni string iz server varijable.
- [GetSVarFloat](GetSVarFloat): Dobij prethodno postavljeni float iz server varijable.
- [DeleteSVar](DeleteSVar): Obriši server varijablu.
| openmultiplayer/web/docs/translations/bs/scripting/functions/SetSVarFloat.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/SetSVarFloat.md",
"repo_id": "openmultiplayer",
"token_count": 467
} | 367 |
---
title: SetVehicleVelocity
description: Postavlja X, Y i Z brzinu vozila.
tags: ["vehicle"]
---
## Deskripcija
Postavlja X, Y i Z brzinu vozila.
| Ime | Deskripcija |
| --------- | ------------------------------ |
| vehicleid | ID vozila za postaviti brzinu. |
| Float:X | Brzina u X smjeru. |
| Float:Y | Brzina u Y smjeru. |
| Float:Z | Brzina u Z smjeru. |
## Returns
1: Funkcija uspješno izvršena.
0: Funkcija neuspješno izvršena. Vozilo ne postoji.
## Primjeri
```c
public OnPlayerCommandText(playerid, cmdtext[])
{
if (!strcmp("/jump", cmdtext))
{
if (IsPlayerInAnyVehicle(playerid))
{
SetVehicleVelocity(GetPlayerVehicleID(playerid), 0.0, 0.0, 0.2);
}
return 1;
}
}
```
## Zabilješke
:::warning
Ova funkcija ne utječe na vozila koja nisu zauzeta i ne utječe na vlakove.
:::
## Srodne Funkcije
| openmultiplayer/web/docs/translations/bs/scripting/functions/SetVehicleVelocity.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/SetVehicleVelocity.md",
"repo_id": "openmultiplayer",
"token_count": 469
} | 368 |
---
title: StopPlayerObject
description: Zaustavi player-object koji se kreće nakon što se MovePlayerObject koristio.
tags: ["player"]
---
## Deskripcija
Zaustavi player-object koji se kreće nakon što se MovePlayerObject koristio.
| Ime | Deskripcija |
| -------- | ---------------------------------------------- |
| playerid | ID igrača čiji player-object treba zaustaviti. |
| objectid | ID player-object-a za zaustaviti. |
## Returns
Ova funkcija ne returna (vraća) nikakve posebne vrijednosti.
## Primjeri
```c
StopPlayerObject(playerid, objectid);
```
## Srodne Funkcije
- [MovePlayerObject](MovePlayerObject): Pomjeri player objekat.
- [CreatePlayerObject](CreatePlayerObject): Kreiraj objekat za samo jednog igrača.
- [DestroyPlayerObject](DestroyPlayerObject): Uništi player objekat.
- [IsValidPlayerObject](IsValidPlayerObject): Provjeri da li je određeni player objekat validan.
- [IsPlayerObjectMoving](IsPlayerObjectMoving): Provjeri da li se player objekat kreće.
- [SetPlayerObjectPos](SetPlayerObjectPos): Postavi poziciju player objekta.
- [SetPlayerObjectRot](SetPlayerObjectRot): Postavi rotaciju player objekta.
- [GetPlayerObjectPos](GetPlayerObjectPos): Lociraj player objekat.
- [GetPlayerObjectRot](GetPlayerObjectRot): Provjeri rotaciju player objekta.
- [AttachPlayerObjectToPlayer](AttachPlayerObjectToPlayer): Prikvači player objekat za igrača.
- [CreateObject](CreateObject): Kreiraj objekat.
- [DestroyObject](DestroyObject): Uništi objekat.
- [IsValidObject](IsValidObject): Provjeri da li je određeni objekat validan.
- [MoveObject](MoveObject): Pomjeri objekat.
- [IsObjectMoving](IsObjectMoving): Provjeri da li se objekat kreće.
- [StopObject](StopObject): Zaustavi objekat od kretanja.
- [SetObjectPos](SetObjectPos): Postavi poziciju objekta.
- [SetObjectRot](SetObjectRot): Postavi rotaciju objekta.
- [GetObjectPos](GetObjectPos): Lociraj objekat.
- [GetObjectRot](GetObjectRot): Provjeri rotaciju objekta.
- [AttachObjectToPlayer](AttachObjectToPlayer): Prikvači objekat za igrača.
| openmultiplayer/web/docs/translations/bs/scripting/functions/StopPlayerObject.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/StopPlayerObject.md",
"repo_id": "openmultiplayer",
"token_count": 757
} | 369 |
---
title: TextDrawSetProportional
description: Prilagođava razmak između teksta proporcionalnom omjeru.
tags: ["textdraw"]
---
## Deskripcija
Prilagođava razmak između teksta proporcionalnom omjeru. Korisno kada se koristi TextDrawLetterSize kako bi se osiguralo da tekst ima ravnomjeran razmak između znakova.
| Ime | Deskripcija |
| ---- | -------------------------------------------------- |
| text | ID textdrawa za postaviti proporcionalnost. |
| set | 1 za omogućiti proporcionalnost, 0 za onemogućiti. |
## Returns
Ova funkcija ne returna (vraća) nikakve posebne vrijednosti.
## Primjeri
```c
new Text: gMyTextdraw;
public OnGameModeInit()
{
gMyTextdraw = TextDrawCreate(100.0, 33.0,"Primjer Textdrawa");
TextDrawSetProportional(gMyTextdraw, 1);
return 1;
}
```
## Zabilješke
:::tip
Proporcionalnost je po zadanim postavkama postavljena na 1, mogli biste preskočiti ovu funkciju ako ne želite da je onemogućite. Ukoliko želite promijeniti proporcionalnost textdrawa koji je već prikazan, ne morate ga ponovno kreirati. Prosto koristite TextDrawShowForPlayer/TextDrawShowForAll nakon uređivanja i promjena će biti vidljiva.
:::
## Srodne Funkcije
- [TextDrawCreate](TextDrawCreate): Kreiraj textdraw.
- [TextDrawDestroy](TextDrawDestroy): Uništi textdraw.
- [TextDrawColor](TextDrawColor): Postavi boju teksta u textdrawu.
- [TextDrawBoxColor](TextDrawBoxColor): Postavi boju boxa u textdrawu.
- [TextDrawBackgroundColor](TextDrawBackgroundColor): Postavi boju pozadine textdrawa.
- [TextDrawAlignment](TextDrawAlignment): Postavi poravnanje textdrawa.
- [TextDrawFont](TextDrawFont): Postavi font textdrawa.
- [TextDrawLetterSize](TextDrawLetterSize): Postavi veličinu znakova teksta u textdrawu.
- [TextDrawTextSize](TextDrawTextSize): Postavi veličinu boxa u textdrawu.
- [TextDrawSetOutline](TextDrawSetOutline): Odluči da li da tekst ima outline.
- [TextDrawSetShadow](TextDrawSetShadow): Uključi/isključi sjene (shadows) na textdrawu.
- [TextDrawUseBox](TextDrawUseBox): Uključite ili isključite da li textdraw koristi box ili ne.
- [TextDrawSetString](TextDrawSetString): Postavi tekst u već postojećem textdrawu.
- [TextDrawShowForPlayer](TextDrawShowForPlayer): Prikaži textdraw za određenog igrača.
- [TextDrawHideForPlayer](TextDrawHideForPlayer): Sakrij textdraw za određenog igrača.
- [TextDrawShowForAll](TextDrawShowForAll): Prikaži textdraw za sve igrače.
- [TextDrawHideForAll](TextDrawHideForAll): Sakrij textdraw za sve igrače.
| openmultiplayer/web/docs/translations/bs/scripting/functions/TextDrawSetProportional.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/TextDrawSetProportional.md",
"repo_id": "openmultiplayer",
"token_count": 1007
} | 370 |
---
title: UsePlayerPedAnims
description: Koristi standardnu animaciju hodanja igrača (animacija CJ kože) umjesto prilagođenih animacija za svaku kožu (npr. Klizanje za kože klizača).
tags: ["player"]
---
## Deskripcija
Koristi standardnu animaciju hodanja igrača (animacija CJ kože) umjesto prilagođenih animacija za svaku kožu (npr. Klizanje za kože klizača).
## Primjeri
```c
public OnGameModeInit()
{
UsePlayerPedAnims();
return 1;
}
```
## Zabilješke
:::tip
Radi samo kada se postavi pod [OnGameModeInit](../callbacks/OnGameModeInit).
Neupotreba ove funkcije dovodi do toga da se dvoručno oružje (ne dvostruko - jedno oružje koje drže obje ruke) drži u samo jednoj ruci.
:::
:::tip
You can also enable standard player walking animation via [config.json](../../server/config.json)
```json
"use_player_ped_anims": true,
```
:::
## Srodne Funkcije
- [ApplyAnimation](ApplyAnimation): Primijeni animaciju na igrača.
- [ClearAnimations](ClearAnimations): Očisti svaku animaciju koju igrač izvodi.
| openmultiplayer/web/docs/translations/bs/scripting/functions/UsePlayerPedAnims.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/UsePlayerPedAnims.md",
"repo_id": "openmultiplayer",
"token_count": 446
} | 371 |
---
title: db_get_field_float
description: Dobiva sadržaj polja kao float broj s navedenim indeksom polja.
keywords:
- sqlite
---
:::warning
Ova funkcija započinje malim slovom.
:::
## Deskripcija
Dobiva sadržaj polja kao float broj s navedenim indeksom polja.
| Ime | Deskripcija |
| ----------------- | -------------------------------- |
| DBResult:dbresult | Rezultat za dobivanje podataka. |
| field = 0 | Indeks polja za dobivanje imena. |
## Returns
Retrieved value as a floating point number.
## Example
```c
// examples.inc
// ...
static FindFieldIndexByName(DBResult:dbResultSet, const fieldName[])
{
// Vrijednost varijable s povratom sa zadanom povratnom vrijednošću
new ret = -1;
// Brojanje polja
new field_count = db_num_fields(dbResultSet);
// Naziv trenutnog polja
new current_field_name[32];
// Iteracija kroz sva polja
for (new field_index; field_index < field_count; field_index++)
{
// Dobij ime polja
if (db_field_name(dbResultSet, field_index, current_field_name, sizeof current_field_name))
{
// Usporedite naziv pretraživanog polja s trenutnim nazivom polja
if (!strcmp(fieldName, current_field_name))
{
// Uspješno, pohraniti indeks polja za vraćanje varijable vrijednosti
ret = field_index;
// Zaustavljamo petlju
break;
}
}
}
// Vrati indeks pronađenog polja ili "-1"
return ret;
}
Float:Examples_CalculateSum(DB:dbConnectionHandle)
{
// Vrijednost varijable s povratom
new Float:ret;
// Skup rezultata rezultata baze podataka
new DBResult:db_result_set = db_query("SELECT `value` FROM `examples`");
// Ako je zbir rezultata rezultata baze podataka valjan
if (db_result_set)
{
// Nabavimo indeks ciljnog polja
new target_field_index = FindFieldIndexByName(db_result_set, "value");
// Provjerimo je li indeks polja valjan
if (target_field_index >= 0)
{
// Radi operacije
do
{
// Dodajte vrijednost iz polja "primjer" u varijablu povratne vrijednosti
ret += db_get_field_float(db_result_set, target_field_index);
}
// Dok bi se mogao preuzeti sljedeći red
while (db_next_row(db_result_set));
}
// Oslobodi rezultat
db_free_result(db_result_set);
}
// Vrati izračunati zbroj
return ret;
}
```
```c
// mode.pwn
// ...
#include <examples>
static DB:gDBConnectionHandle;
// ...
public OnGameModeInit()
{
// ...
// Kreiramo konekciju za databazu
gDBConnectionHandle = db_open("example.db");
// Ako konekcija za databazu postoji
if (gDBConnectionHandle)
{
// Uspješno kreirana konekcija do databaze
print("Uspješno stvorena veza s bazom podataka \"example.db\".");
printf("Izracunata suma: %f", Examples_CalculateSum(gDBConnectionHandle));
}
else
{
// Neuspješno kreirana konekcija do databaze
print("Otvaranje veze s bazom podataka nije uspjelo \"example.db\".");
}
// ...
return 1;
}
public OnGameModeExit()
{
// Zatvori konekciju sa databazom ako je otvorena
if (db_close(gDBConnectionHandle))
{
// Dodatno čišćenje
gDBConnectionHandle = DB:0;
}
// ...
return 1;
}
```
## Zabilješke
:::warning
Upotreba nevaljanog upravitelja databaze koja nije nula srušit će vaš server! Nabavite važeći upravitelj databazom pomoću [db_open] (db_open).
:::
## Srodne Funkcije
- [db_open](db_open): Otvori konekciju do SQLite databaze.
- [db_close](b_close): Zatvori konekciju do SQLite databaze.
- [db_query](db_query): Upitajte SQLite bazu podataka.
- [db_free_result](db_free_result): Oslobodite memoriju rezultata iz db_query.
- [db_num_rows](db_num_rows): Dobijte broj redaka u rezultatu.
- [db_next_row](db_next_row): Pređi na sljedeći red.
- [db_num_fields](db_num_fields): Dobij broj polja u rezultatu.
- [db_field_name](db_field_name): Return/vraća ime polja na posebnom indexu.
- [db_get_field](db_get_field): Preuzmite sadržaj polja iz db_query.
- [db_get_field_assoc](db_get_field_assoc): Dobij sadržaj polja kao string s navedenim imenom polja.
- [db_get_field_int](db_get_field_int): Dobijte sadržaj polja kao cijeli broj iz db_query.
- [db_get_field_assoc_int](db_get_field_assoc_int): Dobijte sadržaj polja kao cijeli broj s navedenim imenom iz trenutnog reda rezultata.
- [db_get_field_assoc_float](db_get_field_assoc_float): Dobij sadržaj polja kao float broj s navedenim imenom polja.
- [db_get_mem_handle](db_get_mem_handle): Dobij memorijski upravitelj za vezu SQLite databaze koja je otvorena s `db_open`.
- [db_get_result_mem_handle](db_get_result_mem_handle): Dobiva memorijski upravitelj za vezu SQLite databaze koja je dodijeljena sa s `db_query`.
- [db_debug_openfiles](db_debug_openfiles): Dobiva broj otvorenih konekcija/veza databaza u svrhu otklanjanja pogrešaka.
- [db_debug_openresults](db_debug_openresults): Dobiva broj rezultata otvorene databaze.
| openmultiplayer/web/docs/translations/bs/scripting/functions/db_get_field_float.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/db_get_field_float.md",
"repo_id": "openmultiplayer",
"token_count": 2428
} | 372 |
---
title: flength
description: Vraća dužinu datoteke.
tags: []
---
:::warning
Ova funkcija započinje malim slovom.
:::
## Deskripcija
Vraća dužinu datoteke.
| Ime | Deskripcija |
| ------ | ------------------------------------------- |
| handle | Upravitelj datoteke vraćena fopen ili ftemp |
## Returns
Dužina datoteke, u bajtovima.
## Primjeri
```c
// Otvori "file.txt" u "read only" modu (samo čitanje)
new File:handle = fopen("file.txt", io_read);
// Ako je "file.txt" otvoren
if (handle)
{
// Uspješno
// Ispis veličine bajtova veličine "file.txt"
printf("File size: %d", flength(handle));
// Zatvori "file.txt"
fclose(handle);
}
else
{
// Error
print("Nesupješno otvaranje \"file.txt\".");
}
```
## Zabilješke
:::warning
Korištenje nevaljanog upravitelja srušit će vaš server! Nabavite važeći upravitelj pomoću fopen ili ftemp.
:::
## Srodne Funkcije
- [fopen](fopen): Otvori fajl/datoteku.
- [fclose](fclose): Zatvori fajl/datoteku.
- [ftemp](ftemp): Stvorite privremeni tok fajlova/datoteka.
- [fremove](fremove): Uklonite fajl/datoteku.
- [fwrite](fwrite): Piši u fajl/datoteku.
- [fread](fread): Čitaj fajl/datoteku.
- [fputchar](fputchar): Stavite znak u fajl/datoteku.
- [fgetchar](fgetchar): Dobijte znak iz fajla/datoteke.
- [fblockwrite](fblockwrite): Zapišite blokove podataka u fajl/datoteku.
- [fblockread](fblockread): Očitavanje blokova podataka iz fajla/datoteke.
- [fseek](fseek): Skoči na određeni znak u fajlu/datoteci.
- [flength](flength): Nabavite dužinu fajla/datoteke.
- [fexist](fexist): Provjeri da li datoteka postoji.
- [fmatch](fmatch): Provjeri podudaraju li se uzorci s nazivom datoteke.
| openmultiplayer/web/docs/translations/bs/scripting/functions/flength.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/flength.md",
"repo_id": "openmultiplayer",
"token_count": 801
} | 373 |
---
title: floattan
description: Uzmi tangentu iz zadanog ugla.
tags: []
---
:::warning
Ova funkcija započinje malim slovom.
:::
## Deskripcija
Uzmi tangentu iz zadanog ugla. Ulazni ugao može biti u radijanima, stupnjevima ili stupnjevima.
| Ime | Deskripcija |
| ----------- | ---------------------------------------------------------- |
| Float:value | Kut iz kojeg se dobija tangenta. |
| anglemode | Način kuta koji se koristi, ovisno o unesenoj vrijednosti. |
## Returns
Tangenta iz unesene vrijednosti.
## Primjeri
```c
public OnGameModeInit()
{
printf("Tangent iz 30° je %f", floattan(30.0, degrees));
// Output: 1
return 1;
}
```
## Zabilješke
:::warning
GTA / SA-MP u većini slučajeva koristi stupnjeve za uglove, na primjer GetPlayerFacingAngle. Stoga ćete najvjerojatnije htjeti koristiti način rada pod uglom 'stupnjeva', a ne radijane. Takođe imajte na umu da su uglovi u GTA suprotno kazaljkama na satu; 270° je istočno, a 90° zapadno. Jug je i dalje 180°, a sjever još uvijek 0° / 360°.
:::
## Srodne Funkcije
- [floatsin](floatsin): Uzmite sinus iz određenog ugla.
- [floatcos](floatcos): Dobijte kosinus iz određenog ugla.
| openmultiplayer/web/docs/translations/bs/scripting/functions/floattan.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/floattan.md",
"repo_id": "openmultiplayer",
"token_count": 601
} | 374 |
---
title: heapspace
description: Vraća količinu memorije dostupne za hrpu/stog (heap/stack) u bajtovima.
tags: []
---
:::warning
Ova funkcija započinje malim slovom.
:::
## Deskripcija
Vraća količinu memorije dostupne za hrpu/stog (heap/stack) u bajtovima.
## Primjeri
```c
public OnGameModeInit()
{
printf("Heapspace: %i kilobytes", heapspace() / 1024);
return 1;
}
```
## Srodne Funkcije
| openmultiplayer/web/docs/translations/bs/scripting/functions/heapspace.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/heapspace.md",
"repo_id": "openmultiplayer",
"token_count": 189
} | 375 |
---
title: strcmp
description: Upoređuje dva stringa kako pi vidjelo da li su isti.
tags: []
---
:::warning
Ova funkcija započinje malim slovom.
:::
## Deskripcija
Upoređuje dva stringa kako pi vidjelo da li su isti
| Ime | Deskripcija |
| --------------------- | --------------------------------------------------------------------------------------------------------------------------------------- |
| string1 | Prvi string za uporediti. |
| string2 | Drugi string za uporediti. |
| ignorecase (optional) | Kada je postavljeno na 'true', velika slova nemaju veze - HeLLo je isto kao Hello. Kada je postavljeno na 'false', oni nisu isti. |
| length (optional) | Kada se postavi ova dužina, uspoređivat će se prvih x znakova - izvođenje "Hello" i "Hell No" s dužinom od 4 reći će da je to isti niz. |
## Returns
0 ako se stringovi podudaraju na zadanoj dužini; 1 ili -1 ako se neki znak ne podudara: string1 [i] - string2 [i] ('i' predstavlja indeks znakova počevši od 0); razlika u broju znakova ako jedan niz odgovara samo dijelu drugog stringa.
## Primjeri
```c
new string1[] = "Hello World";
new string2[] = "Hello World";
// Provjeri ako su stringovi isti
if (!strcmp(string1, string2))
new string3[] = "Hell";
// Provjeri ako se prva 4 karaktera podudaraju
if (!strcmp(string2, string3, false, 4))
// Provijerite ima li null nizova sa isnull()
if (!strcmp(string1, string2) && !isnull(string1) && !isnull(string2))
// Definicija za isnull():
#if !defined isnull
#define isnull(%1) ((!(%1[0])) || (((%1[0]) == '\1') && (!(%1[1]))))
#endif
```
## Zabilješke
:::warning
Ova funkcija vraća 0 ako je bilo koji niz prazan. Provjerite ima li null nizova pomoću isnull (). Ako uspoređujete nizove iz tekstualne datoteke, trebali biste uzeti u obzir posebne znakove 'carriage return' i 'new line' (\r \n), kada su uključeni, kada koristite fread.
:::
## Srodne Funkcije
- [strfind](strfind): Pretraži string u drugom stringu.
- [strdel](strdel): Obriši dio stringa.
- [strins](../function/strins): Unesi tekst u string.
- [strlen](../function/strlen): Dobij dužinu stringa.
- [strmid](strmid): Izdvoji dio stringa u drugi string.
- [strpack](strpack): Upakuj string u odredišni string.
- [strval](strval): Pretvori string u cijeli broj.
- [strcat](strcat): Spojite dva stringa u odredišnu referencu.
- http://www.compuphase.com/pawn/String_Manipulation.pdf
| openmultiplayer/web/docs/translations/bs/scripting/functions/strcmp.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/strcmp.md",
"repo_id": "openmultiplayer",
"token_count": 1349
} | 376 |
---
title: Ugaoni Modovi
description: SI jedinične konstante za mjerenje uglova.
---
:::note
Ove ugaone modove koriste [floatsin](../functions/floatsin), [floatcos](../functions/floatcos), i [floattan](../functions/floattan).
:::
| Mod | Deskripcija |
| ------- | --------------------------- |
| radian | Ugao će biti u radijanima. |
| degrees | Ugao će biti u stepenima. |
| grades | Ugao će biti u stepenicama. |
| openmultiplayer/web/docs/translations/bs/scripting/resources/anglemodes.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/resources/anglemodes.md",
"repo_id": "openmultiplayer",
"token_count": 193
} | 377 |
---
title: OnActorStreamOut
description: Dieses Callback wird ausgeführt, wenn ein Actor nicht länger von einem Spieler gestreamt wird.
tags: []
---
<VersionWarn name='callback' version='SA-MP 0.3.7' />
## Beschreibung
Dieses Callback wird ausgeführt, wenn ein Actor nicht länger von einem Spieler gestreamt wird.
| Name | Beschreibung |
| ----------- | -------------------------------------------------------------- |
| actorid | Die ID des Actors der nicht länger vom Spieler gestreamt wird. |
| forplayerid | Die ID des Spielers der den Actor gestreamt hatte |
## Rückgabe(return value)
Wird in Filterscripts immer zuerst aufgerufen.
## Beispiele
```c
public OnActorStreamOut(actorid, forplayerid)
{
new string[40];
format(string, sizeof(string), "Actor %d wird nicht mehr von dir gestreamt.", actorid);
SendClientMessage(forplayerid, 0xFFFFFFFF, string);
return 1;
}
```
## Anmerkungen
<TipNPCCallbacks />
| openmultiplayer/web/docs/translations/de/scripting/callbacks/OnActorStreamOut.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/de/scripting/callbacks/OnActorStreamOut.md",
"repo_id": "openmultiplayer",
"token_count": 414
} | 378 |
---
título: OnPlayerClickMap
descripción: OnPlayerClickMap se llama cuando un jugador pone un objetivo/marca en el mapa del menú de pausa (usando click derecho).
tags: ["jugador"]
---
## Descripción
OnPlayerClickMap se llama cuando un jugador pone un objetivo/marca en el mapa del menú de pausa (usando click derecho).
| Nombre | Descripción |
| -------- | ----------------------------------------------------------------------------- |
| playerid | El ID del jugador que puso un objetivo/marcador en el mapa. |
| Float:fX | La coordenada X donde el jugador clickeó. |
| Float:fY | La coordenada Y donde el jugador clickeó. |
| Float:fZ | La coordenada Z donde el jugador clickeó (impreciso - ver nota abajo). |
## 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 OnPlayerClickMap(playerid, Float:fX, Float:fY, Float:fZ)
{
SetPlayerPosFindZ(playerid, fX, fY, fZ);
return 1;
}
```
## Notas
:::tip
Como dice el nombre del callback, sólo se llama cuando el jugador hace click para marcar el punto y no cuando presiona la tecla. El valor Z devuelto será 0 (inválido) si el área clickeada en el mapa está muy lejos del jugador; usá los plugins MapAndreas o ColAndreas para recibir una coordenada Z más precisa.
:::
## Funciones Relacionadas
| openmultiplayer/web/docs/translations/es/scripting/callbacks/OnPlayerClickMap.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/es/scripting/callbacks/OnPlayerClickMap.md",
"repo_id": "openmultiplayer",
"token_count": 676
} | 379 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.