SA-MP Forums Archive
commands problem - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: commands problem (/showthread.php?tid=614280)



commands problem - JuzDoiT - 06.08.2016

hello ,guys .. i update my old server with 0.3.7 plugins .. server work good .. but when i use some admin commands .. server going offline i dont know what happen .. ?? please help me


Quote:

----------
Loaded log file: "server_log.txt".
----------

SA-MP Dedicated Server
----------------------
v0.3.7-R2, ©2005-2015 SA-MP Team

[16:57:03]
[16:57:03] Server Plugins
[16:57:03] --------------
[16:57:03] Loading plugin: crashdetect.so
[16:57:03] CrashDetect v4.15.1 is OK.
[16:57:03] Loaded.
[16:57:03] Loading plugin: sscanf.so
[16:57:03]

[16:57:03] ===============================

[16:57:03] sscanf plugin loaded.

[16:57:03] Version: 2.8.2

[16:57:03] © 2012 Alex "******" Cole

[16:57:03] ===============================

[16:57:03] Loaded.
[16:57:03] Loading plugin: streamer.so
[16:57:03]

*** Streamer Plugin v2.8.2 by Incognito loaded ***

[16:57:03] Loaded.
[16:57:03] Loading plugin: MapAndreas.so
[16:57:03] Loaded.
[16:57:03] Loading plugin: Whirlpool.so
[16:57:03]
[16:57:03] ==================
[16:57:03]
[16:57:03] Whirlpool loaded
[16:57:03]
[16:57:03] ==================
[16:57:03]
[16:57:03] Loaded.
[16:57:03] Loaded 5 plugins.

[16:57:03]
[16:57:03] Filterscripts
[16:57:03] ---------------
[16:57:03] Loading filterscript 'UltraHost.amx'...
[16:57:03] Loaded 1 filterscripts.

[16:57:03]
[16:57:03]
[16:57:03]
[16:57:03] =======================================
[16:57:03] | |
[16:57:03] | YSI version 3.09.0684 |
[16:57:03] | By Alex "******" Cole |
[16:57:03] | |
[16:57:03] =======================================
[16:57:03]
[16:57:03]
[16:57:03]
[16:57:03]
---------------------------------
[16:57:03] Fucking DM Server By banana_ghost
[16:57:03] ---------------------------------

[16:57:03] MapAndreas: plugin could not init!
[16:57:03] MapAndreas: check files and make sure you have enough memory!
[16:57:03] MapAndreas: plugin could not init!
[16:57:03] MapAndreas: check files and make sure you have enough memory!
[16:57:03] Loaded 3 vehicles from: vehicles/trains.txt
[16:57:03] Loaded 3 vehicles from: vehicles/pilots.txt
[16:57:03] Loaded 15 vehicles from: vehicles/lv_law.txt
[16:57:03] Loaded 39 vehicles from: vehicles/lv_airport.txt
[16:57:03] Loaded 255 vehicles from: vehicles/lv_gen.txt
[16:57:03] Loaded 38 vehicles from: vehicles/sf_law.txt
[16:57:03] Loaded 35 vehicles from: vehicles/sf_airport.txt
[16:57:03] Loaded 353 vehicles from: vehicles/sf_gen.txt
[16:57:03] Loaded 24 vehicles from: vehicles/ls_law.txt
[16:57:03] Loaded 37 vehicles from: vehicles/ls_airport.txt
[16:57:03] Loaded 98 vehicles from: vehicles/ls_gen_inner.txt
[16:57:03] Loaded 389 vehicles from: vehicles/ls_gen_outer.txt
[16:57:03] Loaded 71 vehicles from: vehicles/whetstone.txt
[16:57:03] Loaded 168 vehicles from: vehicles/bone.txt
[16:57:03] Loaded 61 vehicles from: vehicles/flint.txt
[16:57:03] Loaded 96 vehicles from: vehicles/tierra.txt
[16:57:03] Loaded 96 vehicles from: vehicles/red_county.txt
[16:57:03] Total vehicles from files: 1781
[16:57:03]
---------------------------------
[16:57:03] Fucking DM Server By maldo
[16:57:03] ---------------------------------

[16:57:03] Number of vehicle models: 173




Re: commands problem - Shinja - 06.08.2016

