SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Old 13/06/2018, 04:02 PM   #1
AlfaSufaIndo
Big Clucker
 
Join Date: Oct 2016
Location: Jombang, East Java, Indonesia
Posts: 78
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
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Need /drag command. UnKnownEgyptain Scripting Help 4 13/03/2015 11:25 PM
Drag Command Kindred Scripting Help 10 02/04/2014 08:13 PM
I need Drag and stop drag command Jizz Scripting Help 5 24/02/2014 12:08 PM
/drag command nickdadon Help Archive 0 30/01/2011 04:51 AM
Drag command kman Help Archive 1 21/10/2009 12:30 AM


All times are GMT. The time now is 07:13 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.