Quantcast
Channel: SA-MP Forums
Viewing all 18226 articles
Browse latest View live

weapon-config.inc HELP

$
0
0
Code:

D:\Data\SERVER\SATDMv12 - Copy\pawno\include\weapon-config.inc(1774) : warning 202: number of arguments does not match definition
D:\Data\SERVER\SATDMv12 - Copy\pawno\include\weapon-config.inc(2217) : warning 234: function is deprecated (symbol "FreezeSyncData") Please use FreezeSyncPacket instead
D:\Data\SERVER\SATDMv12 - Copy\pawno\include\weapon-config.inc(2304) : error 017: undefined symbol "GetPlayerPoolSize"
D:\Data\SERVER\SATDMv12 - Copy\pawno\include\weapon-config.inc(2420) : warning 234: function is deprecated (symbol "FreezeSyncData") Please use FreezeSyncPacket instead
D:\Data\SERVER\SATDMv12 - Copy\pawno\include\weapon-config.inc(2492) : warning 234: function is deprecated (symbol "FreezeSyncData") Please use FreezeSyncPacket instead
D:\Data\SERVER\SATDMv12 - Copy\pawno\include\weapon-config.inc(2681) : warning 234: function is deprecated (symbol "FreezeSyncData") Please use FreezeSyncPacket instead
D:\Data\SERVER\SATDMv12 - Copy\pawno\include\weapon-config.inc(2710) : warning 234: function is deprecated (symbol "FreezeSyncData") Please use FreezeSyncPacket instead
D:\Data\SERVER\SATDMv12 - Copy\pawno\include\weapon-config.inc(2719) : error 017: undefined symbol "GetPlayerPoolSize"
D:\Data\SERVER\SATDMv12 - Copy\pawno\include\weapon-config.inc(2741) : warning 234: function is deprecated (symbol "FreezeSyncData") Please use FreezeSyncPacket instead
D:\Data\SERVER\SATDMv12 - Copy\pawno\include\weapon-config.inc(2836) : warning 234: function is deprecated (symbol "SendLastSyncData") Please use SendLastSyncPacket instead
D:\Data\SERVER\SATDMv12 - Copy\pawno\include\weapon-config.inc(2904) : error 017: undefined symbol "GetPlayerPoolSize"
D:\Data\SERVER\SATDMv12 - Copy\pawno\include\weapon-config.inc(2911) : warning 234: function is deprecated (symbol "SendLastSyncData") Please use SendLastSyncPacket instead
D:\Data\SERVER\SATDMv12 - Copy\pawno\include\weapon-config.inc(3493) : warning 235: public function lacks forward declaration (symbol "OnPlayerWeaponShot")
D:\Data\SERVER\SATDMv12 - Copy\pawno\include\weapon-config.inc(3512) : error 017: undefined symbol "BULLET_HIT_TYPE_PLAYER"
D:\Data\SERVER\SATDMv12 - Copy\pawno\include\weapon-config.inc(3560) : error 017: undefined symbol "GetPlayerLastShotVectors"
D:\Data\SERVER\SATDMv12 - Copy\pawno\include\weapon-config.inc(3562) : error 017: undefined symbol "VectorSize"
D:\Data\SERVER\SATDMv12 - Copy\pawno\include\weapon-config.inc(3563) : error 017: undefined symbol "VectorSize"
D:\Data\SERVER\SATDMv12 - Copy\pawno\include\weapon-config.inc(3576) : error 017: undefined symbol "BULLET_HIT_TYPE_NONE"
D:\Data\SERVER\SATDMv12 - Copy\pawno\include\weapon-config.inc(3578) : error 017: undefined symbol "BULLET_HIT_TYPE_PLAYER"
D:\Data\SERVER\SATDMv12 - Copy\pawno\include\weapon-config.inc(3585) : error 017: undefined symbol "BULLET_HIT_TYPE_PLAYER"
D:\Data\SERVER\SATDMv12 - Copy\pawno\include\weapon-config.inc(3666) : error 017: undefined symbol "BULLET_HIT_TYPE_VEHICLE"
D:\Data\SERVER\SATDMv12 - Copy\pawno\include\weapon-config.inc(3687) : error 017: undefined symbol "GetPlayerPoolSize"
D:\Data\SERVER\SATDMv12 - Copy\pawno\include\weapon-config.inc(3735) : error 017: undefined symbol "GetPlayerPoolSize"
D:\Data\SERVER\SATDMv12 - Copy\pawno\include\weapon-config.inc(3788) : error 017: undefined symbol "BULLET_HIT_TYPE_VEHICLE"
D:\Data\SERVER\SATDMv12 - Copy\pawno\include\weapon-config.inc(3934) : error 017: undefined symbol "GetPlayerPoolSize"
D:\Data\SERVER\SATDMv12 - Copy\pawno\include\weapon-config.inc(4010) : error 017: undefined symbol "GetPlayerPoolSize"
D:\Data\SERVER\SATDMv12 - Copy\pawno\include\weapon-config.inc(4039) : warning 234: function is deprecated (symbol "FreezeSyncData") Please use FreezeSyncPacket instead
D:\Data\SERVER\SATDMv12 - Copy\pawno\include\weapon-config.inc(4261) : error 017: undefined symbol "GetPlayerPoolSize"
D:\Data\SERVER\SATDMv12 - Copy\pawno\include\weapon-config.inc(4268) : warning 234: function is deprecated (symbol "SendLastSyncData") Please use SendLastSyncPacket instead
D:\Data\SERVER\SATDMv12 - Copy\pawno\include\weapon-config.inc(4384) : error 017: undefined symbol "GetPlayerPoolSize"
D:\Data\SERVER\SATDMv12 - Copy\pawno\include\weapon-config.inc(4391) : warning 234: function is deprecated (symbol "SendLastSyncData") Please use SendLastSyncPacket instead
D:\Data\SERVER\SATDMv12 - Copy\pawno\include\weapon-config.inc(4943) : warning 234: function is deprecated (symbol "FreezeSyncData") Please use FreezeSyncPacket instead
D:\Data\SERVER\SATDMv12 - Copy\pawno\include\weapon-config.inc(5302) : error 017: undefined symbol "GetPlayerPoolSize"
D:\Data\SERVER\SATDMv12 - Copy\pawno\include\weapon-config.inc(5321) : error 017: undefined symbol "GetPlayerPoolSize"
D:\Data\SERVER\SATDMv12 - Copy\pawno\include\weapon-config.inc(5520) : warning 234: function is deprecated (symbol "FreezeSyncData") Please use FreezeSyncPacket instead
D:\Data\SERVER\SATDMv12 - Copy\pawno\include\weapon-config.inc(5577) : error 017: undefined symbol "GetPlayerPoolSize"
D:\Data\SERVER\SATDMv12 - Copy\pawno\include\weapon-config.inc(5595) : error 017: undefined symbol "GetPlayerPoolSize"
D:\Data\SERVER\SATDMv12 - Copy\gamemodes\SATDMv12.pwn(3304) : warning 209: function "WC_OnGameModeInit" should return a value
D:\Data\SERVER\SATDMv12 - Copy\gamemodes\SATDMv12.pwn(13433) : warning 209: function "WC_OnGameModeExit" should return a value
D:\Data\SERVER\SATDMv12 - Copy\gamemodes\SATDMv12.pwn(17502) : warning 202: number of arguments does not match definition
D:\Data\SERVER\SATDMv12 - Copy\gamemodes\SATDMv12.pwn(17502) : warning 202: number of arguments does not match definition
D:\Data\SERVER\SATDMv12 - Copy\gamemodes\SATDMv12.pwn(19598) : warning 219: local variable "weapon" shadows a variable at a preceding level
Pawn compiler 3.10.4                          Copyright (c) 1997-2006, ITB CompuPhase


