PDA

View Full Version : 0 Errors but gamemode blocks itself


Steveproxy5
18/05/2015, 05:21 PM
My gamemode crashes after a few minutes, I mean, you can't type any message or command, and all functions are disabled, but there is no error about pawn compiler. Please I need help, seriously , can you tell me how to do? What do you think about this one?

MP2
18/05/2015, 05:26 PM
Possibly an infinite loop. Do you have any while() loops?

Steveproxy5
18/05/2015, 05:30 PM
No I don't, why happens this? :l

Dokins
18/05/2015, 05:46 PM
Do you have any loops at all?

search

for(new

Steveproxy5
18/05/2015, 05:52 PM
I have a lot of cicle named for(new [...]
but when pawn compiles there is no error about anything

SoFahim
18/05/2015, 05:59 PM
Is your server freeze or just crashed?

Steveproxy5
18/05/2015, 06:01 PM
No, my server doesn't work any longer after a few minutes that's I can't type any command or message and I can't know why

Dokins
18/05/2015, 06:02 PM
Post your server log, please.

Steveproxy5
18/05/2015, 06:05 PM
Post your server log, please.

Which file? server_log.txt or crashinfo?

Steveproxy5
18/05/2015, 06:19 PM
Any help?

Vince
18/05/2015, 06:46 PM
I have a lot of cicle named for(new [...]
but when pawn compiles there is no error about anything

The compiler only checks the syntax. It does not account for logical errors. Consider:


for(new i = 100; i > 0; i++)
{
printf("%d", i);
}


This will run forever because i is forever greater than 0. The programmer intended to write 'i--', but due to force of habit wrote 'i++'.

Steveproxy5
18/05/2015, 06:58 PM
The compiler only checks the syntax. It does not account for logical errors. Consider:


for(new i = 100; i > 0; i++)
{
printf("%d", i);
}


This will run forever because i is forever greater than 0. The programmer intended to write 'i--', but due to force of habit wrote 'i++'.

Ok, how can I do then?

Toxik
18/05/2015, 06:59 PM
Dude .. post Server log file :)

Steveproxy5
18/05/2015, 07:03 PM
Dude .. post Server log file :)

Do you mean server_log.txt?

MP2
18/05/2015, 07:06 PM
Do you mean server_log.txt?
Well yes... He asked for the SERVER LOG.

Steveproxy5
18/05/2015, 07:11 PM
recent logs: http://pastebin.com/1Xu94Ay7

Steveproxy5
18/05/2015, 08:04 PM
Can anyone do anything?

Steveproxy5
18/05/2015, 08:14 PM
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase

Header size: 12364 bytes
Code size: 1770036 bytes
Data size: 12455036 bytes
Stack/heap size: 16384 bytes; estimated max. usage=5296 cells (21184 bytes)
Total requirements:14253820 bytes

Dokins
18/05/2015, 08:16 PM
I can't see any issues with the Server log. It brings us back to the loops. As MP2 said, there could be an illogical loop causing an infinite loop, this will crash ANY script, your best bet is check any recently added or edited loops and post them here.

Steveproxy5
18/05/2015, 08:25 PM
What do you think about ->

forward azione(playerid,string[]);
public azione(playerid,string[])//HO DOVUTO METTERE QUESTO PERCHE' NON SO' COM'E' FATTA LA VOSTRA GM
{
for(new u = 0; u < MAX_PLAYERS; u++)
{
if(IsPlayerConnected(u))
{
if( GetDistanceBetweenPlayers(playerid,u) < 30 )
{
SendClientMessage(u,0xFFFFFFAA,string);
}
}
}
}
forward crescita();
public crescita()
{
for(new i=0;i<MAX_PLAYERS;i++)
{
if(IsPlayerConnected(i))
{
if( StatoPianta[i] >= 1 )
{
StatoPianta[i] += 1;
if( StatoPianta[i] < 20 )
{
new Float:lX,Float:lY,Float:lZ;
GetObjectPos(Pianta[i],lX,lY,lZ);
MoveObject(Pianta[i],lX,lY,lZ+0.05,2.0);
}
}
}
}
}

case 3:
{
if(IsPlayerConnected(playerid))
{
if(gPlayerLogged[playerid] == 0)
{
SendClientMessage(playerid, 0xFF0000AA, "Devi effettura prima il login");
return 1;
}
for(new i=0; i<MAX_PLAYER_ATTACHED_OBJECTS; i++)
{
if(IsPlayerAttachedObjectSlotUsed(playerid, i)==0) {
SetPlayerAttachedObject(playerid, 1, 3026, 1, -0.125, -0.046, -0.004, -1.299, -0.5, -6.297, 1.0, 1.0, 1.0);
}
else {
RemovePlayerAttachedObject(playerid, i);
}

}
}
}

Steveproxy5
18/05/2015, 08:36 PM
I'm becoming mad, I can't solve this problem, what may I do?

Steveproxy5
18/05/2015, 08:42 PM
I'm trying to replace all 'i' with 'playerid'

Steveproxy5
18/05/2015, 09:05 PM
help me please i'm desperate i don't know anymore what to do

Jefff
19/05/2015, 12:38 AM
sscanf error: The current build ONLY supports 0.3d

Loading plugin: MapAndreas.dll
Failed.

EnableTirePopping() function is removed.

[warning] EnableZoneNames() is removed since 0.3

AllowAdminTeleport() : function is deprecated. Please see OnPlayerClickMap()

and you surprised that the server dies... in my opinion its from MapAndreas, you are using some functions from this plugin but he's not loaded so result could be one and sscanf error is also important

+

install crashdetect plugin and you will see what's exactly wrong

amirm3hdi
19/05/2015, 12:47 AM
Undo last changes you did, or delete functions till your GM works, then you'll know which part is wrong...

Toxik
19/05/2015, 07:14 AM
Codes removed

EnableTirePopping() function is removed. //removed

[warning] EnableZoneNames() is removed since 0.3 //removed

AllowAdminTeleport() : function is deprecated. Please see OnPlayerClickMap() //Function need to be fixed

and try download new verison of sscanf and MapAndreas.inc % MapAndreas.dll Plugin ;) hope you fix it

