SA-MP Forums Archive
Does it correct? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Does it correct? (/showthread.php?tid=477228)



Does it correct? - Jizz - 23.11.2013

Can I drag and undrag with this scripts?

PHP код:
CMD:drag(playeridparams[])
{
    new 
giveplayeridgiveplayer[MAX_PLAYER_NAME], sendername[MAX_PLAYER_NAME], string[128], DragOff[MAX_PLAYERS];
    if(
sscanf(params,"u",giveplayerid)) return SendClientMessage(playeridCOLOR_WHITE,"USAGE: /drag [playerid]");
    if(!
IsPlayerConnected(giveplayerid)) return SendClientMessage(playeridCOLOR_GREY"That Player is offline !");
    if(!
ProxDetectorS(3.0playeridgiveplayerid)) return SendClientMessage(playeridCOLOR_GREY,"That player isn't near you !");
    if(
DragOff[giveplayerid] > 0) return SendClientMessage(playeridCOLOR_GREY,"You are already being Dragged!");
    if(
giveplayerid == playerid) return SendClientMessage(playeridCOLOR_GREY"You Cannot Drag Yourself!");
    if(
PlayerCuffed[giveplayerid] == 2) return SendClientMessage(playeridCOLOR_GREY"That person isn't cuffed.");
    if(
IsACop(giveplayerid) || (PlayerInfo[giveplayerid][pFaction] == && PlayerInfo[giveplayerid][pDivision] == 5) || PlayerInfo[giveplayerid][pFaction] == && PlayerInfo[giveplayerid][pDivision] == || (PlayerInfo[giveplayerid][pFaction] == && PlayerInfo[giveplayerid][pRank] >= 10))
    { return 
SendClientMessage(playeridCOLOR_GREY,"You can't drag cops"); }
    if(
IsACop(playerid) || (PlayerInfo[playerid][pFaction] == && PlayerInfo[playerid][pDivision] == 5) || PlayerInfo[playerid][pFaction] == && PlayerInfo[playerid][pDivision] == || (PlayerInfo[playerid][pFaction] == && PlayerInfo[playerid][pRank] >= 10))
    {
        
GetPlayerName(giveplayeridgiveplayersizeof(giveplayer));
        
GetPlayerName(playeridsendernamesizeof(sendername));
        
format(stringsizeof(string), "* You are being dragged by %s,"sendername);
        
SendClientMessage(giveplayeridCOLOR_LIGHTBLUEstring);
         
format(stringsizeof(string), "* You begin to drag %s,"giveplayer);
         
SendClientMessage(playeridCOLOR_LIGHTBLUEstring);
         
format(stringsizeof(string), "* %s has started to drag %s."sendername ,giveplayer);
         
ProxDetector(30.0playeridstringCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
         
TogglePlayerControllable(giveplayerid0);
         
DragOff[giveplayerid] = playerid;
    }
    else return 
SendClientMessage(playeridCOLOR_GREY,"You are not a cop");
    return 
1;
}
CMD:stopdrag(playeridparams[])
{
    new 
giveplayeridstring[128], DragOff[MAX_PLAYERS];
    if(
DragOff[giveplayerid] > -1) return SendClientMessage(playeridCOLOR_GREY"You are not dragging anybody.");
    
playerid DragOff[playerid];
    
DragOff[giveplayerid] = -1;
    
format(stringsizeof(string), "* %s released %s and stops draggin them."GetPlayerNameEx(playerid));
    
ProxDetector(30.0playeridstringCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
    
TogglePlayerControllable(giveplayerid0);
    return 
1;