Drag CMD problem - 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: Drag CMD problem (
/showthread.php?tid=465945)
Drag CMD problem -
Jizz - 25.09.2013
pawn Код:
CMD:drag(playerid, params[])
{
new giveplayerid;
if(IsACop(playerid) || (PlayerInfo[playerid][pFaction] == 5 && PlayerInfo[playerid][pDivision] == 5) || PlayerInfo[playerid][pFaction] == 5 && PlayerInfo[playerid][pDivision] == 2 || (PlayerInfo[playerid][pFaction] == 3 && PlayerInfo[playerid][pRank] >= 10))
if(sscanf(params, "u", giveplayerid)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /drag [playerid/partofname]");
if(PlayerCuffed[giveplayerid] == 2) return SendClientMessage(playerid, COLOR_WHITE, "This player must first be cuffed");
if(!ProxDetectorS(8.0, playerid, giveplayerid))
{
SendClientMessage(playerid, COLOR_GREY, "That player isn't near you.");
return 1;
}
if(Dragged[playerid] == 0 && Drag[playerid] == 0)
Dragged[playerid] = 1;
Drag[playerid] = 1;
return 1;
}
CMD:stopdrag (playerid, params[])
{
if(IsACop(playerid) || (PlayerInfo[playerid][pFaction] == 5 && PlayerInfo[playerid][pDivision] == 5) || PlayerInfo[playerid][pFaction] == 5 && PlayerInfo[playerid][pDivision] == 2 || (PlayerInfo[playerid][pFaction] == 3 && PlayerInfo[playerid][pRank] >= 10))
Dragged[playerid] = 0;
Drag[playerid] = 0;
{
return 1;
}
}
//DRAG
forward Draggingt(playerid, ID);
public Draggingt(playerid, ID)
{
new Float:dX, Float:dY, Float:dZ;
GetPlayerPos(playerid, dX, dY, dZ);
SetPlayerPos(ID, dX+1, dY, dZ);
}
Can't drag people, Someone said the problem is
pawn Код:
//DRAG
forward Draggingt(playerid, ID);
public Draggingt(playerid, ID)
{
new Float:dX, Float:dY, Float:dZ;
GetPlayerPos(playerid, dX, dY, dZ);
SetPlayerPos(ID, dX+1, dY, dZ);
}
Re: Drag CMD problem -
JamesH - 25.09.2013
What's exactly the problem?
Errors? Not doing anything? What?
Re: Drag CMD problem -
Jizz - 25.09.2013
The CMD isn't work.
Re: Drag CMD problem -
JamesH - 25.09.2013
put this on the top of your script
pawn Код:
new draggedtimer[MAX_PLAYERS];
new dragged[MAX_PLAYERS];
new dragging[MAX_PLAYERS];
replace this with your public
pawn Код:
forward Draggingt(playerid, iPlayer);
public Draggingt(playerid, iPlayer)
{
new Float:dX, Float:dY, Float:dZ;
GetPlayerPos(playerid, dX, dY, dZ);
SetPlayerPos(iPlayer, dX+1, dY, dZ);
}
And the command
pawn Код:
CMD:drag(playerid, params[])
{
new iPlayer, string[26+MAX_PLAYER_NAME], string2[20+MAX_PLAYER_NAME];
if(sscanf(params, "u", iPlayer)) return SendClientMessage(playerid, COLOR_GREY, "CMD:/drug [playerid]");
if(dragged[iPlayer] == 0 && dragging[playerid == 0)
{
dragged[iPlayer]=1;
dragging[playerid]=1;
draggedtimer[iPlayer] = SetTimerEx("Draggingt", 1000, 1, "dd", playerid,iPlayer);
}
else
{
dragged[iPlayer]=0;
dragging[playerid]=0;
KillTimer(draggedtimer[iPlayer]);
}
return 1;
}
And OnPlayerConnect add these
pawn Код:
dragged[playerid]=0;
dragging[playerid]=0; draggedtimer[playerid]=0;
Your welcome
Re: Drag CMD problem -
Jizz - 25.09.2013
I don't want to use timer. I want a normal drag command, can you help me?
Re: Drag CMD problem -
Jizz - 25.09.2013
Still not work!!