14.08.2013, 10:21
I built drag command for cuffed/tied people and then when /drag to drag him (make him follow you without his controleable)
But for some reason Playercuffed works but Playertied it says "This player must first be cuffed"
i want person will be able to drag tied person and cuffed person, how can i do this?
its under includes:
Public OnPlayerConnect(playerid)
{
PlayerTied[playerid] = 0; (more codes for other functions)
But for some reason Playercuffed works but Playertied it says "This player must first be cuffed"
i want person will be able to drag tied person and cuffed person, how can i do this?
its under includes:
Код:
new Dragging[MAX_PLAYERS], Dragged[MAX_PLAYERS], draggedtimer[MAX_PLAYERS], PlayerTied[MAX_PLAYERS], PlayerCuffed[MAX_PLAYERS];
{
PlayerTied[playerid] = 0; (more codes for other functions)
Код:
CMD:drag(playerid, params[])
{
new ID, string[26+MAX_PLAYER_NAME], string2[20+MAX_PLAYER_NAME];
if(sscanf(params, "u", ID)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /drag [playerid]");
if(PlayerCuffed[ID] == 0) return SendClientMessage(playerid, COLOR_WHITE, "This player must first be cuffed");
if(Dragged[ID] == 0 && Dragging[playerid] == 0)
{
Dragged[ID] = 1;
Dragging[playerid] = 1;
format(string, sizeof(string), "You are being dragged by %s.", RemoveUnderScore(playerid));
format(string2, sizeof(string2), " You are dragging %s.", RemoveUnderScore(ID));
SCM(playerid, PURPLE, string2);
SCM(ID, PURPLE, string);
draggedtimer[ID] = SetTimerEx("Draggingt", 1000, 1, "dd", playerid,ID);
}
else
{
Dragged[ID] = 0;
Dragging[playerid] = 0;
SCM(playerid, PURPLE, "You have stopped dragging your target.");
SCM(ID, PURPLE, "You aren't being dragged anymore.");
KillTimer(draggedtimer[ID]);
}
return 1;
}
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);
}
stock RemoveUnderScore(playerid)
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
for(new i = 0; i < MAX_PLAYER_NAME; i++)
{
if(name[i] == '_') name[i] = ' ';
}
return name;
}