Steveproxy5
19/05/2015, 07:55 AM
I tried to download sscanf and streamer but there was no positive effect. Is stramer.dl same of mapandreas? I cant find this one

SoFahim
19/05/2015, 10:38 AM
No, my server doesn't work any longer after a few minutes that's I can't type any command or message and I can't know why

That mean your server freeze . If you using YSI3.1 then your problem would not be fix. Try to use YSI4.0 . It will help you to fix that. If you get for then 2+warning of Foreach loop , that mean you didn't update the loop of the foreach.

Old code is
foreach(player,i)

new code is foreach(new i, player)

If it don't help you then please -rep

Steveproxy5
19/05/2015, 11:27 AM
So do i have to replace ones each other?

CrazyRussainHacker
19/05/2015, 11:30 AM
Any help?

Post your server_log.txt here

Steveproxy5
19/05/2015, 12:33 PM
[07:25:53] *** Streamer Plugin: CreateDynamicObject: Expecting 12 parameter(s), but found 11
[07:24:17] *** Streamer Plugin: CreateDynamicObject: Expecting 12 parameter(s), but found 11
there are a lot of things like these

Steveproxy5
19/05/2015, 01:09 PM
SA-MP Dedicated Server
----------------------
v0.3.7, (C)2005-2015 SA-MP Team

[15:08:37] password = "" (string)
[15:08:37]
[15:08:37] Server Plugins
[15:08:37] --------------
[15:08:37] Loading plugin: streamer
[15:08:37]

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

[15:08:37] Loaded.
[15:08:37] Loading plugin: sscanf
[15:08:37]

[15:08:37] ===============================

[15:08:37] sscanf plugin loaded.

[15:08:37] (c) 2009 Alex "******" Cole

[15:08:37] 0.3d-R2 800 Players "dnee"

[15:08:37] ===============================

[15:08:37] sscanf error: The current build ONLY supports 0.3d
[15:08:37] Loaded.
[15:08:37] Loading plugin: crashdetect
[15:08:37] CrashDetect must be loaded before 'streamer.DLL'
[15:08:37] Failed.
[15:08:37] Loaded 2 plugins.

[15:08:37]
[15:08:37] Ban list
[15:08:37] --------
[15:08:37] Loaded: samp.ban
[15:08:37]
[15:08:37]
[15:08:37] Filterscripts
[15:08:37] ---------------
[15:08:37] Loading filterscript 'yrace.amx'...
[15:08:37]
+--------------------------------+
[15:08:37] | Yagu's Race Filterscript v0.4a |
[15:08:37] +--------------LOADED------------+

[15:08:37] Loading filterscript 'rcon.amx'...
[15:08:37] Loading filterscript 'antiping.amx'...
[15:08:37] Loading filterscript 'carmods.amx'...
[15:08:37] Loading filterscript 'antibot.amx'...
[15:08:37]
[15:08:37] Ban list
[15:08:37] --------
[15:08:37] Loaded: samp.ban
[15:08:37]
[15:08:37] Bots Security Script v1.0B loaded
[15:08:37] Loaded 5 filterscripts.