22 Errors.

PHP Code:

#include <a_samp>
#include <sscanf2>
#include <a_mysql>
#include <zcmd>
#include <streamer>
#include <KZI>
#include <foreach>
#include <sampcac>
#include <SKY>
#include <weapon-config> 

How can i fix this?

[Ajuda] ERROR 21

$
0
0
Boa noite, pessoal.
Por que esse erro acontece? Não sei como resolver esse conflito entre arquivos.
Alguém poderia me tirar a dúvida e explicar o motivo de acontecer isso?

error 021: symbol already defined: "SSCANF_OnPlayerConnect"

Login Problem

$
0
0
Okey guys i have problem..
I made Reg/Log system and when i log and put my password my camera stay
this some pic
https://imgur.com/a/Y0iyHlF

Code:

#define SCM    SendClientMessage
#define SCMTA  SendClientMessageToAll
#define SPD    ShowPlayerDialog
#define DSL    DIALOG_STYLE_LIST
#define DSB    DIALOG_STYLE_MSGBOX
#define DSI    DIALOG_STYLE_INPUT
//————————————————————————————————————————————————————————————————————————————————//
//===============================[DIALOG DEFINICIJE]================================//
#define dialog_REGISTER            1
#define dialog_LOGIN                2
#define dialog_OSTALO              3
#define DIALOG_PRAVILA  1
//————————————————————————————————————————————————————————————————————————————————//
//===============================[BOJE]================================//
#define col_server                      "{0282DE}"
#define col_crvena                      "{F7344E}"
#define col_bela                        "{FFFFFF}"
//————————————————————————————————————————————————————————————————————————————————//
//===============================[Definicije foldera]================================//
#define REGISTER_KORISNICI              "Korisnici/%s.ini"
 
// new
new IgracPrijavljen[MAX_PLAYERS];
 
enum pPlayerInfo
{
    pPass[129],
    pNovac,
    pLevel,
    pAdmin,
    pUbistva,
    pSmrti,
    pPlayerCuvanje
}
new PlayerInfo[MAX_PLAYERS][pPlayerInfo];
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
forward UcitajKorisnike(playerid, name[], value[]);
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
native WP_Hash(buffer[], len, const str[]);

main ( )
{
        print("_________________________________________________________________________");
        printf("> Name: %s", NAME);
        printf("> Version: %s", VERSION);
        printf("> Website: %s", WEBSITE);
        printf("> Developer: %s", DEVELOPER);
        printf("> Owner: %s", OWNER);
        printf("> Mapper: %s", MAPPER);
        printf("> Last Update: %s", LAST_UPDATE);
        print("_________________________________________________________________________");
}
//————————————————————————————————————————————————————————————————————————————————//
public OnGameModeInit()
{
        SetGameModeText("Acerion x1.0.0©");
        SendRconCommand("weburl "WEBSITE"" );
        SendRconCommand("language • EX-YU •" );
        EnableStuntBonusForAll(0);
    DisableInteriorEnterExits();
    ShowPlayerMarkers(0);
        ShowNameTags(1);
        AllowInteriorWeapons(1);
        new sati, minute, sekunde;
    gettime(sati, minute, sekunde);
    SetWorldTime(sati);
}
//————————————————————————————————————————————————————————————————————————————————//
public OnGameModeExit()
{
        return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
        SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
        SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
        SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
        return 1;
}

public OnPlayerConnect(playerid)
{
    SCM(playerid, -1, ""col_server"[Acerion] "col_bela"Dobrodosli na Acerion Gaming! Uskoro Update!!!");
 
    ResetujKorisnika(playerid);
 
    new StrText[80];
    format(StrText, 80, REGISTER_KORISNICI, GetName(playerid));
    if(fexist(StrText))
    {
        ShowPlayerDialog(playerid, dialog_LOGIN, DIALOG_STYLE_PASSWORD, ""col_server"Login", ""col_bela"Unesite lozinku koju ste uneli na registraciji.\n\n- Ukoliko imate problema posetite nas forum "col_server"www.grand-roleplay.com"col_bela".\n- Unesite vasu validnu lozinku.", "Login", "Izlaz");
    }
    else
    {
        ShowPlayerDialog(playerid, dialog_REGISTER, DIALOG_STYLE_PASSWORD, ""col_server"Registracija", ""col_bela"Unesite lozinku koju zelite da koristite na serveru.\n\n- Mora imati najmanje "col_server"6 "col_bela"karatkera.\n- Mora imati najvise "col_server"20 "col_bela"karatkera.", "Register", "Izlaz");
    }
    return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch(dialogid)
    {
        case dialog_REGISTER:
        {
            if(!response) return Kick(playerid);
            if(response)
            {
                if(!strlen(inputtext)) return ShowPlayerDialog(playerid, dialog_REGISTER, DIALOG_STYLE_PASSWORD, ""col_server"Registracija", ""col_bela"Unesite lozinku koju zelite da koristite na serveru.\n\n- Mora imati najmanje "col_server"6 "col_bela"karatkera.\n- Mora imati najvise "col_server"20 "col_bela"karatkera.", "Register", "Izlaz");
                Registruj_Igraca(playerid);
                SetSpawnInfo(playerid, 0, 0, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0);
                SpawnPlayer(playerid);
            }
        }
 
        case dialog_LOGIN:
        {
            if(!response) return Kick(playerid);
            if(response)
            {
                new hashpass[129], StrText[80];
                WP_Hash(hashpass, 129, inputtext);
                if(!strcmp(hashpass, PlayerInfo[playerid][pPass], false))
                {
                    format(StrText, 80, REGISTER_KORISNICI, GetName(playerid));
                    INI_ParseFile(StrText, "UcitajKorisnike", .bExtra = true, .extra = playerid);
                    GivePlayerMoney(playerid, PlayerInfo[playerid][pNovac]);
                    SetSpawnInfo(playerid, 0, 0, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0);
                    SpawnPlayer(playerid);
                    SCM(playerid, -1, ""col_server"(Info) "col_bela"Uspesno ste se ulogovali na server!");
                }
                else
                {
                    ShowPlayerDialog(playerid, dialog_LOGIN, DIALOG_STYLE_PASSWORD, ""col_crvena"Pogresna Lozinka", ""col_bela"Unesite lozinku koju ste uneli na registraciji.\n\n- Ukoliko imate problema posetite nas forum "col_server"www.grand-roleplay.com"col_bela".\n- Unesite vasu validnu lozinku.", "Login", "Izlaz");
                    SCM(playerid, -1, ""col_crvena"(Upozorenje) "col_bela"Pogresili ste lozinku, ugasite Caps Lock!");
                }
                return 1;
            }
        }
    }
    return 1;
}

