View Single Post
Old 13/06/2018, 04:02 PM   #1
AlfaSufaIndo
Big Clucker
 
Join Date: Oct 2016
Location: Jombang, East Java, Indonesia
Posts: 79
Reputation: 0
Default BUG /DRAG COMMAND

So i make a /drag and /undrag command and it's not working, there is no error. But when i drag other player, that player is not following me


PHP Code:
public OnPlayerUpdate(playerid)
{
    
//DRAG
    
new ID;
    if(
Drag[ID] != -1)
    {
        new 
string[128];
        if(
IsPlayerConnected(Drag[ID]))
        {
            new 
Float:dXFloat:dYFloat:dZ;
            
SetPlayerVirtualWorld(playeridGetPlayerVirtualWorld(Drag[ID]));
            
SetPlayerInterior(playeridGetPlayerInterior(Drag[ID]));
            
GetPlayerPos(Drag[ID], dXdYdZ);
            
SetPlayerPos(playeriddX+1dYdZ);
        }
        else
        {
            
Drag[ID] = -1;
            
format(stringsizeof(string), "{B0C4DE}DRAGINFO: {FFFFFF}Player yang menyeretmu ({00FF00}%s{FFFFFF}) telah keluar dari server! Kamu tidak lagi di seret."GetPlayerNameEx(playerid));
            
SendClientMessage(playeridCOLOR_WHITEstring);
        }
    }
    return 
1;
}

CMD:drag(playeridparams[])
{
    new 
IDstring[26+MAX_PLAYER_NAME], string2[20+MAX_PLAYER_NAME];
    if(
sscanf(params"u"ID)) return SendClientMessage(playeridCOLOR_WHITE"CMD:/drag [playerid] NOTE: /undrag [playerid] untuk berhenti menyeret player.");
    if(
ID == playerid) return SendClientMessage(playeridCOLOR_WHITE"Kamu tidak bisa menyeret dirimu sendiri!");
    if(
IsPlayerConnected(ID))
    {
        if(
Drag[ID] == 1)
        {
            
SendClientMessage(playeridCOLOR_WHITE"Player tersebut telah kamu seret!");
        }
        if(
GetDistanceBetweenPlayers(playeridID) > 2)
        {
            
SendClientMessage(playeridCOLOR_WHITE"Kalian terlalu jauh!" );
            return 
1;
        }
        if(
GetPVarInt(ID"Injured") == 1)
        {
            
format(stringsizeof(string), "You are being dragged by %s."RemoveUnderScore(playerid));
            
format(string2sizeof(string2), " You are dragging %s."RemoveUnderScore(ID));
            
SCM(playeridCOLOR_PURPLEstring2);
            
SCM(IDCOLOR_PURPLEstring);
            
TogglePlayerControllable(ID0);
            
ApplyAnimation(ID"ped""KO_skid_front"4.0111101);
            
Drag[ID] = playerid;
        }
        else return 
SendClientMessage(playeridCOLOR_WHITE"Player itu tidak Injured / Terluka");
    }
    else return 
SendClientMessageEx(playeridCOLOR_WHITE"Player tidak bisa ditemukan.");
    return 
1;
}

CMD:undrag(playeridparams[])
{
    new 
ID;
    if(
sscanf(params"u"ID)) return SendClientMessage(playeridCOLOR_WHITE"CMD: /undrag [playerid]");
    if(
ID == playerid) return SendClientMessage(playeridCOLOR_WHITE"Kamu tidak bisa menggunakan perintah ini kepada dirimu sendiri!");
    if(
IsPlayerConnected(ID))
    {
        if(
Drag[ID] = 0)
        {
            
SendClientMessage(playeridCOLOR_WHITE"Player tersebut tidak sedang kamu seret");
        }
        for(new 
0MAX_PLAYERSi++)
        {
            if(
IsPlayerConnected(i) && Drag[i] == playerid)
            {
                
TogglePlayerControllable(i1);
                
ApplyAnimation(i"PED""BIKE_fall_off"4.1011101);
                
SCM(playeridCOLOR_PURPLE"You have stopped drag your target.");
                
SCM(iCOLOR_PURPLE"You aren't being dragged anymore.");
                
Drag[i] = -1;
                
ClearAnimations(playerid);
            }
        }
    }
    else return 
SendClientMessage(playeridCOLOR_WHITE"Player tidak bisa ditemukan!");
    return 
1;

AlfaSufaIndo is offline   Reply With Quote