Anything in the logs?


Re: commands problem - JuzDoiT - 06.08.2016

bro, this problem is only .. when i use admins command ,, other command working good


Re: commands problem - Shinja - 06.08.2016

Show us the logs when you use a command that crashes the server
and use nativechecker btw


Re: commands problem - JuzDoiT - 06.08.2016

nothing is wrong in serverlog i use crashdetect and nothing wrong

Quote:

----------
Loaded log file: "server_log.txt".
----------

SA-MP Dedicated Server
----------------------
v0.3.7-R2, ©2005-2015 SA-MP Team

[16:57:03]
[16:57:03] Server Plugins
[16:57:03] --------------
[16:57:03] Loading plugin: crashdetect.so
[16:57:03] CrashDetect v4.15.1 is OK.
[16:57:03] Loaded.
[16:57:03] Loading plugin: sscanf.so
[16:57:03]

[16:57:03] ===============================

[16:57:03] sscanf plugin loaded.

[16:57:03] Version: 2.8.2

[16:57:03] © 2012 Alex "******" Cole

[16:57:03] ===============================

[16:57:03] Loaded.
[16:57:03] Loading plugin: streamer.so
[16:57:03]

*** Streamer Plugin v2.8.2 by Incognito loaded ***

[16:57:03] Loaded.
[16:57:03] Loading plugin: MapAndreas.so
[16:57:03] Loaded.
[16:57:03] Loading plugin: Whirlpool.so
[16:57:03]
[16:57:03] ==================
[16:57:03]
[16:57:03] Whirlpool loaded
[16:57:03]
[16:57:03] ==================
[16:57:03]
[16:57:03] Loaded.
[16:57:03] Loaded 5 plugins.

[16:57:03]
[16:57:03] Filterscripts
[16:57:03] ---------------
[16:57:03] Loading filterscript 'UltraHost.amx'...
[16:57:03] Loaded 1 filterscripts.

[16:57:03]
[16:57:03]
[16:57:03]
[16:57:03] =======================================
[16:57:03] | |
[16:57:03] | YSI version 3.09.0684 |
[16:57:03] | By Alex "******" Cole |
[16:57:03] | |
[16:57:03] =======================================
[16:57:03]
[16:57:03]
[16:57:03]
[16:57:03]
---------------------------------
[16:57:03] Fucking DM Server By banana_ghost
[16:57:03] ---------------------------------

[16:57:03] MapAndreas: plugin could not init!
[16:57:03] MapAndreas: check files and make sure you have enough memory!
[16:57:03] MapAndreas: plugin could not init!
[16:57:03] MapAndreas: check files and make sure you have enough memory!
[16:57:03] Loaded 3 vehicles from: vehicles/trains.txt
[16:57:03] Loaded 3 vehicles from: vehicles/pilots.txt
[16:57:03] Loaded 15 vehicles from: vehicles/lv_law.txt
[16:57:03] Loaded 39 vehicles from: vehicles/lv_airport.txt
[16:57:03] Loaded 255 vehicles from: vehicles/lv_gen.txt
[16:57:03] Loaded 38 vehicles from: vehicles/sf_law.txt
[16:57:03] Loaded 35 vehicles from: vehicles/sf_airport.txt
[16:57:03] Loaded 353 vehicles from: vehicles/sf_gen.txt
[16:57:03] Loaded 24 vehicles from: vehicles/ls_law.txt
[16:57:03] Loaded 37 vehicles from: vehicles/ls_airport.txt
[16:57:03] Loaded 98 vehicles from: vehicles/ls_gen_inner.txt
[16:57:03] Loaded 389 vehicles from: vehicles/ls_gen_outer.txt
[16:57:03] Loaded 71 vehicles from: vehicles/whetstone.txt
[16:57:03] Loaded 168 vehicles from: vehicles/bone.txt
[16:57:03] Loaded 61 vehicles from: vehicles/flint.txt
[16:57:03] Loaded 96 vehicles from: vehicles/tierra.txt
[16:57:03] Loaded 96 vehicles from: vehicles/red_county.txt
[16:57:03] Total vehicles from files: 1781
[16:57:03]
---------------------------------
[16:57:03] Fucking DM Server By banana_ghost
[16:57:03] ---------------------------------

