13.01.2011, 18:17
hello,i have problem with drag system,if i offer drag to someone,it will give the invite but if someone accepts the drag it will get ME(who offered the drag) frozen and cant be dragged,so yeah need help,thanks
Код:
if(strcmp(cmd,"/drag",true)==0) { if(IsPlayerConnected(playerid)) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_WHITE, "USAGE: /drag [playerid/PartOfName]"); return 1; } giveplayerid = ReturnUser(tmp); if (IsPlayerConnected(giveplayerid)) { if(giveplayerid != INVALID_PLAYER_ID) { if (ProxDetectorS(8.0, playerid, giveplayerid)) { if(giveplayerid == playerid) { SendClientMessage(playerid, COLOR_GREY, " You can't Drag yourself"); return 1; } new string[256]; GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer)); GetPlayerName(playerid, sendername, sizeof(sendername)); format(string, sizeof(string), "* You offered %s a drag .", giveplayer); SendClientMessage(playerid, COLOR_LIGHTBLUE, string); format(string, sizeof(string), "* %s is offering you a drag, (type /accept drag).", sendername); SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, string); DragOffer[giveplayerid] = playerid; } else { SendClientMessage(playerid, COLOR_GREY, " That player is not near you!"); } } } else { SendClientMessage(playerid, COLOR_GREY, " Invalid ID/Name!"); return 1; } } return 1; } if(strcmp(cmd,"/accept",true)==0) { if(IsPlayerConnected(playerid)) { x_job = strtok(cmdtext, idx); if(!strlen(x_job)) { SendClientMessage(playerid, COLOR_WHITE, "USAGE: /accept [name]"); SendClientMessage(playerid, COLOR_GREY, "Available names: drag"); return 1; } else if(strcmp(x_job,"drag",true) == 0) { if(DragOffer[playerid] < MAX_PLAYERS) { if(IsPlayerConnected(DragOffer[playerid])) { new string[256]; GetPlayerName(DragOffer[playerid], giveplayer, sizeof(giveplayer)); GetPlayerName(playerid, sendername, sizeof(sendername)); format(string, sizeof(string), "* You are being dragged by %s, untill he/she stops.", sendername); SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, string); format(string, sizeof(string), "* You are dragging %s, untill you stop.", giveplayer); SendClientMessage(playerid, COLOR_LIGHTBLUE, string); format(string, sizeof(string), "* %s starts dragging %s.", sendername ,giveplayer); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); TogglePlayerControllable(giveplayerid, 0); DragOff[giveplayerid] = playerid; DragTimer2 = SetTimerEx("DragTimer2",1000,1,"i",playerid); return 1; } else { SendClientMessage(playerid, COLOR_GREY, " No-one has offered a drag..."); return 1; } } } } return 1; }