PlayerTied Doesn't work (drag command) - 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: PlayerTied Doesn't work (drag command) (
/showthread.php?tid=457976)
PlayerTied Doesn't work (drag command) -
lider1241 - 14.08.2013
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:
Код:
new Dragging[MAX_PLAYERS], Dragged[MAX_PLAYERS], draggedtimer[MAX_PLAYERS], PlayerTied[MAX_PLAYERS], PlayerCuffed[MAX_PLAYERS];
Public OnPlayerConnect(playerid)
{
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;
}
Re: PlayerTied Doesn't work (drag command) -
Edix - 14.08.2013
The problem is that you only doing a check if the player is cuffed and not tied.
Why not just use PlayerCuffed instead of PlayerCuffed and PlayerTied?
Re: PlayerTied Doesn't work (drag command) -
lider1241 - 14.08.2013
Because i want Leo factions can drag and also civilians for rob people are tied.