Steveproxy5
19/05/2015, 01:41 PM
There is a problem about loading of sscanf

Steveproxy5
19/05/2015, 02:09 PM
SOLVED - but i don't understand why there is no textdraw about speedometer when i enter in any vehicle

for(new i = 0; i < MAX_PLAYERS; i++)
{
Contachilometri[i][ShowSpeed] = 1;
Contachilometri[i][Refueling] = 0;
Contachilometri[i][Speedom] = TextDrawCreate(506.000000,351.000000,"_");
TextDrawUseBox(Contachilometri[i][Speedom],1);
TextDrawBoxColor(Contachilometri[i][Speedom],COLOR_LIGHTBLUE);
TextDrawTextSize(Contachilometri[i][Speedom],625.000000,0.000000);
TextDrawAlignment(Contachilometri[i][Speedom],0);
TextDrawBackgroundColor(Contachilometri[i][Speedom],0x000000FF);
TextDrawFont(Contachilometri[i][Speedom],2);
TextDrawLetterSize(Contachilometri[i][Speedom],0.25,1.0);
TextDrawColor(Contachilometri[i][Speedom],0xFFFFFFFF);
TextDrawSetOutline(Contachilometri[i][Speedom],1);
TextDrawSetProportional(Contachilometri[i][Speedom],1);
TextDrawSetShadow(Contachilometri[i][Speedom],1);
SetTimerEx("Speedometer",1000,true,"i",i);
}

Steveproxy5
19/05/2015, 02:13 PM
I can't see this one

Jefff
19/05/2015, 02:16 PM
Use one global SetTimer not Ex
[15:08:37] sscanf error: The current build ONLY supports 0.3d
[15:08:37] Loaded.
[15:08:37] Loading plugin: crashdetect
[15:08:37] CrashDetect must be loaded before 'streamer.DLL'
[15:08:37] Failed.

CrazyRussainHacker
19/05/2015, 02:22 PM
Use one global SetTimer not Ex
[15:08:37] sscanf error: The current build ONLY supports 0.3d
[15:08:37] Loaded.
[15:08:37] Loading plugin: crashdetect
[15:08:37] CrashDetect must be loaded before 'streamer.DLL'
[15:08:37] Failed.

First of all load the CrashDetect.dll before Streamer.dll i think you can CLEARLY see that lol after it the "Failed" Message will be gone trust me i had problems with my server for 3 years

Steveproxy5
19/05/2015, 02:30 PM
Solved, but there is one error only that's I can't see textdraw when i'm in any vehicle

for(new i = 0; i < MAX_PLAYERS; i++)
{
Contachilometri[i][ShowSpeed] = 1;
Contachilometri[i][Refueling] = 0;
Contachilometri[i][Speedom] = TextDrawCreate(506.000000,351.000000,"_");
TextDrawUseBox(Contachilometri[i][Speedom],1);
TextDrawBoxColor(Contachilometri[i][Speedom],COLOR_LIGHTBLUE);
TextDrawTextSize(Contachilometri[i][Speedom],625.000000,0.000000);
TextDrawAlignment(Contachilometri[i][Speedom],0);
TextDrawBackgroundColor(Contachilometri[i][Speedom],0x000000FF);
TextDrawFont(Contachilometri[i][Speedom],2);
TextDrawLetterSize(Contachilometri[i][Speedom],0.25,1.0);
TextDrawColor(Contachilometri[i][Speedom],0xFFFFFFFF);
TextDrawSetOutline(Contachilometri[i][Speedom],1);
TextDrawSetProportional(Contachilometri[i][Speedom],1);
TextDrawSetShadow(Contachilometri[i][Speedom],1);
SetTimerEx("Speedometer",1000,true,"i",i);
}