public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
        return 1;
}
public UcitajKorisnike(playerid, name[], value[])
{
    INI_String("Password", PlayerInfo[playerid][pPass], 129);
    INI_Int("Novac", PlayerInfo[playerid][pNovac]);
    INI_Int("Level", PlayerInfo[playerid][pLevel]);
    INI_Int("Admin", PlayerInfo[playerid][pAdmin]);
    INI_Int("Ubistva", PlayerInfo[playerid][pUbistva]);
    INI_Int("Smrti", PlayerInfo[playerid][pSmrti]);
    INI_Int("PlayerCuvanje", PlayerInfo[playerid][pPlayerCuvanje]);
    return 1;
}
 
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ STOCK
 
stock ResetujKorisnika(playerid)
{
    PlayerInfo[playerid][pNovac] = 0;
    PlayerInfo[playerid][pLevel] = 0;
    PlayerInfo[playerid][pAdmin] = 0;
    PlayerInfo[playerid][pUbistva] = 0;
    PlayerInfo[playerid][pSmrti] = 0;
    PlayerInfo[playerid][pPlayerCuvanje] = 0;
}
 
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
stock SacuvajKorisnika(playerid)
{
    if(PlayerInfo[playerid][pSnimanjeRacuna] != 0)
    {
        new StrText[80], string[400];
        format(StrText, 80, REGISTER_KORISNICI, GetName(playerid));
        if(fexist(StrText))
        {
            new INI:PlayerFile = INI_Open(StrText);
            INI_WriteInt(PlayerFile, "Novac", GetPlayerMoney(playerid));
            INI_WriteInt(PlayerFile, "Level", PlayerInfo[playerid][pLevel]);
            INI_WriteInt(PlayerFile, "Admin", PlayerInfo[playerid][pAdmin]);
            INI_WriteInt(PlayerFile, "Ubistva", PlayerInfo[playerid][pUbistva]);
            INI_WriteInt(PlayerFile, "Smrti", PlayerInfo[playerid][pSmrti]);
            INI_WriteINT(PlayerFile, "PlayerCuvanje", PlayerInfo[playerid][pPlayerCuvanje]);
            INI_Close(PlayerFile);
        }
        else
        {
            format(strign, sizeof(string), "{0073AA}| Info | {FFFFFF}Vase Ime_Prezime(%s) nije pronadjeno u bazi podataka i nije ga moguce sacuvati!", GetName(playerid));
            SCM(playerid, -1, string);
        }
    }
    return 1;
}
 
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
stock Registruj_Igraca(playerid)
{
    new StrText[80], Hash_Password[129];
    PlayerInfo[playerid][pNovac] = 10000;
    GivePlayerMoney(playerid, PlayerInfo[playerid][pNovac]);
    PlayerInfo[playerid][pLevel] = 1;
    PlayerInfo[playerid][pAdmin] = 0;
    PlayerInfo[playerid][pUbistva] = 0;
    PlayerInfo[playerid][pSmrti] = 0;
    PlayerInfo[playerid][pPlayerCuvanje] = 1;
    format(StrText, 80, REGISTER_KORISNICI, GetName(playerid));
    new INI:File = INI_Open(StrText);
    WP_Hash(Hash_Password, 129, PlayerInfo[playerid][pPass]);
    INI_WriteString(File,"Pass", Hash_Password);
    INI_WriteInt(File, "Novac", PlayerInfo[playerid][pNovac]);
    INI_WriteInt(File, "Level", PlayerInfo[playerid][pLevel]);
    INI_WriteInt(File, "Admin", PlayerInfo[playerid][pAdmin]);
    INI_WriteInt(File, "Ubistva", PlayerInfo[playerid][pUbistva]);
    INI_WriteInt(File, "Smrti", PlayerInfo[playerid][pSmrti]);
    INI_WriteInt(File, "PlayerCuvanje", PlayerInfo[playerid][pPlayerCuvanje]);
    INI_Close(File);
}
 
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
stock GetName(playerid)
{
 
    GetPlayerName(playerid, IgracPrijavljen, MAX_PLAYER_NAME);
    return IgracPrijavljen;
}

sry for my bad english

Port Forwarding fail

$
0
0
Once I managed to run a server, then I removed the port forward rules then I made the same rules again, after that i can't access my server anymore (failed to connect to server) but the router log said the port forwarding is sucessfull, I made the rules exactly like I did before, no change. I have static IP address (192.168.1.50) , port 7777.
https://i.imgur.com/QayIPvS.png

Then I run "netstat -aon" on CMD to know wether my samp-server.exe listens to the port or not. Then I found this...
https://i.imgur.com/IqoIDp2.png
0.0.0.0:7777 is the local address
*:* is foreign address
blank space is the state (LISTENING, ESTABLISHED, TIME_WAIT)
19968 is the PID (Process ID) of samp-server.exe

the program has no state so it is blank space.
My question is... is that really a problem?

Summary: I've create the server sucessfully then I deleted the port forward rules then made it again like before, then I failed to connect, I don't know how to fix this, please answer my question and help me with this stuff, your help is very appreciated :)

duel system

$
0
0
I'm making a duel system and having a problem with the BET money.
If i use :
PHP Code:

new Bet

PHP Code:

new targetduelbet;
    if(
sscanf(params"ui"targetduelbet)) return SendClientMessage(playeridred,"USAGE: /duel [PlayerID] [bet]"); 

PHP Code:

Bet duelbet

As far as i know, if there are 2 or more duels started at the same time, those bets will "crash".
I mean, the first bet will affect the second bet and so on..

I have solved a similar problem in my duel system, like the :
PHP Code:

SetPlayerVirtualWorld(dueler1dueler1 10);
SetPlayerVirtualWorld(dueler2dueler1 10); 

So if there are 2 or more duels, they wont duel in a same world, which means the server could has an unlimited duels started in a same time.

But, idk about this BET. How to make it?

newline GameTextForPlayer not work

$
0
0
why no one second line is working on this GameTextForPlayer?

