Command Problem
#1

So I checked this command IG for bugs. When I use it for the first time, it works fine. I tried it again(i used a command to exit the DM zone), but now it doesn't. Much more, it does not let me chat, it does not let me use a command. Whenever I type in anything in the chatbox and enter it, nothing happens.

PHP код:
CMD:dm(playeridparams[])
{
    if(
isinarena[playerid] == 1) return 1;
    new 
id,str1[2];
    if(
sscanf(params"I"id)) return SendClientMessage(playerid0xFF000000"/dm [ID]");
    
valstr(str1id);
    if(
str1[1] == '\0' || str1[0] == '\0')
    {
        new 
str11[750],string[200];
        for(new 
i=0;i<3;i++)
        {
            
format(stringsizeof(string), "%d\t%s\t%d\t%d\n",MapArenas[i][MapID],MapArenas[i][MapName],mapplayers[i],MapArenas[i][MapCapacity]);
            
strcat(str11string);
        }
        
format(stringsizeof(string), "Map ID\tMap Name\tMap Players\tMap Capacity\n%s"str11);
        
ShowPlayerDialog(playeridDIALOG_AMAPSDIALOG_STYLE_TABLIST_HEADERS"Deathmatch Maps"
            
string"Enter""Cancel");
    }
    else
    {
        
isinarena[playerid] = 1;
        
//new rand = random(10);
        //if(rand == 1)
        //{
            
SetPlayerPos(playeridMapArenas[id][MapPosition][0], MapArenas[id][MapPosition][1], MapArenas[id][MapPosition][2]);
            
SetPlayerFacingAngle(playeridMapArenas[id][MapPosition][3]);
            
SetPlayerVirtualWorld(playeridARENA_VW);
            
SetPlayerInterior(playerid0);
            
SetPlayerHealth(playerid100);
            
SetPlayerArmour(playerid100);
            
GivePlayerWeapon(playeridMapArenas[id][MapWeapon][0], 100);
            
GivePlayerWeapon(playeridMapArenas[id][MapWeapon][1], 100);
            
GivePlayerWeapon(playeridMapArenas[id][MapWeapon][2], 100);
            
GivePlayerWeapon(playeridMapArenas[id][MapWeapon][3], 100);
            new 
string[70];
            
format(stringsizeof(string), "You have joined the %s deathmatch room"MapArenas[id][MapName]);
            
SendClientMessage(playerid0x00FF00FFstring);
            
mapplayers[id]++;
        
//}
    
}
    return 
1;

Lobby command

PHP код:
CMD:lobby(playerid)
{
    if(
shottimerleft[playerid] > 0)
    {
        
SendClientMessage(playerid0xFF0000FF"You have taken damage and have to wait the 10 seconds before exiting the area.");
    }
    else
    {
        
SetPlayerPos(playeridSPAWN_XSPAWN_YSPAWN_Z);
        
SetPlayerInterior(playeridSPAWN_INT);
        
SetPlayerVirtualWorld(playeridSPAWN_VW);
        
SetPlayerHealth(playerid999999);
        
SetPlayerArmour(playerid999999);
        
ResetPlayerWeapons(playerid);
        
isinarena[playerid] = 0;
        
killspree[playerid] = 0;
    }
    return 
1;

Reply
#2

Seems like something in your code is breaking OnPlayerUpdate. Are you returning 0 at OnPlayerUpdate at any part?
Reply
#3

Quote:
Originally Posted by Ritzy
Посмотреть сообщение
Seems like something in your code is breaking OnPlayerUpdate. Are you returning 0 at OnPlayerUpdate at any part?
I deleted OnPlayerUpdate. Should it be there?
Reply
#4

Quote:
Originally Posted by NealPeteros
Посмотреть сообщение
I deleted OnPlayerUpdate. Should it be there?
Yes, lol. OnPlayerUpdate is called everytime data is exchanged between server and client. It's okay if you don't want to use it just let it be there and make sure to return 1

Код:
public OnPlayerUpdate(playerid)
{
    return 1;
}
Reply
#5

Adding OnPlayerUpdate didn't solve the problem tho.
Reply
#6

Is it has an output SERVER:Unknown command. when the bugs happened?
Reply
#7

Not even that
Reply
#8

Run the crashdetector plugin and compile the script on -d3 mode. (Create a pawn.cfg on your pawno folder and type -d3 inside the .cfg)

Tell us what does the crashdetector prints out over the log.
Reply
#9

Here it is

Quote:

[debug] Run time error 4: "Array index out of bounds"
[debug] Accessing element at index 53 past array upper bound 2
[debug] AMX backtrace:
[debug] #0 0000ad88 in ?? () from deathmatch.amx
[debug] #1 00000036 in public cmd_dm () from deathmatch.amx
[debug] #2 native CallLocalFunction () [004747d0] from samp-server.exe
[debug] #3 000003e0 in public OnPlayerCommandText () from deathmatch.amx

Reply
#10

Have you tried changing this

PHP код:
for(new i=0;i<3;i++) 
to this

PHP код:
for(new i=0;i<sizeof(MapArenas);i++) 
That is what I believe causes the problem.

P.S. You haven't enabled the debug compiling mode which gives you the ability to determine where the exact problem is at (Printing out the scriptline where the problem is coming from)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)