20.05.2014, 00:57
Why, when player connect. You will get dragged by a random guy?.
For example, you just connect and you will be dragged by random playerid, why??
Im glad at your helps!
For example, you just connect and you will be dragged by random playerid, why??
Code:
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_GRAD1, "CMD:/drag [playerid]"); if(PlayerCuffed[id] == 0) return SendClientMessage(playerid, COLOR_GRAD1, "This player must first be cuffed"); if(PlayerCuffed[id] == 1) return SendClientMessage(playerid, COLOR_GREY, "You can't drag a tazed player."); if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOR_GREY, "Invalid player specified."); if(GetDistanceBetweenPlayers(id, playerid) > 4) return SendClientMessage(playerid, COLOR_GREY, "You're not close enough to the player!"); if(PlayerCuffed[id] == 0) return SendClientMessage(playerid, COLOR_GREY, "That person isn't cuffed."); if(PlayerCuffed[id] == 1) return SendClientMessage(playerid, COLOR_GREY, "You can't drag a tazed player."); if(id == playerid) return SendClientMessage(playerid, COLOR_GREY, "You can't restrain yourself!"); if(GetPlayerState(id) != PLAYER_STATE_ONFOOT) return SendClientMessage(playerid, COLOR_GREY, "That person is in a car - get them out first."); if(GetPlayerState(playerid) != PLAYER_STATE_ONFOOT) return SendClientMessage(playerid, COLOR_GREY, "You're in a car - get out first."); if(GetPVarInt(playerid, "PBM") > 0) return SendClientMessage(playerid, COLOR_WHITE, "You're not able to do this while in a paintball game."); if(GetPVarInt(playerid, "EventToken") != 0) return SendClientMessage(playerid, COLOR_GREY, "You can't use the tazer while you're in an event."); if(PlayerCuffedTime[playerid] > 0) return SendClientMessage(playerid, COLOR_GREY, "You can't do this right now."); if(GetPVarInt(playerid, "Injured") == 1) return SendClientMessage(playerid, COLOR_GREY, "You can't do this right now."); if(PlayerInfo[playerid][pJailed] > 0) return SendClientMessage(playerid, COLOR_WHITE, "You can't use this in jail/prison."); if(PlayerCuffed[playerid] >= 1) return SendClientMessage(playerid, COLOR_WHITE, "You can't use this while tazed/cuffed."); if(GetPVarInt(id, "Injured") == 1) return SendClientMessage(playerid, COLOR_GREY, "You can't cuff injured people."); if(Dragged[id] == 0 && Dragging[playerid] == 0) { if(GetPVarInt(playerid, "pDragging") == 1) { SendClientMessageEx(playerid, COLOR_GRAD1, " You can only drag one person!!!!!! "); return 1; } format(string, sizeof(string), "* %s quickly grabs %s by the right arm, restraining them.", GetPlayerNameEx(playerid), GetPlayerNameEx(id)); ProxDetector(30.0, playerid, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE); 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)); SendClientMessage(playerid, COLOR_PURPLE, string2); SendClientMessage(id, COLOR_PURPLE, string); draggedtimer[id] = SetTimerEx("Draggingt", 1000, 1, "dd", playerid,id); SetPVarInt(id, "pDragging", 1); } else { format(string, sizeof(string), "* %s looks into %s's eyes and then slowly releases them.", GetPlayerNameEx(playerid), GetPlayerNameEx(id)); ProxDetector(30.0, playerid, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE); Dragged[id] = 0; Dragging[playerid] = 0; SendClientMessage(playerid, COLOR_PURPLE, "You have stopped dragging your target."); SendClientMessage(id, COLOR_PURPLE, "You aren't being dragged anymore."); KillTimer(draggedtimer[id]); SetPVarInt(id, "pDragging", 0); } 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); }