Code:

    new str[128], final[512];
    format(str, sizeof(str), "~y~mission passed!~n~");
    strcat(final, str);
    if(reward_exp > 0) {
        format(str, sizeof(str), "~w~+%i exp ", reward_exp);
        strcat(final, str);
    }
    if(reward_criminal > 0) {
        format(str, sizeof(str), "~w~+%i criminal ", reward_criminal);
        strcat(final, str);
    }
    if(reward_cop > 0) {
        format(str, sizeof(str), "~w~+%i cop ", reward_cop);
        strcat(final, str);
    }
    if(reward_money > 0) {
        format(str, sizeof(str), "~w~+%i$ ", reward_money);
        strcat(final, str);
    }
    GameTextForPlayer(playerid,final, 3000, 3);

the first line format(str, sizeof(str), "~y~mission passed!~n~");
the next ones no one is working
why?

Coomand /try

[Ajuda] Variável

$
0
0
Olá, eu queria saber se é possível verificar uma variável sem precisar utilizar desta forma em quase todos os códigos em determinados sistemas.

Exemplo.

PHP Code:

new Assalto[MAX_PLAYERS]; 

public 
OnPlayerConnect(playerid)
{
      
Assalto[playerid] = 999;


Exemplo.

PHP Code:

command:assaltar(playeridparams[])
{
      new 
id;
      
Assalto[id] = playerid;

      return 
1;


Até mesmo em verificações como esta.

PHP Code:

SendClientMessage(playerid, -1"O Assaltante não está mais conectado!"); *
Assalto[playerid] = 999; * 

Eu acho que esse tipo de verificação atrapalha o processo do servidor, estive procurando algo pra entender mais não encontrei nada relacionado a isto.. E como uso uma gamemode da internet estou tentando melhorar determinados sistemas...

Can't install SAMP on MacOS Catalina

$
0
0
Hi,

I have downloaded GTA SA, and am using WineBottler (Stable) to try and run SAMP.

I am unable to run SAMP through WineBottler and don't really want to buy crossover just for SAMP.

Can anyone who has MacOS Catalina/uses WineBottler to play please provide some assistance?

https://imgur.com/SzFdTYe

That's what happens when I go to run SAMP ^^, when I press 'Go' it says 'Prefix creation aborted'

Any advice or help would be greatly appreciated

Please

[Pedido] Veículo em 2 mundos diferentes

$
0
0
Exemplo: Quero colocar um veículo no mundo 50, e o outro, no mundo 450.
é possível?

Giving More Health And Armor

$
0
0
How to give the player more than 100 health and armor?

For example setting health 120, setting armor 150.

Map Problem

$
0
0
Hello, after add map in my mode I have one problem. My map they disappear and appear. Where is the problem


Checking if player is banned

$
0
0
so here is my code

PHP Code:

    if(fexist(string))
    {
        new 
INI:file INI_Open(string);
        if(
INI_WriteInt(file,"Banned",1))
        {
        
INI_WriteInt(file,"Banned",0);
        
INI_Close(file);
        
format(string1,sizeof(string1),"{ffa700}%s has been unbanned from CvR by an administrator!",params);
        
SendClientMessageToAll(-1,string1);
        }
        else
        {
        
SCM(playerid,0xf8f8f8fff,"ERROR: {ffffff}player is not banned!");
        }
        
    }
    else
    {
    
SendClientMessage(playerid,-1,"{ffa700}ERROR: Account not found");
    } 

and im getting this

Code:

warning 209: function "INI_WriteInt" should return a value
is there any possbile way to check if player is banned or not?

[Ajuda] TextDraw

$
0
0
Percebi que não tem como criar uma textdraw e posteriormente mostra-la para o jogador...

Code:

TD = CreatePlayerTextDraw(...);
PlayerTextDrawShow(..., TD);

Há alguma forma de fazer isso ?

Help me with the command /duty

$
0
0
Good morning, afternoon or night the time you see this, I need help in the code that will show them the function of this is that you put "/ duty" and activate your administrator mode that only when you are in / duty do you have the permissions if / ban, / kick and those but I could only create the command but I don't know how to set certain commands for the ones I said earlier and some more.

some commands that I want them to put in the code by putting "/ duty"

/ban
/kick
/jet

PHP Code:

#include <a_samp>

new
    
p_onDuty[MAX_PLAYERS] = 0,
    
p_oldSkin[MAX_PLAYERS] = -1
;

public 
OnFilterScriptInit()
{
    print(
"Duty system.");
    return 
1;
}

public 
OnFilterScriptExit()
{
    return 
1;
}

public 
OnPlayerConnect(playerid)
{
    
p_onDuty[playerid] = 0;
    
p_oldSkin[playerid] = -1;
    return 
1;
}

public 
OnPlayerCommandText(playeridcmdtext[])
{
    if (
strcmp("/duty"cmdtexttrue5) == 0)
    {
        new
            
string[128], //SA:MP does not send client messages over 128 characters.
            
p_Name[24//24 is the maximum length for nicknames in SA:MP 0.3d (Could increase in later versions?)
        
;

        
GetPlayerName(playeridp_Name24); //Could also do: GetPlayerName(playerid, p_Name, sizeof(p_Name));

        
if(p_onDuty[playerid] == 0) { //Checking if their On Duty variable is zero (0) [They are off duty]

            
p_onDuty[playerid] = 1;

            
//You can add the rest of your on duty code here, e.g: Giving them weapons, a police skin, ect. Here, we will save their skin, and set their skin to a police skin.

            
p_oldSkin[playerid] = GetPlayerSkin(playerid);
            
SetPlayerSkin(playerid283); //Change this to the skin ID you want!

            
GivePlayerWeapon(playerid24100); //Gives them a desert eagle with 100 ammo.

            
SetPlayerArmour(playerid100); //Set their armour to 100!

            
format(stringsizeof(string), "*Service"p_Name);
            return 
SendClientMessageToAll(0xE0941BFFstring);
        }
        else if(
p_onDuty[playerid] == 1) { //Checking if their On Duty variable is one (1) [They are on duty]

            
p_onDuty[playerid] = 0;

            
ResetPlayerWeapons(playerid); //Takes away all their weapons!

            
SetPlayerSkin(playeridp_oldSkin[playerid]); //Setting their old skin back!
            
p_oldSkin[playerid] = -1//Resetting the skin variable

            
SetPlayerArmour(playerid0); //Resetting their armour

            
format(stringsizeof(string), "*[-]Service."p_Name);
            return 
SendClientMessageToAll(0xE0941BFFstring);
        }
        return 
1;
    }
    return 
0;


The others will look for them and I will add them so as not to annoy those who could help me

Enum for teams - ShowPlayerDialog

$
0
0
I have for example 3 computers on my server, and with this I intend to create an "inventory" with quantity (Class_Amount).

The problem is that it shows the same Class_Amount to all teams, instead of showing the remaining amount of each team.

Of course I say that Class_Amount is the initial amount with which all teams start, but from there they are reduced, and what I want is to show the remaining amount of each team.

Code:

//=====================================================================

enum Class
{

Class_Name[10],
Class_Amount
};

new eClass[][Class]=
{

{"Assault"              , 10},
{"Support"              , 50},
{"Sniper"              , 50}

};

//=====================================================================

new x[64], d[200];

for(new c = 0; c < sizeof(Class); c++)
{
format(x, sizeof(x), "[%d] - %s\n", eClass[c][Class_Amount],eClass[c][Class_Name]);
strcat(d, x);
}

ShowPlayerDialog(playerid, box[listitem][box_ID], DIALOG_STYLE_LIST, box[listitem][box_name], d, "Select", "Exit");

//=====================================================================

[Off] Procuro Pessoa para Ajudar

$
0
0
Olá estou com vontade de criar um serve no qual preciso de uma pessoa que saiba programar e eu estarei com o ramo das finanças do server se estiver interessado deixe seu discord aki.

[Map] Truck and ferraris

$
0
0
My new map, one truck with two ferraris.
This map is a part of a long project (my vehicles to samp)
You can use like a decoration or using map mover.

Images:




More images: Click Here
Download: Click Here
Number of objects: 366
Credits: AlieN_ aka AdrianO

[Ajuda] Comando compila más na GM não funciona :/

$
0
0
O comando compila normalmente más na GameMode não funciona, seria tipo não ter o comando lá.
Ele está na upando dboas qnd coloco na gm :/

pawn Code:
/*



 Filterscripter C-casas <3



*/



#include <a_samp>
#include <pawn.cmd>
#include <sscanf2>
#include <streamer>

enum
{
    MAX_CASAS = 100, // Maximo de casas

    VERMELHO = 0xFF000FFF,
    CINZA = 0xCECECEFF,
    LARANJA = 0xF97804FF
};

enum pInfo
{
    Nome[24],
    TemCasa,
    EntrouCasa
};
new p[MAX_PLAYERS][pInfo];

enum cInfo
{
    cDono[24],
    Float:cX,
    Float:cY,
    Float:cZ,
    cTemDono,
    cTrancada,
    cIcone,
    cPickup,
    cInt,
    Text3D:cText,
    cPreco
};
new c[MAX_CASAS][cInfo], TOTALCASA;


// interiores casas
enum inter
{
    Float:iX,
    Float:iY,
    Float:iZ,
    Float:iA,
    iID
}

new interior[][inter] =
{
    {2196.84, -1204.36, 1049.02, 94.0010, 6},
    {2259.38, -1135.89, 1050.64, 275.3992, 10},
    {2282.99, -1140.28, 1050.89, 358.4660, 11},
    {2233.69, -1115.26, 1050.88, 358.4660, 5},
    {2218.39, -1076.21, 1050.48, 95.2635, 1},
    {2496.00, -1692.08, 1014.74, 177.8159, 3},
    {2365.25, -1135.58, 1050.88, 359.0367, 8},
    {2317.77, -1026.76, 1050.21, 359.0367, 9},
    {2324.41, -1149.54, 1050.71, 359.0367, 12},
    {1260.6603, -785.4005, 1091.9063, 270.9891, 5},
    {140.28, 1365.92, 1083.85, 9.6901, 5}
};

// sqlite
new DB:Database;



public OnFilterScriptInit()
{
    print("\n-------------------------------------");
    print("Sistema C-casas carregado com sucesso.");
    print("   Criado por Cleyson Stein - StNN.");
    print("    Todos os direitos reservados.");
    print("-------------------------------------\n");

    ConectarDB();
    CarregarCasas();
    EnableStuntBonusForAll(0);
    DisableInteriorEnterExits();
    return 1;
}

public OnFilterScriptExit()
{
    db_close(Database);

    for(new i = 0; i < MAX_CASAS; ++i)
    {
        DestroyDynamicPickup(c[i][cPickup]);
        DestroyDynamicMapIcon(c[i][cIcone]);
        DestroyDynamic3DTextLabel(c[i][cText]);
    }
    return 1;
}

public OnPlayerConnect(playerid)
{
    GetPlayerName(playerid, p[playerid][Nome], 24);
    CarregarDadosPlayer(playerid);
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    if(p[playerid][TemCasa] > 0) SalvarDadosPlayer(playerid);
    return 1;
}





// ============= COMMANDS ADMIN
CMD:acasa(playerid)
{
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, VERMELHO, "Comando restrito a administradores.");

    new String_COMANDOS[220]; //
    format(String_COMANDOS, sizeof String_COMANDOS, "");

    strcat(String_COMANDOS, "{009900}ADMIN C-CASAS\n\n");
    strcat(String_COMANDOS, "{CECECE}/criarcasa {FFFFFF}- Criar uma casa.\n");
    strcat(String_COMANDOS, "{CECECE}/editarcasa {FFFFFF}- Editar uma casa.\n");
    strcat(String_COMANDOS, "{CECECE}/deletarcasa {FFFFFF}- Deletar casa.\n");
    strcat(String_COMANDOS, "{CECECE}/ircasa {FFFFFF}- Ir a uma casa.\n");

    ShowPlayerDialog(playerid, 9545, DIALOG_STYLE_MSGBOX, "Comandos Admin C-Casas", String_COMANDOS, "Ok", "");
    return 1;
}

CMD:criarcasa(playerid, params[])
{
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, VERMELHO, "Comando restrito a administradores.");
    if(sscanf(params, "ii", params[0], params[1])) return SendClientMessage(playerid, CINZA, "Use /criarcasa [preco] [int 0a10]");

    Criar_Casa(playerid, TOTALCASA+1, params[0], params[1]);
    return 1;
}

CMD:ircasa(playerid, params[])
{
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, VERMELHO, "Comando restrito a administradores.");
    if(sscanf(params, "i", params[0])) return SendClientMessage(playerid, CINZA, "Use /ircasa [id]");

    Ir_Casa(playerid, params[0]);
    return 1;
}

CMD:editarcasa(playerid, params[])
{
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, VERMELHO, "Comando restrito a administradores.");
    if(sscanf(params, "iii", params[0], params[1], params[2])) return SendClientMessage(playerid, CINZA, "Use /editarcasa [id] [preco] [int 0a10]");

    Editar_Casa(playerid, params[0], params[1], params[2]);
    return 1;
}