[16:57:03] Number of vehicle models: 173
[16:59:09] [connection] 217.24.250.130:59710 requests connection cookie.
[16:59:10] [connection] incoming connection: 217.24.250.130:59710 id: 0
[16:59:10] [join] ShadyELF has joined the server (0:217.24.250.130)
[16:59:35] [connection] 79.106.6.240:1070 requests connection cookie.
[16:59:36] [connection] incoming connection: 79.106.6.240:1070 id: 1
[16:59:37] [join] Game has joined the server (1:79.106.6.240)
[16:59:41] RCON (In-Game): Player #0 (ShadyELF) failed login.
[16:59:47] RCON (In-Game): Player #0 (ShadyELF) has logged in.
[16:59:49] [chat] [Game]: so ?
[16:59:51] [chat] [ShadyELF]: dude
[16:59:53] [chat] [ShadyELF]: listen me
[17:00:00] [chat] [Game]: yeah
[17:00:03] [chat] [ShadyELF]: im working on this server and .. got some lag
[17:00:12] [chat] [Game]: yeah i saw
[17:00:12] [chat] [ShadyELF]: when i try to admin you server going offline
[17:00:16] [chat] [ShadyELF]: .. but dont worry
[17:00:19] [chat] [ShadyELF]: ill fix it soon
[17:00:41] [kill] Game killed ShadyELF UZI
[17:00:42] [chat] [ShadyELF]: gg
[17:00:51] [chat] [Game]: td its not working
[17:00:51] [chat] [Game]: td its not working
[17:00:54] [chat] [ShadyELF]: yes
[17:00:56] [chat] [ShadyELF]: ill fix it
[17:00:58] [kill] ShadyELF killed Game Sawn-off Shotgun
[17:01:03] [chat] [ShadyELF]: this server will be the best soon
[17:01:13] [kill] Game killed ShadyELF UZI
[17:01:20] [chat] [ShadyELF]: ive post right now for the problem in samp forum..
[17:01:28] [chat] [ShadyELF]: im waiting to fix the bug

Quote:

CMD:aduty(playerid, params[])
{
if(LoginCheck[playerid] == 0) return SendClientMessage(playerid, COLOR_RED, ""ERROR_MESSAGE"");
if(pInfo[playerid][AdminLevel] < 1) return SendClientMessage(playerid, COLOR_RED, ""ERROR_MESSAGE"");
else
if(aduty[playerid] == 0)
{
//Saving Stuff Before Going On Admin Duty
aduty[playerid] =1;
offduty[playerid] =0;
GetPlayerHealth(playerid, ahealth[playerid]);
GetPlayerArmour(playerid, aarmor[playerid]);
aInter[playerid] = GetPlayerInterior(playerid);
aWorld[playerid] = GetPlayerVirtualWorld(playerid);
GetPlayerPos(playerid,aX[playerid],aY[playerid],aZ[playerid]);
SpawnPlayer(playerid);
AdminMsg(playerid,"aduty (On Duty)");
}
else
{
aduty[playerid] =0;
offduty[playerid] =1;
aInter[playerid] = GetPlayerInterior(playerid);
aWorld[playerid] = GetPlayerVirtualWorld(playerid);
GetPlayerPos(playerid,aX[playerid],aY[playerid],aZ[playerid]);
SpawnPlayer(playerid);
AdminMsg(playerid,"aduty (Off Duty)");
}
return 1;
}




Re: commands problem - Shinja - 06.08.2016

Are you saving pos, health and armour as floats?
Show us your stock AdminMessage


Re: commands problem - JuzDoiT - 06.08.2016

ey man i'm using

maybe i need to use anyother.. i dont know

Quote:

plugins crashdetect.so sscanf.so streamer.so MapAndreas.so Whirlpool.so nativechecker.so

Quote:

stock AdminMsg(playerid, cmdused[])
{
new str1[128];
format(str1,sizeof(str1),"Admin %s (%d) Issued Command /%s.",pname(playerid),playerid,cmdused);
Admin(str1);
foreach(new i : Player)
{
if(pInfo[playerid][AdminLevel] >= 1)
{
if(pInfo[playerid][AdminLevel] <= 5)
{
if(pInfo[i][AdminLevel] >= 1)
{
if(LoginCheck[i] == 1)
{
SendClientMessage(i,COLOR_HOTPINK,str1);
}
}
}
}
}
return 1;
}

