/Drag command. [Fixed] -
Hey guys, I'm probably being really dumb with this... but anybody who can help would be much appreciated
The problem is it doesn't drag the person at all...
PHP код:
command(stopdrag, playerid, params[])
{
#pragma unused params
new string[73], dragtimer;
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnectedEx(i))
{
format(string, sizeof(string), "* %s has stopped dragging %s.", GetName(playerid), GetName(i));
NearByMessage(playerid, NICESKY, string);
KillTimer(dragtimer);
}
}
return 1;
}
new dragtimer;
command(drag, playerid, params[])
{
new id, string[128], dragtimer;
if(sscanf(params, "u", id))
{
SendClientMessage(playerid, WHITE, "SYNTAX: /drag [playerid]");
}
else
{
if(Player[id][Tied] >= 1 || Player[id][Cuffed] >= 1)
{
if(GetDistanceBetweenPlayers(playerid, id) < 7)
{
format(string, sizeof(string), "You have started to drag %s.", GetName(id));
SendClientMessage(playerid, WHITE, string);
format(string, sizeof(string), "* %s grabs ahold of %s and starts dragging them.", GetName(playerid), GetName(id));
NearByMessage(playerid, NICESKY, string);
dragtimer = SetTimerEx("drag", 1000, true, "i", playerid);
}
else
{
SendClientMessage(playerid, WHITE, "You're too far away!");
}
}
else
{
SendClientMessage(playerid, WHITE, "Your target has to be either tied or cuffed.");
}
}
return 1;
}
forward drag(playerid, params[]);
public drag(playerid, params[])
{
new id, string[128];
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
SetPlayerPos(id,x, y, z);
}
Re: /Drag command. -
pawn Код:
forward drag(playerid, giveplayerid);
public drag(playerid, giverplayerid)
{
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
SetPlayerPos(giverplayerid,x, y, z);
}
pawn Код:
dragtimer = SetTimerEx("drag", 1000, true, "ii", playerid, id);
Plus the 'dragtimer' should not be defined each time again and again, define it somewhere at the top of your gm or something.
Re: /Drag command. -
Awesome thanks for that much appreciated. Reped.