CMD:deletarcasa(playerid, params[])
{
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, VERMELHO, "Comando restrito a administradores.");
    if(sscanf(params, "i", params[0])) return SendClientMessage(playerid, CINZA, "Use /deletarcasa [id]");

    Deletar_Casa(playerid, params[0]);
    return 1;
}






// ================= COMMANDS PLAYERS

/*CMD:dinheiro(playerid)
{
    GivePlayerMoney(playerid, 500000);
    return 1;
}
*/


CMD:comprarcasa(playerid)
{
    for(new i = 0; i < MAX_CASAS; i++)
    {
        if(IsPlayerInRangeOfPoint(playerid, 1, c[i][cX], c[i][cY], c[i][cZ]))
        {
            if(p[playerid][TemCasa] > 0) return SendClientMessage(playerid, VERMELHO, "Você ja possue uma casa.");
            if(c[i][cTemDono] == 1) return SendClientMessage(playerid, VERMELHO, "Essa casa ja possue dono.");
            if(GetPlayerMoney(playerid) < c[i][cPreco]) return SendClientMessage(playerid, VERMELHO, "Dinheiro insuficiente.");

            format(c[i][cDono], 24, p[playerid][Nome]);
            c[i][cTemDono] = 1;
            p[playerid][TemCasa] = i;
            SendClientMessage(playerid, LARANJA, "Casa adiquirida com sucesso.");
            GivePlayerMoney(playerid, -c[i][cPreco]);

            DestroyDynamicPickup(c[i][cPickup]);
            DestroyDynamicMapIcon(c[i][cIcone]);
            DestroyDynamic3DTextLabel(c[i][cText]);

            new texto[200];
            c[i][cIcone] = CreateDynamicMapIcon(c[i][cX], c[i][cY], c[i][cZ], 32, -1);
            c[i][cPickup] = CreateDynamicPickup(19522, 21, c[i][cX], c[i][cY], c[i][cZ]);//1272

            format(texto, sizeof(texto), "{B22222}CASA ID: {FFFFFF}%d\n{CD5C5C}Dono: {FFFFFF}%s\n{CD5C5C}Preço: {FFFFFF}$ %d{CD5C5C}\n/ajudacasa", i, c[i][cDono], c[i][cPreco]);
            c[i][cText] = CreateDynamic3DTextLabel(texto, 0xFFFFFFAA, c[i][cX], c[i][cY], c[i][cZ]+1, 20);

            new Query[80];
            format(Query, sizeof(Query), "UPDATE CASAS SET DONO ='%s', TEMDONO = 1 WHERE ID =%d", c[i][cDono], i);
            db_query(Database, Query);
            break;
        }
    }
    return 1;
}

