Hi, i need help. Beacuse when somone drags a player first. And stop, then i try to drag him. He got dragged by first player that dragged him. Here is the code:
Код:
//top
forward Drag(playerid, giveplayerid);
//gametext
DragTime[playerid] = 1; DragOff[playerid] = 0;
if(strcmp(cmd, "/drag", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(IsACop(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, COLOR_WHITE, "SERVER: /drag [Player ID]");
return 1;
}
giveplayerid = ReturnUser(tmp);
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
if(gTeam[giveplayerid] == 2 || IsACop(giveplayerid))
{
SendClientMessage(playerid, COLOR_GREY, " You can't drag Cops !");
return 1;
}
if(DragOff[giveplayerid] > 0)
{
SendClientMessage(playerid, COLOR_GREY, " You Are already being Dragged!");
return 1;
}
if (DragOff[playerid] > 0)
{
new intoff = GetPlayerInterior(DragOff[playerid]);
SetPlayerInterior(giveplayerid,intoff);
new Float:pos[3]; GetPlayerPos(DragOff[playerid], pos[0], pos[1], pos[2]);
SetPlayerPos(giveplayerid, pos[0]+0.5, pos[1], pos[2]);
}
if (ProxDetectorS(3.0, playerid, giveplayerid))
{
if(giveplayerid == playerid) { SendClientMessage(playerid, COLOR_GREY, "You Cannot Drag Yourself!"); return 1; }
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* You are being dragged by %s,", sendername);
SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "* You begin to drag %s,", giveplayer);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "* %s has started to drag %s.", sendername ,giveplayer);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
TogglePlayerControllable(giveplayerid, 0);
Dragged[giveplayerid] = 1;
timer1 = SetTimerEx("Drag", 800, true, "i", giveplayerid, 1);
}
else
{
SendClientMessage(playerid, COLOR_GREY, " That Player is not near you !");
/ return 1;
}
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " That player is Offline !");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " You are not a Cop / FBI / Navy / National Guard!");
}
}
return 1;
}
public Drag(playerid, giveplayerid)
{
new Float:x, Float:y, Float:z;
GetPlayerPos(giveplayerid, x, y, z);
SetPlayerPos(playerid, x, y+2, z);
return 1;
}
i have a question .. where must i Insert the "DragTime[playerid] = 1; DragOff[playerid] = 0;" ?
Can you help me too i need that command too Usage: /drag [ Player ID ] i need it in ZCMD in ( CMD:drag ) please