Quote:

//Includes
#include <a_samp>
#include <sscanf2>
#include <izcmd>
#include <dini>
#include <streamer>
#include <foreach>
#include <YSI\y_ini>
#include <YSI\y_master>
#include <mSelection>
#include <mapandreas>
#include "../include/gl_common.inc"




Re: commands problem - Shinja - 06.08.2016

And what is your Admin(string[]) stock?


Re: commands problem - JuzDoiT - 06.08.2016

should i create folder for this?


Quote:

stock Admin(string[])
{
new entry[200];
format(entry, sizeof(entry), "%s\r\n",string);
new File:hFile;
hFile = fopen("ServerInfo/log.log", io_append);
fwrite(hFile, entry);
fclose(hFile);
}




Re: commands problem - Shinja - 06.08.2016

Try this
PHP код:
stock AdminMsg(playeridcmdused[])
{
    new 
str1[128];
    
format(str1,sizeof(str1),"Admin %s (%d) Issued Command /%s.",pname(playerid),playerid,cmdused);
    
Admin(str1);
    foreach(new 
Player)
    {
        if(
pInfo[playerid][AdminLevel] >= && LoginCheck[i] == 1SendClientMessage(i,COLOR_HOTPINK,str1);
    }
    return 
1;

and return 1; on stock Admin
also, create folder ServerInfo in scriptfiles if not exists, server won't create it
MapAndreas plugin isn't loading successfully


Re: commands problem - Konstantinos - 06.08.2016

The folder must exist and you don't check if the file handle is valid. If it is not and it is used in a file function, that function will crash the server.

pawn Code:
Admin(const string[])
{
    new File: hFile = fopen("ServerInfo/log.log", io_append);

    if (!hFile) return; // invalid handle, don't proceed

    fwrite(hFile, string);
    fwrite(hFile, "\r\n");
    fclose(hFile);
}
Quote:
Originally Posted by Shinja
View Post
Try this
PHP Code:
stock AdminMsg(playeridcmdused[])
{
    foreach(new 
Player)
    {
        if(
pInfo[playerid][AdminLevel] >= && LoginCheck[i] ==)
        {
            new 
str1[128];
            
format(str1,sizeof(str1),"Admin %s (%d) Issued Command /%s.",pname(playerid),playerid,cmdused);
            
SendClientMessage(i,COLOR_HOTPINK,str1);
            
Admin(str1);
            return 
1;
        }
        else return 
0;
    }

and return 1; on stock Admin
Returning any value inside a loop breaks, thus won't be sent to the rest of the admins. Creating a string inside a loop is also bad.


Re: commands problem - Shinja - 06.08.2016

Quote:
Originally Posted by Konstantinos
View Post
Returning any value inside a loop breaks, thus won't be sent to the rest of the admins. Creating a string inside a loop is also bad.
Thanks for info, creating string inside loop was inattentively.. Fixed


Re: commands problem - SyS - 06.08.2016

Quote:
Originally Posted by Shinja
View Post
Try this
PHP Code:
stock AdminMsg(playeridcmdused[])
{
    new 
str1[128];
    
format(str1,sizeof(str1),"Admin %s (%d) Issued Command /%s.",pname(playerid),playerid,cmdused);
    
Admin(str1);
    foreach(new 
Player)
    {
        if(
pInfo[playerid][AdminLevel] >= && LoginCheck[i] == 1SendClientMessage(i,COLOR_HOTPINK,str1);
    }
    return 
1;

and return 1; on stock Admin
also, create folder ServerInfo in scriptfiles if not exists, server won't create it
MapAndreas plugin isn't loading successfully
and also it should not be stock define it without any keyword


Re: commands problem - JuzDoiT - 06.08.2016

thanks man.. it fixed with ServerInfo folder..


Re: commands problem - Shinja - 06.08.2016

Quote:
Originally Posted by Sreyas
View Post
and also it should not be stock define it without any keyword
What you mean?


Re: commands problem - SyS - 06.08.2016

Quote:
Originally Posted by Shinja
View Post
What you mean?
remove the stock key word from that function