Server crash when /drag
#1

I have another problem in my server. The /drag command. I don't know why every time i do /drag it is fine,
but when i do /acceptdrag, the server console stopped itself. Can anyone help me to fix the command?

Here are the codes

/drag command
PHP код:
CMD:drag(playeridparams[])
{
    new 
IDstring[26+MAX_PLAYER_NAME], string2[20+MAX_PLAYER_NAME];
     if(
sscanf(params"u"ID)) return SendClientMessage(playeridCOLOR_WHITE"Pemakaian: /drag [playerid]");
     if(
ID == INVALID_PLAYER_ID) return SendClientMessage(playeridCOLOR_GRAD1"Player not connected!");
      if(
ID == playerid) return SendClientMessage(playeridCOLOR_GRAD1"You can't drag yourself!");
      if(
GetDistanceBetweenPlayers(playeridID) > 2)
     {
            
SendClientMessage(playeridCOLOR_GRAD1"You're too far away!" );
            return 
1;
      }
    
SetPVarInt(ID"DRAGG"playerid);
    
    
format(string2sizeof(string2), "%s Telah menawari drag kepada anda, /acceptdrag untuk menerimanya"GetPlayerName(playerid));
    
SendClientMessage(IDCOLOR_GRAD1string2);
    
SendClientMessage(playeridCOLOR_GRAD1"Anda telah berhasil mengirim tawaran drag kepada player!");
    return 
true;

/acceptdrag command
PHP код:
CMD:acceptdrag(playeridparams[])
{
    new 
dragg GetPVarInt(playerid"DRAGG");
    new 
string[128], string2[128];
    if(
dragg == INVALID_PLAYER_ID)
        return 
SendClientMessage(playeridCOLOR_GRAD1"The player that has invited you has left the server! Invite has been cancelled."), DeletePVar(playerid"DRAGG");
    if(
GetDistanceBetweenPlayers(playeriddragg) > 2)
     {
            
SendClientMessage(playeridCOLOR_GRAD1"You're too far away!" );
            return 
1;
      }
      if(
Dragged[playerid] < && Dragging[dragg] < 0)
       {
          
Dragged[playerid] = dragg;
          
Dragging[dragg] = playerid;
          
format(stringsizeof(string), "Kamu sedang didrag oleh %s."GetPlayerName(dragg));
          
SCM(playeridCOLOR_PURPLEstring);
          
format(string2sizeof(string2), "Anda telah mendrag %s, /undrag untuk berhenti"GetPlayerName(playerid));
          
SCM(draggCOLOR_PURPLEstring2);
          
draggedtimer[playerid] = SetTimerEx("Draggingt"10001"dd"dragg,playerid);
    }
    return 
true;

*Note: There is no warning or error message on those lines after compiling.
Reply
#2

try this code, if it's still fails, than show me Draggingt function.

PHP код:
CMD:acceptdrag(playeridparams[]) 
{
    new 
dragg GetPVarInt(playerid"DRAGG"); 
    new 
string[128], string2[128]; 
    if(
dragg == INVALID_PLAYER_ID) return SendClientMessage(playeridCOLOR_GRAD1"The player that has invited you has left the server! Invite has been cancelled."), DeletePVar(playerid"DRAGG"); 
    if(
GetDistanceBetweenPlayers(playeriddragg) > 2
    { 
        
SendClientMessage(playeridCOLOR_GRAD1"You're too far away!"); 
        return 
1
    } 
    if(
Dragged[playerid] < && Dragging[dragg] < 0
    { 
        
Dragged[playerid] = dragg
        
Dragging[dragg] = playerid
        
format(stringsizeof(string), "Kamu sedang didrag oleh %s."GetPlayerName(dragg)); 
        
SCM(playeridCOLOR_PURPLEstring); 
        
format(string2sizeof(string2), "Anda telah mendrag %s, /undrag untuk berhenti"GetPlayerName(playerid)); 
        
SCM(draggCOLOR_PURPLEstring2); 
        
draggedtimer[playerid] = SetTimerEx("Draggingt"10001"dd"dragg,playerid); 
    } 
    return 
true

Reply
#3

still, server console closed itself.

I dont know which one is the function
PHP код:
forward Draggingt(draggplayerid);
public 
Draggingt(draggplayerid)
{
        new 
Float:dXFloat:dYFloat:dZ;
        
GetPlayerPos(draggdXdYdZ);
        
SetPlayerPos(playeriddX+1dYdZ);
}
CMD:drag(playeridparams[])
{
//line 32964    new ID, string[26+MAX_PLAYER_NAME], string2[20+MAX_PLAYER_NAME];
     
if(sscanf(params"u"ID)) return SendClientMessage(playeridCOLOR_WHITE"Pemakaian: /drag [playerid]");
     if(
ID == INVALID_PLAYER_ID) return SendClientMessage(playeridCOLOR_GRAD1"Player not connected!");
      if(
ID == playerid) return SendClientMessage(playeridCOLOR_GRAD1"You can't drag yourself!");
      if(
GetDistanceBetweenPlayers(playeridID) > 2)
     {
            
SendClientMessage(playeridCOLOR_GRAD1"You're too far away!" );
            return 
1;
      }
    
SetPVarInt(ID"DRAGG"playerid);
    
//line 32975    format(string2, sizeof(string2), "%s Telah menawari drag kepada anda, /acceptdrag untuk menerimanya", GetPlayerName(playerid));
    
SendClientMessage(IDCOLOR_GRAD1string2);
    
SendClientMessage(playeridCOLOR_GRAD1"Anda telah berhasil mengirim tawaran drag kepada player!");
    return 
true;
}
// New drag
CMD:acceptdrag(playeridparams[])
{
    new 
dragg GetPVarInt(playerid"DRAGG");
    new 
string[128], string2[128];
    if(
dragg == INVALID_PLAYER_ID) return SendClientMessage(playeridCOLOR_GRAD1"The player that has invited you has left the server! Invite has been cancelled."), DeletePVar(playerid"DRAGG");
    if(
GetDistanceBetweenPlayers(playeriddragg) > 2)
    {
        
SendClientMessage(playeridCOLOR_GRAD1"You're too far away!");
        return 
1;
    }
    if(
Dragged[playerid] < && Dragging[dragg] < 0)
    {
        
Dragged[playerid] = dragg;
        
Dragging[dragg] = playerid;
//line 32995        format(string, sizeof(string), "Kamu sedang didrag oleh %s.", GetPlayerName(dragg));
        
SCM(playeridCOLOR_PURPLEstring);
//line 32997        format(string2, sizeof(string2), "Anda telah mendrag %s, /undrag untuk berhenti", GetPlayerName(playerid));
        
SCM(draggCOLOR_PURPLEstring2);
        
draggedtimer[playerid] = SetTimerEx("Draggingt"10001"dd"dragg,playerid);
    }
    return 
true;

Reply
#4

Oh wait, there are warnings.

PHP код:
a.TMP(32975) : warning 202number of arguments does not match definition
a
.TMP(32975) : warning 202number of arguments does not match definition
a
.TMP(32964) : warning 204symbol is assigned a value that is never used"string"
a.TMP(32995) : warning 202number of arguments does not match definition
a
.TMP(32995) : warning 202number of arguments does not match definition
a
.TMP(32997) : warning 202number of arguments does not match definition
a
.TMP(32997) : warning 202number of arguments does not match definition 
Reply
#5

mark the warning lines.
Reply
#6

Quote:
Originally Posted by Mugalito
Посмотреть сообщение
mark the warning lines.
on that reply.
Reply
#7

Try to change this


Код:
     new ID, string[26+MAX_PLAYER_NAME], string2[20+MAX_PLAYER_NAME];
To this


Код:
    new ID, string[50], string2[44];
Reply
#8

//line 32975 format(string2, sizeof(string2), "%s Telah menawari drag kepada anda, /acceptdrag untuk menerimanya", GetPlayerName(playerid));

use
new name[32];
GetPlayerName(playerid,name,32);
now u have tu use name instead of this.

make this change at every lane.
also //line 32964 new ID, string[26+MAX_PLAYER_NAME], string2[20+MAX_PLAYER_NAME];
remove this 26 and 20.
Reply
#9

And i got error 017: undefined symbol: "name"
i don't know where to place the new name.

Can you edit the code for me?
Reply
#10

None can make it for me? Okay. I'll remove /drag command.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)