CMD:vendercasa(playerid)
{
    for(new i = 0; i < MAX_CASAS; i++)
    {
        if(IsPlayerInRangeOfPoint(playerid, 1, c[i][cX], c[i][cY], c[i][cZ]))
        {
            if(p[playerid][TemCasa] == 0) return SendClientMessage(playerid, VERMELHO, "Você não possue uma casa.");
            if(c[i][cTemDono] == 0) return SendClientMessage(playerid, VERMELHO, "Essa casa não possue dono.");
            if(p[playerid][TemCasa] == i)
            {
                SendClientMessage(playerid, LARANJA, "Casa vendida com sucesso.");
                GivePlayerMoney(playerid, c[i][cPreco]/2);
                format(c[i][cDono], 24, "Nenhum");
                c[i][cTemDono] = 0;
                p[playerid][TemCasa] = 0;

                DestroyDynamicPickup(c[i][cPickup]);
                DestroyDynamicMapIcon(c[i][cIcone]);
                DestroyDynamic3DTextLabel(c[i][cText]);

                new texto[200];
                c[i][cIcone] = CreateDynamicMapIcon(c[i][cX], c[i][cY], c[i][cZ], 31, -1);
                c[i][cPickup] = CreateDynamicPickup(1273, 21, c[i][cX], c[i][cY], c[i][cZ]);

                format(texto, sizeof(texto), "{2E8B57}CASA ID: {FFFFFF}%d\n{3CB371}Dono: {FFFFFF}%s\n{3CB371}Preço: {FFFFFF}$ %d\n{3CB371}Aperte 'F' para entrar\n/ajudacasa", i, c[i][cDono], c[i][cPreco]);
                c[i][cText] = CreateDynamic3DTextLabel(texto, 0xFFFFFFAA, c[i][cX], c[i][cY], c[i][cZ]+1, 20);

                new Query[80];
                format(Query, sizeof(Query), "UPDATE CASAS SET DONO ='%s', TEMDONO = 0 WHERE ID =%d", c[i][cDono], i);
                db_query(Database, Query);
                break;

                } else {

                SendClientMessage(playerid, VERMELHO, "Essa casa não é sua.");
                return 1;
               }
        }
    }
    return 1;
}

CMD:trancar(playerid)
{
    for(new i = 0; i < MAX_CASAS; i++)
    {
        if(IsPlayerInRangeOfPoint(playerid, 1, c[i][cX], c[i][cY], c[i][cZ]))
        {
            if(p[playerid][TemCasa] == 0) return SendClientMessage(playerid, VERMELHO, "Você não possue uma casa.");
            if(c[i][cTemDono] == 0) return SendClientMessage(playerid, VERMELHO, "Essa casa não possue dono.");
            if(p[playerid][TemCasa] == i)
            {
                new Query[80];
                if(c[i][cTrancada] == 0)
                {
                    SendClientMessage(playerid, LARANJA, "Casa trancada.");
                    c[i][cTrancada] = 1;

                    format(Query, sizeof(Query), "UPDATE CASAS SET TRANCADA = 1 WHERE ID =%d", i);
                    db_query(Database, Query);
                    break;

                    } else {

                    SendClientMessage(playerid, LARANJA, "Casa destrancada.");
                    c[i][cTrancada] = 0;

                    format(Query, sizeof(Query), "UPDATE CASAS SET TRANCADA = 0 WHERE ID =%d", i);
                    db_query(Database, Query);
                    break;
                }
                } else {

                SendClientMessage(playerid, VERMELHO, "Essa casa não é sua.");
                return 1;
               }
        }
    }
    return 1;
}

CMD:ajudacasa(playerid)
{
    ShowPlayerDialog(playerid, 9595, DIALOG_STYLE_MSGBOX, "Ajuda C-Casas","{009900}CASAS\n\n{CECECE}/comprarcasa {FFFFFF}- Comprar uma casa.\n{CECECE}/vendercasa {FFFFFF}- Vender sua casa.\n{CECECE}/trancar {FFFFFF}- trancar | destrancar casa.\n", "Ok", "");
    return 1;
}