public Speedometer(playerid)
{
new State = GetPlayerState(playerid);
if(State == PLAYER_STATE_DRIVER && IsPlayerInAnyVehicle(playerid))
{
if(Contachilometri[playerid][ShowSpeed] == 1)
{
new string[256], Float:health;
new vehicleid = GetPlayerVehicleID(playerid);
GetVehicleHealth(vehicleid, health);
new Float:svx[MAX_PLAYERS];
new Float:svy[MAX_PLAYERS];
new Float:svz[MAX_PLAYERS];
new Float:s1[MAX_PLAYERS];
new s2[MAX_PLAYERS];
GetVehicleVelocity(GetPlayerVehicleID(playerid), svx[playerid], svy[playerid], svz[playerid]);
s1[playerid] = floatsqroot(((svx[playerid]*svx[playerid])+(svy[playerid]*svy[playerid]))+(svz[playerid]*svz[playerid]))*100;
s2[playerid] = floatround(s1[playerid],floatround_round);

new Sspeed[15];

if( s2[playerid] == 0) {
format(Sspeed,sizeof(Sspeed),"~w~%d Km/h", s2[playerid]);
} else if( s2[playerid] >= 1 && s2[playerid] < 100 ){
format(Sspeed,sizeof(Sspeed),"~g~%d Km/h", s2[playerid]);
} else if( s2[playerid] >= 100 && s2[playerid] < 140 ){
format(Sspeed,sizeof(Sspeed),"~Y~%d Km/h", s2[playerid]);
} else {
format(Sspeed,sizeof(Sspeed),"~R~%d Km/h",s2[playerid]);
}

format(string,sizeof(string),"~p~Auto:~n~~w~%s~n~~p~Velocita: %s~n~~p~Benzina: ~w~%d~n~~p~" ,VehiclesName[GetVehicleModel(vehicleid)-400], Sspeed, Fuel[vehicleid]); //INCOLLARE AX
TextDrawSetString(Contachilometri[playerid][Speedom], string);
TextDrawShowForPlayer(playerid, Contachilometri[playerid][Speedom]);
} else { TextDrawHideForPlayer(playerid, Contachilometri[playerid][Speedom]); Contachilometri[playerid][ShowSpeed] = 0; }
}
return true;
}

Jefff
19/05/2015, 03:15 PM
You should update sometimes for new functions added in new versions of samp
// OnGameModeInit
SetTimer("Speedometer",1000,true);

// OnPlayerConnect
Contachilometri[playerid][ShowSpeed] = 0;
Contachilometri[playerid][Refueling] = 0;
Contachilometri[playerid][Speedom] = CreatePlayerTextDraw(playerid, 506.0 ,351.0, "_");
PlayerTextDrawUseBox(playerid,Contachilometri[playerid][Speedom],1);
PlayerTextDrawBoxColor(playerid,Contachilometri[playerid][Speedom],COLOR_LIGHTBLUE);
PlayerTextDrawTextSize(playerid,Contachilometri[playerid][Speedom],625.0,0.0);
PlayerTextDrawAlignment(playerid,Contachilometri[playerid][Speedom],0);
PlayerTextDrawBackgroundColor(playerid,Contachilom etri[playerid][Speedom],0x000000FF);
PlayerTextDrawFont(playerid,Contachilometri[playerid][Speedom],2);
PlayerTextDrawLetterSize(playerid,Contachilometri[playerid][Speedom],0.25,1.0);
PlayerTextDrawColor(playerid,Contachilometri[playerid][Speedom],0xFFFFFFFF);
PlayerTextDrawSetOutline(playerid,Contachilometri[playerid][Speedom],1);
PlayerTextDrawSetProportional(playerid,Contachilom etri[playerid][Speedom],1);
PlayerTextDrawSetShadow(playerid,Contachilometri[playerid][Speedom],1);

change Text:Speedom in enum to PlayerText:Speedom

public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_DRIVER)
{
if(!Contachilometri[playerid][ShowSpeed])
{
Contachilometri[playerid][ShowSpeed] = 1;
PlayerTextDrawSetString(playerid, Contachilometri[playerid][Speedom], "_");
PlayerTextDrawShow(playerid, Contachilometri[playerid][Speedom]);
}
}
else
{
if(Contachilometri[playerid][ShowSpeed] == 1)
{
Contachilometri[playerid][ShowSpeed] = 0;
PlayerTextDrawSetString(playerid, Contachilometri[playerid][Speedom], "_");
PlayerTextDrawHide(playerid, Contachilometri[playerid][Speedom]);
}
}
return 1;
}

public Speedometer()
{
static string[256], str[15];
static vID,Float:vehfloats[4];
for(new playerid = 0; playerid < MAX_PLAYERS; playerid++)
if(IsPlayerConnected(playerid))
{
vID = GetPlayerVehicleID(playerid);
if(!(0 < vID < MAX_VEHICLES) || !Contachilometri[playerid][ShowSpeed] || GetPlayerState(playerid) != PLAYER_STATE_DRIVER) continue;

GetVehicleHealth(vID, vehfloats[0]);
GetVehicleVelocity(vID, vehfloats[1], vehfloats[2], vehfloats[3]);
new Speed = floatround(VectorSize(vehfloats[1], vehfloats[2], vehfloats[3])*100.0,floatround_round);

if(Speed == 0) format(str,sizeof(str),"~w~%d Km/h", Speed);
else if(0 < Speed < 100) format(str,sizeof(str),"~g~%d Km/h", Speed);
else if(99 < Speed < 140) format(str,sizeof(str),"~y~%d Km/h", Speed);
else format(str,sizeof(str),"~r~%d Km/h",Speed);

format(string,sizeof(string),"~p~Auto:~n~~w~%s~n~~p~Velocita: %s~n~~p~Benzina: ~w~%d" ,VehiclesName[GetVehicleModel(vID)-400], str, Fuel[vID]); //INCOLLARE AX
PlayerTextDrawSetString(playerid, Contachilometri[playerid][Speedom], string);
}
}