public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(newkeys == KEY_SECONDARY_ATTACK) // TECLA F
    {
        for(new x = 0; x < MAX_CASAS; x++)
        {
            if(IsPlayerInRangeOfPoint(playerid, 1, c[x][cX], c[x][cY], c[x][cZ]))
            {
                if(c[x][cTemDono] == 0)
                {
                    SetPlayerPos(playerid, interior[c[x][cInt]][iX], interior[c[x][cInt]][iY], interior[c[x][cInt]][iZ]);
                    SetPlayerFacingAngle(playerid, interior[c[x][cInt]][iA]);
                    SetPlayerInterior(playerid, interior[c[x][cInt]][iID]);
                    p[playerid][EntrouCasa] = x;

                    SendClientMessage(playerid, LARANJA, "Casa a venda! Para comprar use /comprarcasa no pickup de fora. Use 'N' para sair.");
                    break;

                }

                if(c[x][cTemDono] == 1)
                {
                    if(c[x][cTrancada] == 1 && p[playerid][TemCasa] != x) return SendClientMessage(playerid, VERMELHO, "Casa trancada.");

                    if(p[playerid][TemCasa] == x)
                    {
                        SetPlayerPos(playerid, interior[c[x][cInt]][iX], interior[c[x][cInt]][iY], interior[c[x][cInt]][iZ]);
                        SetPlayerFacingAngle(playerid, interior[c[x][cInt]][iA]);
                        SetPlayerInterior(playerid, interior[c[x][cInt]][iID]);
                        p[playerid][EntrouCasa] = x;

                        SendClientMessage(playerid, LARANJA, "Bem vindo a sua casa. Use 'N' para sair.");
                        break;

                        } else {

                        SendClientMessage(playerid, VERMELHO, "Essa casa não é sua.");
                        return 1;
                    }
                }
            }
        }
    }

    if(newkeys == 131072) // TECLA N
    {
        if(p[playerid][EntrouCasa] > 0)
        {
            SetPlayerPos(playerid, c[p[playerid][EntrouCasa]][cX], c[p[playerid][EntrouCasa]][cY], c[p[playerid][EntrouCasa]][cZ]);
            SetPlayerInterior(playerid, 0);
            p[playerid][EntrouCasa] = 0;
        }
    }
    return 1;
}






// ============== DATA
ConectarDB()
{
    if((Database = db_open("C-Casas.db")) == DB:0)
    {
        SendRconCommand("exit");
        print("Falha ao se conectar a DataBase SQlite"); // DEBUG

        } else {

        print("Conectado com sucesso a DataBase SQlite."); // DEBUG
    }
    //criar a db esta em db.txt

    new Query[280];
    format(Query, sizeof(Query), "CREATE TABLE IF NOT EXISTS CASAS(ID INTEGER PRIMARY KEY AUTOINCREMENT,\
    DONO TEXT DEFAULT '',\
    X FLOAT DEFAULT 0.0,\
    Y FLOAT DEFAULT 0.0,\
    Z FLOAT DEFAULT 0.0,\
    INTERIOR INTEGER DEFAULT 0,\
    TRANCADA INTEGER DEFAULT 0,\
    TEMDONO INTEGER DEFAULT 0,\
    PRECO INTEGER DEFAULT 0)"
);
    db_query(Database, Query);

    format(Query, sizeof(Query), "CREATE TABLE IF NOT EXISTS DONOS(ID INTEGER PRIMARY KEY AUTOINCREMENT, NOME TEXT DEFAULT '', CASAID INTEGER DEFAULT 0)");
    db_query(Database, Query);

    return 1;
}

CarregarDadosPlayer(playerid)
{
    new DBResult:Result, Query[65];
    format(Query, sizeof(Query), "SELECT * FROM DONOS WHERE NOME = '%s'", p[playerid][Nome]);
    Result = db_query(Database, Query);

    if(db_num_rows(Result))
    {
        p[playerid][TemCasa] = db_get_field_assoc_int(Result, "CASAID");

        } else {

        new Query2[75];
        format(Query2, sizeof(Query2), "INSERT INTO DONOS (NOME, CASAID) VALUES ('%s', 0)", p[playerid][Nome]);
        db_query(Database, Query2);


        p[playerid][TemCasa] = 0;
    }
    db_free_result(Result);
    return 1;
}

SalvarDadosPlayer(playerid)
{
    new Query[75];
    format(Query, sizeof(Query), "UPDATE DONOS SET CASAID =%d WHERE NOME ='%s'", p[playerid][TemCasa], p[playerid][Nome]);
    db_query(Database, Query);
    return 1;
}




// ============== INIT
CarregarCasas()
{
    new DBResult:Result, Query[50];
    for(new i = 0; i < MAX_CASAS; i++)
    {
        format(Query, sizeof(Query), "SELECT * FROM CASAS WHERE ID = %d", i);
        Result = db_query(Database, Query);

        if(db_num_rows(Result))
        {
            db_get_field_assoc(Result, "DONO", c[i][cDono], 24);

            c[i][cX] = db_get_field_assoc_float(Result, "X");
            c[i][cY] = db_get_field_assoc_float(Result, "Y");
            c[i][cZ] = db_get_field_assoc_float(Result, "Z");

            c[i][cTemDono] = db_get_field_assoc_int(Result, "TEMDONO");
            c[i][cPreco] = db_get_field_assoc_int(Result, "PRECO");
            c[i][cInt] = db_get_field_assoc_int(Result, "INTERIOR");
            c[i][cTrancada] = db_get_field_assoc_int(Result, "TRANCADA");
            TOTALCASA ++;

            CriarCasa(i);
        }
        db_free_result(Result);
    }

    printf("\nCasas carregadas: %d", TOTALCASA);
    return 1;
}

CriarCasa(i)
{
    new texto[200];
    if(c[i][cTemDono] == 0)
    {
        c[i][cIcone] = CreateDynamicMapIcon(c[i][cX], c[i][cY], c[i][cZ], 31, -1);
        c[i][cPickup] = CreateDynamicPickup(1273, 21, c[i][cX], c[i][cY], c[i][cZ]);

        format(texto, sizeof(texto), "{2E8B57}CASA ID: {FFFFFF}%d\n{3CB371}Dono: {FFFFFF}%s\n{3CB371}Preço: {FFFFFF}$ %d\n{3CB371}Aperte 'F' para entrar\n/ajudacasa", i, c[i][cDono], c[i][cPreco]);
        c[i][cText] = CreateDynamic3DTextLabel(texto, 0xFFFFFFAA, c[i][cX], c[i][cY], c[i][cZ]+1, 20);
    }
    else if(c[i][cTemDono] == 1)
    {
        c[i][cIcone] = CreateDynamicMapIcon(c[i][cX], c[i][cY], c[i][cZ], 32, -1);
        c[i][cPickup] = CreateDynamicPickup(19522, 21, c[i][cX], c[i][cY], c[i][cZ]);//1272

        format(texto, sizeof(texto), "{B22222}CASA ID: {FFFFFF}%d\n{CD5C5C}Dono: {FFFFFF}%s\n{CD5C5C}Preço: {FFFFFF}$ %d{CD5C5C}\n/ajudacasa", i, c[i][cDono], c[i][cPreco]);
        c[i][cText] = CreateDynamic3DTextLabel(texto, 0xFFFFFFAA, c[i][cX], c[i][cY], c[i][cZ]+1, 20);
    }
    return 1;
}






// ============== ADMIN
Criar_Casa(playerid, id, preco, inte)
{
    new DBResult:Result, Query[160];
    format(Query, sizeof(Query), "SELECT * FROM CASAS WHERE ID = %d", id);
    Result = db_query(Database, Query);

    if(db_num_rows(Result))
    {
        SendClientMessage(playerid, VERMELHO, "Ocorreu um erro. Esse ID esta em uso.");

        } else {

        new Float:Pos[3];
        GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);

        format(c[id][cDono], 24, "Nenhum");
        c[id][cX] = Pos[0];
        c[id][cY] = Pos[1];
        c[id][cZ] = Pos[2];
        c[id][cTemDono] = 0;
        c[id][cPreco] = preco;
        c[id][cInt] = inte;

        SendClientMessage(playerid, LARANJA, "Casa criada com sucesso.");
        CriarCasa(id);

        format(Query, sizeof(Query), "INSERT INTO CASAS(DONO, X, Y, Z, PRECO, INTERIOR) VALUES ('%s', %f, %f, %f, %d, %d)", c[id][cDono], c[id][cX], c[id][cY], c[id][cZ], c[id][cPreco], c[id][cInt]);
        db_query(Database, Query);

        TOTALCASA ++;
    }
    db_free_result(Result);
    return 1;
}

Editar_Casa(playerid, id, preco, interi)
{
    new DBResult:Result, Query[50];
    format(Query, sizeof(Query), "SELECT * FROM CASAS WHERE ID = %d", id);
    Result = db_query(Database, Query);

    if(db_num_rows(Result))
    {
        new string[60];
        format(string, sizeof(string), "Você editou a casa id %d com sucesso!", id);
        SendClientMessage(playerid, LARANJA, string);

        c[id][cPreco] = preco;
        c[id][cInt] = interi;

        DestroyDynamicPickup(c[id][cPickup]);
        DestroyDynamicMapIcon(c[id][cIcone]);
        DestroyDynamic3DTextLabel(c[id][cText]);

        CriarCasa(id);

        } else {

        SendClientMessage(playerid, VERMELHO, "Ocorreu um erro. Esse ID não existe.");
    }
    db_free_result(Result);
    return 1;
}

Ir_Casa(playerid, id)
{
    new DBResult:Result, Query[50];
    format(Query, sizeof(Query), "SELECT * FROM CASAS WHERE ID = %d", id);
    Result = db_query(Database, Query);

    if(db_num_rows(Result))
    {
        new string[60];
        format(string, sizeof(string), "Você foi a casa id %d.", id);
        SendClientMessage(playerid, LARANJA, string);

        SetPlayerPos(playerid, c[id][cX], c[id][cY], c[id][cZ]);
        SetPlayerInterior(playerid, 0);

        } else {

        SendClientMessage(playerid, VERMELHO, "Ocorreu um erro. Esse ID não existe.");
    }
    db_free_result(Result);
    return 1;
}

Deletar_Casa(playerid, id)
{
    new DBResult:Result, Query[50];
    format(Query, sizeof(Query), "SELECT * FROM CASAS WHERE ID = %d", id);
    Result = db_query(Database, Query);

    if(db_num_rows(Result))
    {
        format(Query, sizeof(Query), "DELETE FROM CASAS WHERE ID = %d", id);
        db_query(Database, Query);

        new string[60];
        format(string, sizeof(string), "Você excluiu a casa id %d com sucesso!", id);
        SendClientMessage(playerid, LARANJA, string);

        format(c[id][cDono], 24, "Nenhum");
        c[id][cX] = -1;
        c[id][cY] = -1;
        c[id][cZ] = -1;

        c[id][cTemDono] = -1;
        c[id][cPreco] = -1;
        c[id][cInt] = -1;
        c[id][cTrancada] = -1;

        DestroyDynamicPickup(c[id][cPickup]);
        DestroyDynamicMapIcon(c[id][cIcone]);
        DestroyDynamic3DTextLabel(c[id][cText]);

        TOTALCASA --;

        } else {

        SendClientMessage(playerid, VERMELHO, "Ocorreu um erro. Esse ID não existe.");
    }
    db_free_result(Result);
    return 1;
}

Help with highest scores on server

$
0
0
I'm running a deathmatch server and I didn't encounter this issue until today when my server reached more than 1000 registered accounts.

I'm using Ryder's quickSort to get 5 highest scores on server:
Code:

stock GetPlayerHighestScores(array[][rankingEnum], left, right)
{
    new
        tempLeft = left,
        tempRight = right,
        pivot = array[(left + right) / 2][user_Score],
        tempVar
    ;
    while(tempLeft <= tempRight)
    {
        while(array[tempLeft][user_Score] > pivot) tempLeft++;
        while(array[tempRight][user_Score] < pivot) tempRight--;

        if(tempLeft <= tempRight)
        {
            tempVar = array[tempLeft][user_Score], array[tempLeft][user_Score] = array[tempRight][user_Score], array[tempRight][user_Score] = tempVar;
            tempVar = array[tempLeft][user_ID], array[tempLeft][user_ID] = array[tempRight][user_ID], array[tempRight][user_ID] = tempVar;
            tempLeft++, tempRight--;
        }
    }
    if(left < tempRight) GetPlayerHighestScores(array, left, tempRight);
    if(tempLeft < right) GetPlayerHighestScores(array, tempLeft, right);
}

And it was all working like a charm up to now.
However as more and more players register my loop becomes higher and higher and once it reached +1000 users it stopped working (I'm aware of the issure I'm just looking for someone with more experience to provide me with some tips to solve this).

Function that is being called every 60 seconds:
Code:

forward updateTop5();
public updateTop5()
{
    new playerScores[1000][rankingEnum], index;
    new check_str[64];
    for(new i; i < MAX_USERS; ++i)
    {
        format(check_str, 64, USERID_FOLDER, i);
        if(fexist(check_str))
        {
            playerScores[index][user_Score] = User[i][user_kills];
            playerScores[index++][user_ID] = i;
        }
    }
    GetPlayerHighestScores(playerScores, 0, index);
    for(new i; i < 5; ++i)
    {
        if(i < index)
        {
            topKills[i+1][tfKills] = playerScores[i][user_Score];
            strmid(topKills[i+1][tfName], User[playerScores[i][user_ID]][user_Name], 0, strlen(User[playerScores[i][user_ID]][user_Name]), 255);
        }
        else
        {
            topKills[i+1][tfKills] = 0;
            strmid(topKills[i+1][tfName], "None", 0, strlen("None"), 255);
        }
    }
    SaveTopFive();
    UpdateTopFiveLabel();
    return 1;
}

The real issue is here:
Code:

new check_str[64];
for(new i; i < MAX_USERS; ++i)
{
    format(check_str, 64, USERID_FOLDER, i);
    if(fexist(check_str))
    {
        playerScores[index][user_Score] = User[i][user_kills];
        playerScores[index++][user_ID] = i;
    }
}

'MAX_USERS' is 15000 (Yeah ik..) but! i included fexist check to reduce the loop a bit and as I said, when loop exceeded 1000 or 1024 (not rly sure) it just don't function anymore so any help is appreciated.

I've heard that mysql would be much easier but I just have no experience with it and if there's any chance I could fix this it would be great.
Viewing all 18226 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>