Steveproxy5
19/05/2015, 03:56 PM
C:\Users\Francesco\Desktop\ProcidaCity test\gamemodes\ProcidaCity.pwn(27041) : warning 213: tag mismatch
C:\Users\Francesco\Desktop\ProcidaCity test\gamemodes\ProcidaCity.pwn(27042) : warning 213: tag mismatch
C:\Users\Francesco\Desktop\ProcidaCity test\gamemodes\ProcidaCity.pwn(27050) : warning 213: tag mismatch
C:\Users\Francesco\Desktop\ProcidaCity test\gamemodes\ProcidaCity.pwn(27051) : warning 213: tag mismatch
C:\Users\Francesco\Desktop\ProcidaCity test\gamemodes\ProcidaCity.pwn(38350) : warning 213: tag mismatch
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase


5 Warnings.

Jefff
19/05/2015, 03:59 PM
change Text:Speedom in enum to PlayerText:Speedom
enum asdasdas
{
Text:Speedom change to PlayerText:Speedom
}


Edited

Steveproxy5
19/05/2015, 04:06 PM
PlayerTextDrawSetString(playerid, Contachilometri[playerid][Speedom], "_");

PlayerTextDrawShow(playerid, Contachilometri[playerid][Speedom]);

Steveproxy5
19/05/2015, 06:50 PM
UP
TextDrawHideForPlayer(playerid, Contachilometri[playerid][Speedom]);
just this one

Konstantinos
19/05/2015, 07:04 PM
UP
TextDrawHideForPlayer(playerid, Contachilometri[playerid][Speedom]);
just this one

http://wiki.sa-mp.com/wiki/PlayerTextDrawHide

PS: Please read the rules and don't bump within 24 hours.

Steveproxy5
19/05/2015, 07:16 PM
thank you very much for helping me in this bug!!! +1

Steveproxy5
19/05/2015, 07:45 PM
how can I change color of text after auto, velocitÓ & benzina in this code?

public Speedometer()
{
static string[256], str[15];
static vID,Float:vehfloats[4];
for(new playerid = 0; playerid < MAX_PLAYERS; playerid++)
if(IsPlayerConnected(playerid))
{
vID = GetPlayerVehicleID(playerid);
if(!(0 < vID < MAX_VEHICLES) || !Contachilometri[playerid][ShowSpeed] || GetPlayerState(playerid) != PLAYER_STATE_DRIVER) continue;

GetVehicleHealth(vID, vehfloats[0]);
GetVehicleVelocity(vID, vehfloats[1], vehfloats[2], vehfloats[3]);
new Speed = floatround(VectorSize(vehfloats[1], vehfloats[2], vehfloats[3])*100.0,floatround_round);

if(Speed == 0) format(str,sizeof(str),"~w~%d Km/h", Speed);
else if(0 < Speed < 100) format(str,sizeof(str),"~g~%d Km/h", Speed);
else if(99 < Speed < 140) format(str,sizeof(str),"~y~%d Km/h", Speed);
else format(str,sizeof(str),"~r~%d Km/h",Speed);

format(string,sizeof(string),"~p~Auto:~n~~w~%s~n~~p~Velocita: %s~n~~p~Benzina: ~w~%d" ,VehiclesName[GetVehicleModel(vID)-400], str, Fuel[vID]); //INCOLLARE AX
PlayerTextDrawSetString(playerid, Contachilometri[playerid][Speedom], string);
}
return 1;
}

J0sh...
19/05/2015, 07:53 PM
~n~ New line
~r~ Red
~g~ Green
~b~ Blue
~w~ White
~y~ Yellow
~p~ Purple
~l~ Black (lower case L)
~h~ Turn text color lighter (used too much will make your text white, doesn't work on black)

https://wiki.sa-mp.com/wiki/GameTextStyle <-- Works on textdraws, don't be misleaded by the url :P